#include <flux/core.h> typedef void (*flux_watcher_f)(flux_reactor_t *r, flux_watcher_t *w, int revents, void *arg); flux_watcher_t *flux_child_watcher_create (flux_reactor_t *r, int pid, bool trace, flux_watcher_f cb, void *arg); int flux_child_watcher_get_rpid (flux_watcher_t *w); int flux_child_watcher_get_rstatus (flux_watcher_t *w);
Link with -lflux-core.
flux_child_watcher_create() creates a reactor watcher that
monitors state transitions of child processes. If
trace is false,
only child termination will trigger an event; otherwise, stop and start
events may be generated.
revents argument should be ignored.
The process id that had a transition may be obtained by calling
The status value returned by waitpid(2) may be obtained by calling
Only a Flux reactor created with the FLUX_REACTOR_SIGCHLD flag can be used with child watchers, as the reactor must register a SIGCHLD signal watcher before any processes are spawned. Only one reactor instance per program may be created with this capability.
flux_child_watcher_create() returns a
flux_watcher_t object on
success. On error, NULL is returned, and
errno is set appropriately.
Out of memory.
Reactor was not created with FLUX_REACTOR_SIGCHLD.