]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/sd_event_get_fd.xml
verify: use manager_load_startable_unit_or_warn() to load units for verification
[thirdparty/systemd.git] / man / sd_event_get_fd.xml
CommitLineData
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 This file is part of systemd.
ba4b3566 9
5de0ccff 10 Copyright 2014 Zbigniew Jędrzejewski-Szmek
ba4b3566 11
5de0ccff
ZJS
12 systemd is free software; you can redistribute it and/or modify it
13 under the terms of the GNU Lesser General Public License as published by
14 the Free Software Foundation; either version 2.1 of the License, or
15 (at your option) any later version.
ba4b3566 16
5de0ccff
ZJS
17 systemd is distributed in the hope that it will be useful, but
18 WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 Lesser General Public License for more details.
ba4b3566 21
5de0ccff
ZJS
22 You should have received a copy of the GNU Lesser General Public License
23 along with systemd; If not, see <http://www.gnu.org/licenses/>.
ba4b3566
ZJS
24-->
25
dc83f27a 26<refentry id="sd_event_get_fd" xmlns:xi="http://www.w3.org/2001/XInclude">
ba4b3566
ZJS
27
28 <refentryinfo>
29 <title>sd_event_get_fd</title>
30 <productname>systemd</productname>
31
32 <authorgroup>
33 <author>
34 <contrib>More text</contrib>
35 <firstname>Zbigniew</firstname>
36 <surname>Jędrzejewski-Szmek</surname>
37 <email>zbyszek@in.waw.pl</email>
38 </author>
39 </authorgroup>
40 </refentryinfo>
41
42 <refmeta>
43 <refentrytitle>sd_event_get_fd</refentrytitle>
44 <manvolnum>3</manvolnum>
45 </refmeta>
46
47 <refnamediv>
48 <refname>sd_event_get_fd</refname>
49
50 <refpurpose>Obtain a file descriptor to poll for event loop events</refpurpose>
51 </refnamediv>
52
53 <refsynopsisdiv>
54 <funcsynopsis>
dc83f27a 55 <funcsynopsisinfo>#include &lt;systemd/sd-event.h&gt;</funcsynopsisinfo>
ba4b3566
ZJS
56
57 <funcprototype>
58 <funcdef>int <function>sd_event_get_fd</function></funcdef>
dc83f27a 59 <paramdef>sd_event *<parameter>event</parameter></paramdef>
ba4b3566
ZJS
60 </funcprototype>
61
62 </funcsynopsis>
63 </refsynopsisdiv>
64
65 <refsect1>
66 <title>Description</title>
67
68 <para><function>sd_event_get_fd()</function> returns the file
dc83f27a 69 descriptor that an event loop object returned by the
ba4b3566 70 <citerefentry><refentrytitle>sd_event_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>
dc83f27a
LP
71 function uses to wait for events. This file descriptor may itself
72 be polled for
73 <constant>POLLIN</constant>/<constant>EPOLLIN</constant>
74 events. This makes it possible to embed an
ba4b3566 75 <citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry>
dc83f27a
LP
76 event loop into another, possibly foreign, event loop.</para>
77
78 <para>The returned file descriptor refers to an <citerefentry
79 project='man-pages'><refentrytitle>epoll</refentrytitle><manvolnum>7</manvolnum></citerefentry>
80 object. It is recommended not to alter it by invoking
81 <citerefentry
82 project='man-pages'><refentrytitle>epoll_ctl</refentrytitle><manvolnum>2</manvolnum></citerefentry>
83 on it, in order to avoid interference with the event loop's inner
84 logic and assumptions.</para>
ba4b3566
ZJS
85 </refsect1>
86
87 <refsect1>
88 <title>Return Value</title>
89
90 <para>On success, <function>sd_event_get_fd()</function> returns a
dc83f27a 91 non-negative file descriptor. On failure, it returns a negative
ba4b3566
ZJS
92 errno-style error code.</para>
93 </refsect1>
94
95 <refsect1>
96 <title>Errors</title>
97
98 <para>Returned errors may indicate the following problems:</para>
99
100 <variablelist>
101 <varlistentry>
102 <term><constant>-EINVAL</constant></term>
103
104 <listitem><para><parameter>event</parameter> is not a valid
105 pointer to an <structname>sd_event</structname> structure.
106 </para></listitem>
107 </varlistentry>
108
109 <varlistentry>
110 <term><constant>-ECHILD</constant></term>
111
112 <listitem><para>The event loop has been created in a different process.</para></listitem>
113
114 </varlistentry>
115 </variablelist>
116 </refsect1>
117
118 <refsect1>
119 <title>Examples</title>
120
121 <example>
dc83f27a 122 <title>Integration in the GLib event loop</title>
ba4b3566
ZJS
123
124 <programlisting><xi:include href="glib-event-glue.c" parse="text" /></programlisting>
125 </example>
126 </refsect1>
127
dc83f27a 128 <xi:include href="libsystemd-pkgconfig.xml" />
ba4b3566
ZJS
129
130 <refsect1>
131 <title>See Also</title>
132
133 <para>
134 <citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
135 <citerefentry><refentrytitle>sd_event_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
dc83f27a
LP
136 <citerefentry><refentrytitle>sd_event_wait</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
137 <citerefentry project='man-pages'><refentrytitle>epoll_ctl</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
138 <citerefentry project='man-pages'><refentrytitle>epoll</refentrytitle><manvolnum>7</manvolnum></citerefentry>
ba4b3566
ZJS
139 </para>
140 </refsect1>
141
142</refentry>