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