]> git.proxmox.com Git - systemd.git/blob - man/sd_event_add_defer.3
Imported Upstream version 217
[systemd.git] / man / sd_event_add_defer.3
1 '\" t
2 .TH "SD_EVENT_ADD_DEFER" "3" "" "systemd 217" "sd_event_add_defer"
3 .\" -----------------------------------------------------------------
4 .\" * Define some portability stuff
5 .\" -----------------------------------------------------------------
6 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 .\" http://bugs.debian.org/507673
8 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
9 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10 .ie \n(.g .ds Aq \(aq
11 .el .ds Aq '
12 .\" -----------------------------------------------------------------
13 .\" * set default formatting
14 .\" -----------------------------------------------------------------
15 .\" disable hyphenation
16 .nh
17 .\" disable justification (adjust text to left margin only)
18 .ad l
19 .\" -----------------------------------------------------------------
20 .\" * MAIN CONTENT STARTS HERE *
21 .\" -----------------------------------------------------------------
22 .SH "NAME"
23 sd_event_add_defer, sd_event_add_post, sd_event_add_exit \- Add static event sources to an event loop
24 .SH "SYNOPSIS"
25 .sp
26 .ft B
27 .nf
28 #include <systemd/sd\-bus\&.h>
29 .fi
30 .ft
31 .HP \w'int\ sd_event_add_defer('u
32 .BI "int sd_event_add_defer(sd_event\ *" "event" ", sd_event_source\ **" "source" ", sd_event_handler_t\ " "handler" ", void\ *" "userdata" ");"
33 .HP \w'int\ sd_event_add_post('u
34 .BI "int sd_event_add_post(sd_event\ *" "event" ", sd_event_source\ **" "source" ", sd_event_handler_t\ " "handler" ", void\ *" "userdata" ");"
35 .HP \w'int\ sd_event_add_exit('u
36 .BI "int sd_event_add_exit(sd_event\ *" "event" ", sd_event_source\ **" "source" ", sd_event_handler_t\ " "handler" ", void\ *" "userdata" ");"
37 .HP \w'typedef\ int\ (*sd_event_handler_t)('u
38 .BI "typedef int (*sd_event_handler_t)(sd_event_source\ *" "s" ", void\ *" "userdata" ");"
39 .SH "DESCRIPTION"
40 .PP
41 Those three functions add new event sources to an event loop object\&. The event loop is specified in
42 \fIevent\fR, the event source is returned in the
43 \fIsource\fR
44 parameter\&. The event sources are enabled statically and will "fire" when the event loop is run and the conditions described below are met\&. The handler function will be passed the
45 \fIuserdata\fR
46 pointer, which may be chosen freely by the caller\&.
47 .PP
48 \fBsd_event_add_defer()\fR
49 adds a new event source that will "fire" the next time the event loop is run\&. By default, the handler will be called once (\fBSD_EVENT_ONESHOT\fR)\&.
50 .PP
51 \fBsd_event_add_defer()\fR
52 adds a new event source that will "fire" if any event handlers are invoked whenever the event loop is run\&. By default, the source is enabled permanently (\fBSD_EVENT_ON\fR)\&.
53 .PP
54 \fBsd_event_add_exit()\fR
55 adds a new event source that will "fire" when the event loop is terminated with
56 \fBsd_event_exit()\fR\&.
57 .PP
58 The
59 \fBsd_event_source_set_enabled\fR(3)
60 function may be used to enable the event source permanently (\fBSD_EVENT_ON\fR) or to make it fire just once (\fBSD_EVENT_ONESHOT\fR)\&. If the handler function returns a negative error code, it will be disabled after the invocation, even if
61 \fBSD_EVENT_ON\fR
62 mode is set\&.
63 .SH "RETURN VALUE"
64 .PP
65 On success, this functions return 0 or a positive integer\&. On failure, they return a negative errno\-style error code\&.
66 .SH "ERRORS"
67 .PP
68 Returned errors may indicate the following problems:
69 .PP
70 \fB\-ENOMEM\fR
71 .RS 4
72 Not enough memory to allocate an object\&.
73 .RE
74 .PP
75 \fB\-EINVAL\fR
76 .RS 4
77 An invalid argument has been passed\&.
78 .RE
79 .PP
80 \fB\-ESTALE\fR
81 .RS 4
82 The event loop is already terminated\&.
83 .RE
84 .PP
85 \fB\-ECHILD\fR
86 .RS 4
87 The event loop has been created in a different process\&.
88 .RE
89 .SH "NOTES"
90 .PP
91 Functions described here are available as a shared library, which can be compiled and linked to with the
92 \fBlibsystemd\fR\ \&\fBpkg-config\fR(1)
93 file\&.
94 .SH "SEE ALSO"
95 .PP
96 \fBsystemd\fR(1),
97 \fBsd-event\fR(3),
98 \fBsd_event_new\fR(3),
99 \fBsd_event_add_time\fR(3),
100 \fBsd_event_add_signal\fR(3),
101 \fBsd_event_add_child\fR(3),
102 \fBsd_event_source_set_enabled\fR(3)