File: sd-event.3

package info (click to toggle)
manpages-de 2.12-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 71,404 kB
  • sloc: sh: 1,059; makefile: 71; python: 64; perl: 37; sed: 11
file content (209 lines) | stat: -rw-r--r-- 5,905 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
'\" t
.TH "SD\-EVENT" "3" "" "systemd 241" "sd-event"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
sd-event \- A generic event loop implementation
.SH "SYNOPSIS"
.sp
.ft B
.nf
#include <systemd/sd\-event\&.h>
.fi
.ft
.HP \w'\fBpkg\-config\ \-\-cflags\ \-\-libs\ libsystemd\fR\ 'u
\fBpkg\-config \-\-cflags \-\-libs libsystemd\fR
.SH "DESCRIPTION"
.PP
sd\-event\&.h
provides a generic event loop implementation, based on Linux
\fBepoll\fR(7)\&.
.PP
See
\fBsd_event_new\fR(3),
\fBsd_event_run\fR(3),
\fBsd_event_add_io\fR(3),
\fBsd_event_add_time\fR(3),
\fBsd_event_add_signal\fR(3),
\fBsd_event_add_child\fR(3),
\fBsd_event_add_inotify\fR(3),
\fBsd_event_add_defer\fR(3),
\fBsd_event_source_unref\fR(3),
\fBsd_event_source_set_priority\fR(3),
\fBsd_event_source_set_enabled\fR(3),
\fBsd_event_source_set_userdata\fR(3),
\fBsd_event_source_get_event\fR(3),
\fBsd_event_source_get_pending\fR(3),
\fBsd_event_source_set_description\fR(3),
\fBsd_event_source_set_prepare\fR(3),
\fBsd_event_wait\fR(3),
\fBsd_event_get_fd\fR(3),
\fBsd_event_set_watchdog\fR(3),
\fBsd_event_exit\fR(3),
\fBsd_event_now\fR(3)
for more information about the functions available\&.
.PP
The event loop design is targeted on running a separate instance of the event loop in each thread; it has no concept of distributing events from a single event loop instance onto multiple worker threads\&. Dispatching events is strictly ordered and subject to configurable priorities\&. In each event loop iteration a single event source is dispatched\&. Each time an event source is dispatched the kernel is polled for new events, before the next event source is dispatched\&. The event loop is designed to honor priorities and provide fairness within each priority\&. It is not designed to provide optimal throughput, as this contradicts these goals due the limitations of the underlying
\fBepoll\fR(7)
primitives\&.
.PP
The event loop implementation provides the following features:
.sp
.RS 4
.ie n \{\
\h'-04' 1.\h'+01'\c
.\}
.el \{\
.sp -1
.IP "  1." 4.2
.\}
I/O event sources, based on
\fBepoll\fR(7)\*(Aqs file descriptor watching, including edge triggered events (\fBEPOLLET\fR)\&. See
\fBsd_event_add_io\fR(3)\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04' 2.\h'+01'\c
.\}
.el \{\
.sp -1
.IP "  2." 4.2
.\}
Timer event sources, based on
\fBtimerfd_create\fR(2), supporting the
\fBCLOCK_MONOTONIC\fR,
\fBCLOCK_REALTIME\fR,
\fBCLOCK_BOOTIME\fR
clocks, as well as the
\fBCLOCK_REALTIME_ALARM\fR
and
\fBCLOCK_BOOTTIME_ALARM\fR
clocks that can resume the system from suspend\&. When creating timer events a required accuracy parameter may be specified which allows coalescing of timer events to minimize power consumption\&. See
\fBsd_event_add_time\fR(3)\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04' 3.\h'+01'\c
.\}
.el \{\
.sp -1
.IP "  3." 4.2
.\}
UNIX process signal events, based on
\fBsignalfd\fR(2), including full support for real\-time signals, and queued parameters\&. See
\fBsd_event_add_signal\fR(3)\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04' 4.\h'+01'\c
.\}
.el \{\
.sp -1
.IP "  4." 4.2
.\}
Child process state change events, based on
\fBwaitid\fR(2)\&. See
\fBsd_event_add_child\fR(3)\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04' 5.\h'+01'\c
.\}
.el \{\
.sp -1
.IP "  5." 4.2
.\}
Static event sources, of three types: defer, post and exit, for invoking calls in each event loop, after other event sources or at event loop termination\&. See
\fBsd_event_add_defer\fR(3)\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04' 6.\h'+01'\c
.\}
.el \{\
.sp -1
.IP "  6." 4.2
.\}
Event sources may be assigned a 64bit priority value, that controls the order in which event sources are dispatched if multiple are pending simultaneously\&. See
\fBsd_event_source_set_priority\fR(3)\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04' 7.\h'+01'\c
.\}
.el \{\
.sp -1
.IP "  7." 4.2
.\}
The event loop may automatically send watchdog notification messages to the service manager\&. See
\fBsd_event_set_watchdog\fR(3)\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04' 8.\h'+01'\c
.\}
.el \{\
.sp -1
.IP "  8." 4.2
.\}
The event loop may be integrated into foreign event loops, such as the GLib one\&. See
\fBsd_event_get_fd\fR(3)
for an example\&.
.RE
.SH "NOTES"
.PP
These APIs are implemented as a shared library, which can be compiled and linked to with the
\fBlibsystemd\fR\ \&\fBpkg-config\fR(1)
file\&.
.SH "SEE ALSO"
.PP
\fBsystemd\fR(1),
\fBsd_event_new\fR(3),
\fBsd_event_run\fR(3),
\fBsd_event_add_io\fR(3),
\fBsd_event_add_time\fR(3),
\fBsd_event_add_signal\fR(3),
\fBsd_event_add_child\fR(3),
\fBsd_event_add_inotify\fR(3),
\fBsd_event_add_defer\fR(3),
\fBsd_event_source_unref\fR(3),
\fBsd_event_source_set_priority\fR(3),
\fBsd_event_source_set_enabled\fR(3),
\fBsd_event_source_set_userdata\fR(3),
\fBsd_event_source_get_event\fR(3),
\fBsd_event_source_get_pending\fR(3),
\fBsd_event_source_set_description\fR(3),
\fBsd_event_source_set_prepare\fR(3),
\fBsd_event_wait\fR(3),
\fBsd_event_get_fd\fR(3),
\fBsd_event_set_watchdog\fR(3),
\fBsd_event_exit\fR(3),
\fBsd_event_now\fR(3),
\fBepoll\fR(7),
\fBtimerfd_create\fR(2),
\fBsignalfd\fR(2),
\fBwaitid\fR(2)