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