From: Zbigniew Jędrzejewski-Szmek Date: Thu, 25 Sep 2014 21:27:33 +0000 (-0400) Subject: man: add sd_event_add_child(3) X-Git-Tag: v217~430 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=edf2573743b25273bee020230a60f1a054b8ec60 man: add sd_event_add_child(3) --- diff --git a/Makefile-man.am b/Makefile-man.am index 85a3612f3..53e2f2cf1 100644 --- a/Makefile-man.am +++ b/Makefile-man.am @@ -741,6 +741,7 @@ MANPAGES += \ man/sd_bus_open_user.3 \ man/sd_bus_path_encode.3 \ man/sd_bus_request_name.3 \ + man/sd_event_add_child.3 \ man/sd_event_add_signal.3 \ man/sd_event_add_time.3 \ man/sd_event_new.3 \ @@ -803,6 +804,7 @@ MANPAGES_ALIAS += \ man/sd_bus_unref.3 \ man/sd_event_default.3 \ man/sd_event_ref.3 \ + man/sd_event_source_get_child_pid.3 \ man/sd_event_source_get_signal.3 \ man/sd_event_source_get_time.3 \ man/sd_event_source_get_time_accuracy.3 \ @@ -867,6 +869,7 @@ man/sd_bus_release_name.3: man/sd_bus_request_name.3 man/sd_bus_unref.3: man/sd_bus_new.3 man/sd_event_default.3: man/sd_event_new.3 man/sd_event_ref.3: man/sd_event_new.3 +man/sd_event_source_get_child_pid.3: man/sd_event_add_child.3 man/sd_event_source_get_signal.3: man/sd_event_add_signal.3 man/sd_event_source_get_time.3: man/sd_event_add_time.3 man/sd_event_source_get_time_accuracy.3: man/sd_event_add_time.3 @@ -1043,6 +1046,9 @@ man/sd_event_default.html: man/sd_event_new.html man/sd_event_ref.html: man/sd_event_new.html $(html-alias) +man/sd_event_source_get_child_pid.html: man/sd_event_add_child.html + $(html-alias) + man/sd_event_source_get_signal.html: man/sd_event_add_signal.html $(html-alias) @@ -1548,6 +1554,7 @@ EXTRA_DIST += \ man/sd_bus_open_user.xml \ man/sd_bus_path_encode.xml \ man/sd_bus_request_name.xml \ + man/sd_event_add_child.xml \ man/sd_event_add_signal.xml \ man/sd_event_add_time.xml \ man/sd_event_new.xml \ diff --git a/man/sd_event_add_child.xml b/man/sd_event_add_child.xml new file mode 100644 index 000000000..a3b4d85ac --- /dev/null +++ b/man/sd_event_add_child.xml @@ -0,0 +1,205 @@ + + + + + + + + + sd_event_add_child + systemd + + + + More text + Zbigniew + Jędrzejewski-Szmek + zbyszek@in.waw.pl + + + + + + sd_event_add_child + 3 + + + + sd_event_add_child + sd_event_source_get_child_pid + + Add a child state change event source to an event loop + + + + + #include <systemd/sd-bus.h> + + + int sd_event_add_child + sd_event *event + sd_event_source **source + pid_t pid + int options + sd_event_child_handler_t handler + void *userdata + + + + typedef int (*sd_event_child_handler_t) + sd_event_source *s + const siginfo_t *si + void *userdata + + + + int sd_event_source_get_child_pid + sd_event_source *source + pid_t *pid + + + + + + + Description + + sd_event_add_child() adds a new child + state change event source to an event loop object. The event loop + is specified in event, the event source is + returned in the source parameter. The + pid parameter specifies the process to + watch. The handler must reference a + function to call when the process changes state. The handler + function will be passed the userdata + pointer, which may be chosen freely by the caller. The handler + also receives a pointer to a const + siginfo_t structure containing the information about + the event. The options parameter determines + which state changes will be watched for. It must contain an OR-ed + mask of WEXITED (watch for the child + terminating), WSTOPPED (watch for the child + being stopped by a signal), and WCONTINUED + (watch for the child being resumed by a signal). See + waitid2 + for futher information. + + Only a single handler may be installed for a specific + child. The handler is enabled + for a single event (SD_EVENT_ONESHOT), + but this may be + changed with + sd_event_source_set_enabled3. + If the handler function returns a negative error code, it will be + disabled after the invocation, even if + SD_EVENT_ON mode is set. + + + sd_event_source_get_child_pid() + retrieves the configured pid of a child + state change event source created previously with + sd_event_add_child(). It takes the event + source object as the source parameter and a + pointer to pid_t to return the result in. + + + + + Return Value + + On success, these functions return 0 or a positive + integer. On failure, they return a negative errno-style error + code. + + + + Errors + + Returned errors may indicate the following problems: + + + + -ENOMEM + + Not enough memory to allocate an object. + + + + -EINVAL + + An invalid argument has been passed. This includes + specyfing an empty mask in options or a mask + which constains values different than a combination of + WEXITED, WSTOPPED, and + WCONTINUED. + + + + + + -EBUSY + + An handler is already installed for this + child. + + + + + -ESTALE + + The event loop is already terminated. + + + + + -ECHILD + + The event loop has been created in a different process. + + + + + + + + Notes + + sd_event_add_child() and the other functions + described here are available as a shared library, which can be + compiled and linked to with the + libsystemd pkg-config1 + file. + + + + See Also + + + systemd1, + sd-event3, + sd_event_new3, + sd_event_add_time3, + sd_event_add_signal3, + sd_event_source_set_enabled3 + + + + diff --git a/man/sd_event_add_signal.xml b/man/sd_event_add_signal.xml index 2344fb3c0..2b656b67a 100644 --- a/man/sd_event_add_signal.xml +++ b/man/sd_event_add_signal.xml @@ -189,6 +189,7 @@ along with systemd; If not, see . sd-event3, sd_event_new3, sd_event_add_time3, + sd_event_add_child3, sd_event_source_set_enabled3 diff --git a/man/sd_event_add_time.xml b/man/sd_event_add_time.xml index d3775e5d5..e64ed8e20 100644 --- a/man/sd_event_add_time.xml +++ b/man/sd_event_add_time.xml @@ -249,6 +249,7 @@ along with systemd; If not, see . sd-event3, sd_event_new3, sd_event_add_signal3, + sd_event_add_child3, clock_gettime2, sd_event_source_set_enabled3