]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/sd_event_get_fd.xml
sd-event: define a new PREPARING state
[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
48f69d8f 24<refentry id="sd_event_get_fd"
ba4b3566
ZJS
25 xmlns:xi="http://www.w3.org/2001/XInclude">
26
27 <refentryinfo>
28 <title>sd_event_get_fd</title>
29 <productname>systemd</productname>
30
31 <authorgroup>
32 <author>
33 <contrib>More text</contrib>
34 <firstname>Zbigniew</firstname>
35 <surname>Jędrzejewski-Szmek</surname>
36 <email>zbyszek@in.waw.pl</email>
37 </author>
38 </authorgroup>
39 </refentryinfo>
40
41 <refmeta>
42 <refentrytitle>sd_event_get_fd</refentrytitle>
43 <manvolnum>3</manvolnum>
44 </refmeta>
45
46 <refnamediv>
47 <refname>sd_event_get_fd</refname>
48
49 <refpurpose>Obtain a file descriptor to poll for event loop events</refpurpose>
50 </refnamediv>
51
52 <refsynopsisdiv>
53 <funcsynopsis>
54 <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
55
56 <funcprototype>
57 <funcdef>int <function>sd_event_get_fd</function></funcdef>
58 <paramdef>sd_bus *<parameter>event</parameter></paramdef>
59 </funcprototype>
60
61 </funcsynopsis>
62 </refsynopsisdiv>
63
64 <refsect1>
65 <title>Description</title>
66
67 <para><function>sd_event_get_fd()</function> returns the file
68 descriptor that the event loop object returned by the
69 <citerefentry><refentrytitle>sd_event_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>
70 function uses to wait for events. This file descriptor can be
71 polled for events. This makes it possible to embed the
72 <citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry>
73 event loop inside of another event loop.</para>
74 </refsect1>
75
76 <refsect1>
77 <title>Return Value</title>
78
79 <para>On success, <function>sd_event_get_fd()</function> returns a
80 non-negative integer. On failure, it returns a negative
81 errno-style error code.</para>
82 </refsect1>
83
84 <refsect1>
85 <title>Errors</title>
86
87 <para>Returned errors may indicate the following problems:</para>
88
89 <variablelist>
90 <varlistentry>
91 <term><constant>-EINVAL</constant></term>
92
93 <listitem><para><parameter>event</parameter> is not a valid
94 pointer to an <structname>sd_event</structname> structure.
95 </para></listitem>
96 </varlistentry>
97
98 <varlistentry>
99 <term><constant>-ECHILD</constant></term>
100
101 <listitem><para>The event loop has been created in a different process.</para></listitem>
102
103 </varlistentry>
104 </variablelist>
105 </refsect1>
106
107 <refsect1>
108 <title>Examples</title>
109
110 <example>
111 <title>Integration in glib event loop</title>
112
113 <programlisting><xi:include href="glib-event-glue.c" parse="text" /></programlisting>
114 </example>
115 </refsect1>
116
117 <refsect1>
118 <title>Notes</title>
119
120 <para><function>sd_event_get_fd()</function> is available as a
121 shared library, which can be compiled and linked to with the
122 <constant>libsystemd</constant> <citerefentry
123 project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
124 file.</para>
125 </refsect1>
126
127 <refsect1>
128 <title>See Also</title>
129
130 <para>
131 <citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
132 <citerefentry><refentrytitle>sd_event_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
133 <citerefentry><refentrytitle>sd_event_ref</refentrytitle><manvolnum>3</manvolnum></citerefentry>
134 </para>
135 </refsect1>
136
137</refentry>