|
Tor 0.5.0.0-alpha-dev
|
Process-termination monitor functions. More...
#include "lib/evloop/procmon.h"#include "lib/log/log.h"#include "lib/log/util_bug.h"#include "lib/log/win32err.h"#include "lib/malloc/malloc.h"#include "lib/string/parse_int.h"Go to the source code of this file.
Data Structures | |
| struct | parsed_process_specifier_t |
| struct | tor_process_monitor_t |
Macros | |
| #define | PID_T_FORMAT "%d" |
| #define | PROCMON_POLLS 1 |
Functions | |
| static void | tor_process_monitor_poll_cb (periodic_timer_t *ev, void *procmon_) |
| static int | parse_process_specifier (const char *process_spec, struct parsed_process_specifier_t *ppspec, const char **msg) |
| int | tor_validate_process_specifier (const char *process_spec, const char **msg) |
| tor_process_monitor_t * | tor_process_monitor_new (struct event_base *base, const char *process_spec, log_domain_mask_t log_domain, tor_procmon_callback_t cb, void *cb_arg, const char **msg) |
| void | tor_process_monitor_free_ (tor_process_monitor_t *procmon) |
Variables | |
| static const struct timeval | poll_interval_tv = {15, 0} |
Process-termination monitor functions.
Definition in file procmon.c.
|
static |
Parse the process specifier given in process_spec into *ppspec. Return 0 on success; return -1 and store an error message into *msg on failure. The caller must not free the returned error message.
Definition at line 70 of file procmon.c.
Referenced by tor_process_monitor_new(), and tor_validate_process_specifier().
| void tor_process_monitor_free_ | ( | tor_process_monitor_t * | procmon | ) |
| tor_process_monitor_t * tor_process_monitor_new | ( | struct event_base * | base, |
| const char * | process_spec, | ||
| log_domain_mask_t | log_domain, | ||
| tor_procmon_callback_t | cb, | ||
| void * | cb_arg, | ||
| const char ** | msg | ||
| ) |
Create a process-termination monitor for the process specifier given in process_spec. Return a newly allocated tor_process_monitor_t on success; return NULL and store an error message into *msg on failure. The caller must not free the returned error message.
When the monitored process terminates, call cb(cb_arg).
Definition at line 181 of file procmon.c.
Referenced by monitor_owning_controller_process().
|
static |
Libevent callback to poll for the existence of the process monitored by procmon_.
Definition at line 248 of file procmon.c.
Referenced by tor_process_monitor_new().
| int tor_validate_process_specifier | ( | const char * | process_spec, |
| const char ** | msg | ||
| ) |
Verify that the process specifier given in process_spec is syntactically valid. Return 0 on success; return -1 and store an error message into *msg on failure. The caller must not free the returned error message.
Definition at line 157 of file procmon.c.
Referenced by options_validate_cb().