From: Lennart Poettering Date: Tue, 1 Apr 2014 17:12:59 +0000 (+0200) Subject: man: add man page for sd_event_new() X-Git-Tag: v213~417 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=faae655de3cdbed4be1d472b01ce0c4d81e905ed;hp=9ea28c55a2488e6cd4a44ac5786f12b71ad5bc9f man: add man page for sd_event_new() --- diff --git a/Makefile-man.am b/Makefile-man.am index d772defb8..90d32c521 100644 --- a/Makefile-man.am +++ b/Makefile-man.am @@ -703,6 +703,7 @@ MANPAGES += \ man/sd_bus_open_user.3 \ man/sd_bus_path_encode.3 \ man/sd_bus_request_name.3 \ + man/sd_event_new.3 \ man/systemd-bus-proxyd.8 \ man/systemd-bus-proxyd@.service.8 MANPAGES_ALIAS += \ @@ -760,6 +761,9 @@ MANPAGES_ALIAS += \ man/sd_bus_ref.3 \ man/sd_bus_release_name.3 \ man/sd_bus_unref.3 \ + man/sd_event_default.3 \ + man/sd_event_ref.3 \ + man/sd_event_unref.3 \ man/systemd-bus-proxyd.socket.8 man/sd_bus_creds_get_audit_login_uid.3: man/sd_bus_creds_get_pid.3 man/sd_bus_creds_get_audit_session_id.3: man/sd_bus_creds_get_pid.3 @@ -815,6 +819,9 @@ man/sd_bus_path_decode.3: man/sd_bus_path_encode.3 man/sd_bus_ref.3: man/sd_bus_new.3 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_unref.3: man/sd_event_new.3 man/systemd-bus-proxyd.socket.8: man/systemd-bus-proxyd@.service.8 man/sd_bus_creds_get_audit_login_uid.html: man/sd_bus_creds_get_pid.html $(html-alias) @@ -978,6 +985,15 @@ man/sd_bus_release_name.html: man/sd_bus_request_name.html man/sd_bus_unref.html: man/sd_bus_new.html $(html-alias) +man/sd_event_default.html: man/sd_event_new.html + $(html-alias) + +man/sd_event_ref.html: man/sd_event_new.html + $(html-alias) + +man/sd_event_unref.html: man/sd_event_new.html + $(html-alias) + man/systemd-bus-proxyd.socket.html: man/systemd-bus-proxyd@.service.html $(html-alias) @@ -1446,6 +1462,7 @@ EXTRA_DIST += \ man/sd_bus_open_user.xml \ man/sd_bus_path_encode.xml \ man/sd_bus_request_name.xml \ + man/sd_event_new.xml \ man/sd_get_seats.xml \ man/sd_id128_get_machine.xml \ man/sd_id128_randomize.xml \ diff --git a/man/sd_bus_negotiate_fds.xml b/man/sd_bus_negotiate_fds.xml index 38e1fad68..c2061941a 100644 --- a/man/sd_bus_negotiate_fds.xml +++ b/man/sd_bus_negotiate_fds.xml @@ -24,7 +24,7 @@ along with systemd; If not, see . - sd_bus_new + sd_bus_negotiate_fds systemd @@ -132,7 +132,7 @@ along with systemd; If not, see . Return Value On success, these functions returns 0 or a - positive integer. On failure, it returns a negative errno-style + positive integer. On failure, they return a negative errno-style error code. diff --git a/man/sd_event_new.xml b/man/sd_event_new.xml new file mode 100644 index 000000000..1fe18202b --- /dev/null +++ b/man/sd_event_new.xml @@ -0,0 +1,181 @@ + + + + + + + + + sd_event_new + systemd + + + + Developer + Lennart + Poettering + lennart@poettering.net + + + + + + sd_event_new + 3 + + + + sd_event_new + sd_event_default + sd_event_ref + sd_event_unref + + Acquire and release an event loop object + + + + + #include <systemd/sd-bus.h> + + + int sd_event_new + sd_bus **event + + + + int sd_event_default + sd_bus **event + + + + sd_bus *sd_event_ref + sd_bus *event + + + + sd_bus *sd_event_unref + sd_bus *event + + + + + + + Description + + sd_event_new() allocates a new event + loop object. The event loop object is returned in the + event parameter. After use drop + the returned reference with + sd_event_unref(). When the last reference is + dropped the event loop is freed. + + sd_event_default() acquires a reference + to the default event loop object of the calling thread, possibly + allocating a new object if no default event loop object has been + allocated yet for the thread. After use drop the returned + referened with sd_event_unref(). When the + last reference is dropped the event loop is freed. If this + function is called while the object returned from a previous call + from the same thread is still referenced, the same object is + returned again, but the reference is increased by one. It is + recommended to use this call instead of + sd_event_new() in order to share event loop + objects between various components that are dispatched in the same + thread. All threads either have no or one default event loops + associated, but never more. + + sd_event_ref() increases the reference + counter of the specified event loop object by one. + + sd_event_unref() decreases the + reference counter of the specified event loop object by one. If + the counter hits zero the event loop object is freed. Not that it + is freed regardless if it is the default event loop object of a + thread or not. This means that allocating an event loop with + sd_event_default(), then releasing it and + then acquiring a new one with + sd_event_default() will result in two + distinct objects. Note that in order to free an event loop object + all remaining event sources of the event loop also need to be + freed as they each keep a reference to it. + + + + Return Value + + On success, sd_event_new() and + sd_event_default() return 0 or a positive + integer. On failure, they return a negative errno-style error + code. sd_event_ref() always returns a pointer + to the event loop object passed + in. sd_event_unref() always returns + NULL. + + + + Errors + + Returned errors may indicate the following problems: + + + + -ENOMEM + + Not enough memory to allocate object + + + + -EMFILE + + The maximum number of event loops has been allocated. + + + + + + + Notes + + sd_event_new() 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_add_io3, + sd_event_add_time3, + sd_event_add_signal3, + sd_event_add_child3, + sd_event_add_defer3, + sd_event_add_post3, + sd_event_add_exit3 + + + +