]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/sd_event_get_fd.xml
man: drop mode line in file headers
[thirdparty/systemd.git] / man / sd_event_get_fd.xml
CommitLineData
514094f9 1<?xml version='1.0'?>
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 6 SPDX-License-Identifier: LGPL-2.1+
ba4b3566
ZJS
7-->
8
dc83f27a 9<refentry id="sd_event_get_fd" xmlns:xi="http://www.w3.org/2001/XInclude">
ba4b3566
ZJS
10
11 <refentryinfo>
12 <title>sd_event_get_fd</title>
13 <productname>systemd</productname>
ba4b3566
ZJS
14 </refentryinfo>
15
16 <refmeta>
17 <refentrytitle>sd_event_get_fd</refentrytitle>
18 <manvolnum>3</manvolnum>
19 </refmeta>
20
21 <refnamediv>
22 <refname>sd_event_get_fd</refname>
23
24 <refpurpose>Obtain a file descriptor to poll for event loop events</refpurpose>
25 </refnamediv>
26
27 <refsynopsisdiv>
28 <funcsynopsis>
dc83f27a 29 <funcsynopsisinfo>#include &lt;systemd/sd-event.h&gt;</funcsynopsisinfo>
ba4b3566
ZJS
30
31 <funcprototype>
32 <funcdef>int <function>sd_event_get_fd</function></funcdef>
dc83f27a 33 <paramdef>sd_event *<parameter>event</parameter></paramdef>
ba4b3566
ZJS
34 </funcprototype>
35
36 </funcsynopsis>
37 </refsynopsisdiv>
38
39 <refsect1>
40 <title>Description</title>
41
42 <para><function>sd_event_get_fd()</function> returns the file
dc83f27a 43 descriptor that an event loop object returned by the
ba4b3566 44 <citerefentry><refentrytitle>sd_event_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>
dc83f27a
LP
45 function uses to wait for events. This file descriptor may itself
46 be polled for
47 <constant>POLLIN</constant>/<constant>EPOLLIN</constant>
48 events. This makes it possible to embed an
ba4b3566 49 <citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry>
dc83f27a
LP
50 event loop into another, possibly foreign, event loop.</para>
51
52 <para>The returned file descriptor refers to an <citerefentry
53 project='man-pages'><refentrytitle>epoll</refentrytitle><manvolnum>7</manvolnum></citerefentry>
54 object. It is recommended not to alter it by invoking
55 <citerefentry
56 project='man-pages'><refentrytitle>epoll_ctl</refentrytitle><manvolnum>2</manvolnum></citerefentry>
57 on it, in order to avoid interference with the event loop's inner
58 logic and assumptions.</para>
ba4b3566
ZJS
59 </refsect1>
60
61 <refsect1>
62 <title>Return Value</title>
63
64 <para>On success, <function>sd_event_get_fd()</function> returns a
dc83f27a 65 non-negative file descriptor. On failure, it returns a negative
ba4b3566
ZJS
66 errno-style error code.</para>
67 </refsect1>
68
69 <refsect1>
70 <title>Errors</title>
71
72 <para>Returned errors may indicate the following problems:</para>
73
74 <variablelist>
75 <varlistentry>
76 <term><constant>-EINVAL</constant></term>
77
78 <listitem><para><parameter>event</parameter> is not a valid
79 pointer to an <structname>sd_event</structname> structure.
80 </para></listitem>
81 </varlistentry>
82
83 <varlistentry>
84 <term><constant>-ECHILD</constant></term>
85
86 <listitem><para>The event loop has been created in a different process.</para></listitem>
87
88 </varlistentry>
89 </variablelist>
90 </refsect1>
91
92 <refsect1>
93 <title>Examples</title>
94
95 <example>
dc83f27a 96 <title>Integration in the GLib event loop</title>
ba4b3566
ZJS
97
98 <programlisting><xi:include href="glib-event-glue.c" parse="text" /></programlisting>
99 </example>
100 </refsect1>
101
dc83f27a 102 <xi:include href="libsystemd-pkgconfig.xml" />
ba4b3566
ZJS
103
104 <refsect1>
105 <title>See Also</title>
106
107 <para>
108 <citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
109 <citerefentry><refentrytitle>sd_event_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
dc83f27a
LP
110 <citerefentry><refentrytitle>sd_event_wait</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
111 <citerefentry project='man-pages'><refentrytitle>epoll_ctl</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
112 <citerefentry project='man-pages'><refentrytitle>epoll</refentrytitle><manvolnum>7</manvolnum></citerefentry>
ba4b3566
ZJS
113 </para>
114 </refsect1>
115
116</refentry>