Tor  0.4.7.0-alpha-dev
Data Structures | Functions
waitpid.c File Reference

Convenience structures for handlers for handling waitpid(). More...

#include "orconfig.h"
#include "lib/process/waitpid.h"
#include "lib/log/log.h"
#include "lib/log/util_bug.h"
#include "lib/malloc/malloc.h"
#include "ext/ht.h"
#include <string.h>

Go to the source code of this file.

Data Structures

struct  waitpid_callback_t
 

Functions

static unsigned int process_map_entry_hash_ (const waitpid_callback_t *ent)
 
static unsigned int process_map_entries_eq_ (const waitpid_callback_t *a, const waitpid_callback_t *b)
 
static HT_HEAD (HT_PROTOTYPE(process_map, HT_PROTOTYPE(waitpid_callback_t)
 
void clear_waitpid_callback (waitpid_callback_t *ent)
 
static void notify_waitpid_callback_by_pid (pid_t pid, int status)
 
void notify_pending_waitpid_callbacks (void)
 

Detailed Description

Convenience structures for handlers for handling waitpid().

Definition in file waitpid.c.

Function Documentation

◆ clear_waitpid_callback()

void clear_waitpid_callback ( waitpid_callback_t ent)

Cancel a waitpid_callback_t, or clean up after one has triggered. Releases all storage held by ent.

Definition at line 98 of file waitpid.c.

Referenced by process_unix_free_().

◆ notify_pending_waitpid_callbacks()

void notify_pending_waitpid_callbacks ( void  )

Use waitpid() to wait for all children that have exited, and invoke any callbacks registered for them.

Definition at line 141 of file waitpid.c.

◆ notify_waitpid_callback_by_pid()

static void notify_waitpid_callback_by_pid ( pid_t  pid,
int  status 
)
static

Helper: find the callback for pid; if there is one, run it, reporting the exit status as status.

Definition at line 119 of file waitpid.c.