102 struct event* sig_event = NULL;
104 int child_stdout_fd = -1;
105 struct event* child_stdout_event = NULL;
107 char* cmd[] = {
"ls",
"-la", NULL };
116 base = event_base_new();
125 event_add(sig_event, NULL);
128 child_stdout_event = event_new(
base, child_stdout_fd, EV_READ | EV_PERSIST,
child_stdout_cb, NULL);
129 event_add(child_stdout_event, NULL);
136 event_base_dispatch(
base);
142 event_del(sig_event);
143 event_free(sig_event);
144 event_del(child_stdout_event);
145 event_free(child_stdout_event);
146 event_base_free(
base);
static void signal_cb(__attribute__((unused)) evutil_socket_t fd, __attribute__((unused)) short event, __attribute__((unused)) void *arg)
static void slot_proc_stop(const char *const sig_name, const amxc_var_t *const data, __attribute__((unused)) void *priv)
static struct event_base * base
static void child_stdout_cb(evutil_socket_t fd, __attribute__((unused)) short event, __attribute__((unused)) void *arg)
int amxp_slot_connect(amxp_signal_mngr_t *const sig_mngr, const char *const sig_name, const char *const expression, amxp_slot_fn_t fn, void *const priv)
Connects a slot (function) to a named signal of a signal manager.
int amxp_subproc_open_fd(amxp_subproc_t *subproc, int requested)
Opens standard file descriptor to the child process.
int amxp_subproc_new(amxp_subproc_t **subproc)
Constructor function, creates a new child process data structure.
int amxp_subproc_vstart(amxp_subproc_t *const subproc, char **argv)
Start a child process.
amxp_signal_mngr_t * amxp_subproc_get_sigmngr(const amxp_subproc_t *const subproc)
Get the Signal managers of the child process.
int amxp_subproc_delete(amxp_subproc_t **subproc)
Destructor function, deletes a child process data structure.
pid_t amxp_subproc_get_pid(const amxp_subproc_t *const subproc)
Get the PID of a child process.
int amxp_syssig_get_fd(void)
Returns a file descriptor that can be used in an eventloop.
Child process information structure.