]>
Commit | Line | Data |
---|---|---|
3802a3d3 | 1 | <?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*--> |
ba4b3566 | 2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" |
12b42c76 | 3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> |
ba4b3566 ZJS |
4 | |
5 | <!-- | |
572eb058 ZJS |
6 | SPDX-License-Identifier: LGPL-2.1+ |
7 | ||
5de0ccff | 8 | Copyright 2014 Zbigniew Jędrzejewski-Szmek |
ba4b3566 ZJS |
9 | --> |
10 | ||
dc83f27a | 11 | <refentry id="sd_event_get_fd" xmlns:xi="http://www.w3.org/2001/XInclude"> |
ba4b3566 ZJS |
12 | |
13 | <refentryinfo> | |
14 | <title>sd_event_get_fd</title> | |
15 | <productname>systemd</productname> | |
16 | ||
17 | <authorgroup> | |
18 | <author> | |
19 | <contrib>More text</contrib> | |
20 | <firstname>Zbigniew</firstname> | |
21 | <surname>Jędrzejewski-Szmek</surname> | |
22 | <email>zbyszek@in.waw.pl</email> | |
23 | </author> | |
24 | </authorgroup> | |
25 | </refentryinfo> | |
26 | ||
27 | <refmeta> | |
28 | <refentrytitle>sd_event_get_fd</refentrytitle> | |
29 | <manvolnum>3</manvolnum> | |
30 | </refmeta> | |
31 | ||
32 | <refnamediv> | |
33 | <refname>sd_event_get_fd</refname> | |
34 | ||
35 | <refpurpose>Obtain a file descriptor to poll for event loop events</refpurpose> | |
36 | </refnamediv> | |
37 | ||
38 | <refsynopsisdiv> | |
39 | <funcsynopsis> | |
dc83f27a | 40 | <funcsynopsisinfo>#include <systemd/sd-event.h></funcsynopsisinfo> |
ba4b3566 ZJS |
41 | |
42 | <funcprototype> | |
43 | <funcdef>int <function>sd_event_get_fd</function></funcdef> | |
dc83f27a | 44 | <paramdef>sd_event *<parameter>event</parameter></paramdef> |
ba4b3566 ZJS |
45 | </funcprototype> |
46 | ||
47 | </funcsynopsis> | |
48 | </refsynopsisdiv> | |
49 | ||
50 | <refsect1> | |
51 | <title>Description</title> | |
52 | ||
53 | <para><function>sd_event_get_fd()</function> returns the file | |
dc83f27a | 54 | descriptor that an event loop object returned by the |
ba4b3566 | 55 | <citerefentry><refentrytitle>sd_event_new</refentrytitle><manvolnum>3</manvolnum></citerefentry> |
dc83f27a LP |
56 | function uses to wait for events. This file descriptor may itself |
57 | be polled for | |
58 | <constant>POLLIN</constant>/<constant>EPOLLIN</constant> | |
59 | events. This makes it possible to embed an | |
ba4b3566 | 60 | <citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry> |
dc83f27a LP |
61 | event loop into another, possibly foreign, event loop.</para> |
62 | ||
63 | <para>The returned file descriptor refers to an <citerefentry | |
64 | project='man-pages'><refentrytitle>epoll</refentrytitle><manvolnum>7</manvolnum></citerefentry> | |
65 | object. It is recommended not to alter it by invoking | |
66 | <citerefentry | |
67 | project='man-pages'><refentrytitle>epoll_ctl</refentrytitle><manvolnum>2</manvolnum></citerefentry> | |
68 | on it, in order to avoid interference with the event loop's inner | |
69 | logic and assumptions.</para> | |
ba4b3566 ZJS |
70 | </refsect1> |
71 | ||
72 | <refsect1> | |
73 | <title>Return Value</title> | |
74 | ||
75 | <para>On success, <function>sd_event_get_fd()</function> returns a | |
dc83f27a | 76 | non-negative file descriptor. On failure, it returns a negative |
ba4b3566 ZJS |
77 | errno-style error code.</para> |
78 | </refsect1> | |
79 | ||
80 | <refsect1> | |
81 | <title>Errors</title> | |
82 | ||
83 | <para>Returned errors may indicate the following problems:</para> | |
84 | ||
85 | <variablelist> | |
86 | <varlistentry> | |
87 | <term><constant>-EINVAL</constant></term> | |
88 | ||
89 | <listitem><para><parameter>event</parameter> is not a valid | |
90 | pointer to an <structname>sd_event</structname> structure. | |
91 | </para></listitem> | |
92 | </varlistentry> | |
93 | ||
94 | <varlistentry> | |
95 | <term><constant>-ECHILD</constant></term> | |
96 | ||
97 | <listitem><para>The event loop has been created in a different process.</para></listitem> | |
98 | ||
99 | </varlistentry> | |
100 | </variablelist> | |
101 | </refsect1> | |
102 | ||
103 | <refsect1> | |
104 | <title>Examples</title> | |
105 | ||
106 | <example> | |
dc83f27a | 107 | <title>Integration in the GLib event loop</title> |
ba4b3566 ZJS |
108 | |
109 | <programlisting><xi:include href="glib-event-glue.c" parse="text" /></programlisting> | |
110 | </example> | |
111 | </refsect1> | |
112 | ||
dc83f27a | 113 | <xi:include href="libsystemd-pkgconfig.xml" /> |
ba4b3566 ZJS |
114 | |
115 | <refsect1> | |
116 | <title>See Also</title> | |
117 | ||
118 | <para> | |
119 | <citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
120 | <citerefentry><refentrytitle>sd_event_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
dc83f27a LP |
121 | <citerefentry><refentrytitle>sd_event_wait</refentrytitle><manvolnum>3</manvolnum></citerefentry>, |
122 | <citerefentry project='man-pages'><refentrytitle>epoll_ctl</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
123 | <citerefentry project='man-pages'><refentrytitle>epoll</refentrytitle><manvolnum>7</manvolnum></citerefentry> | |
ba4b3566 ZJS |
124 | </para> |
125 | </refsect1> | |
126 | ||
127 | </refentry> |