tor  master
Data Structures | Macros | Functions
procmon.c File Reference

Process-termination monitor functions. More...

#include "procmon.h"
#include "util.h"
Include dependency graph for procmon.c:

Data Structures

struct  parsed_process_specifier_t
 
struct  tor_process_monitor_t
 

Macros

#define PID_T_FORMAT   "%d"
 
#define PROCMON_POLLS   1
 

Functions

int tor_validate_process_specifier (const char *process_spec, const char **msg)
 
tor_process_monitor_ttor_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)
 

Detailed Description

Process-termination monitor functions.

Function Documentation

◆ tor_process_monitor_free_()

void tor_process_monitor_free_ ( tor_process_monitor_t procmon)

Free the process-termination monitor procmon.

◆ tor_process_monitor_new()

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).

◆ tor_validate_process_specifier()

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.