chiark / gitweb /
Fix service file to match installed elogind binary location
[elogind.git] / man / sd_event_get_fd.xml
1 <?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4
5 <!--
6   This file is part of elogind.
7
8   Copyright 2014 Zbigniew JÄ™drzejewski-Szmek
9
10   elogind 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.
14
15   elogind 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.
19
20   You should have received a copy of the GNU Lesser General Public License
21   along with elogind; If not, see <http://www.gnu.org/licenses/>.
22 -->
23
24 <refentry id="sd_event_get_fd" xmlns:xi="http://www.w3.org/2001/XInclude">
25
26   <refentryinfo>
27     <title>sd_event_get_fd</title>
28     <productname>elogind</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>
53       <funcsynopsisinfo>#include &lt;elogind/sd-event.h&gt;</funcsynopsisinfo>
54
55       <funcprototype>
56         <funcdef>int <function>sd_event_get_fd</function></funcdef>
57         <paramdef>sd_event *<parameter>event</parameter></paramdef>
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
67     descriptor that an event loop object returned by the
68     <citerefentry><refentrytitle>sd_event_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>
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
73     <citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry>
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>
83   </refsect1>
84
85   <refsect1>
86     <title>Return Value</title>
87
88     <para>On success, <function>sd_event_get_fd()</function> returns a
89     non-negative file descriptor. On failure, it returns a negative
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>
120       <title>Integration in the GLib event loop</title>
121
122       <programlisting><xi:include href="glib-event-glue.c" parse="text" /></programlisting>
123     </example>
124   </refsect1>
125
126   <xi:include href="libelogind-pkgconfig.xml" />
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>,
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>
137     </para>
138   </refsect1>
139
140 </refentry>