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 <!ENTITY % entities SYSTEM
"custom-entities.ent" >
9 This file is part of systemd.
11 Copyright 2014 Zbigniew Jędrzejewski-Szmek
13 systemd is free software; you can redistribute it and/or modify it
14 under the terms of the GNU Lesser General Public License as published by
15 the Free Software Foundation; either version 2.1 of the License, or
16 (at your option) any later version.
18 systemd is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 Lesser General Public License for more details.
23 You should have received a copy of the GNU Lesser General Public License
24 along with systemd; If not, see <http://www.gnu.org/licenses/>.
27 <refentry id=
"sd_event_get_fd"
28 xmlns:
xi=
"http://www.w3.org/2001/XInclude">
31 <title>sd_event_get_fd
</title>
32 <productname>systemd
</productname>
36 <contrib>More text
</contrib>
37 <firstname>Zbigniew
</firstname>
38 <surname>Jędrzejewski-Szmek
</surname>
39 <email>zbyszek@in.waw.pl
</email>
45 <refentrytitle>sd_event_get_fd
</refentrytitle>
46 <manvolnum>3</manvolnum>
50 <refname>sd_event_get_fd
</refname>
52 <refpurpose>Obtain a file descriptor to poll for event loop events
</refpurpose>
57 <funcsynopsisinfo>#include
<systemd/sd-bus.h
></funcsynopsisinfo>
60 <funcdef>int
<function>sd_event_get_fd
</function></funcdef>
61 <paramdef>sd_bus *
<parameter>event
</parameter></paramdef>
68 <title>Description
</title>
70 <para><function>sd_event_get_fd()
</function> returns the file
71 descriptor that the event loop object returned by the
72 <citerefentry><refentrytitle>sd_event_new
</refentrytitle><manvolnum>3</manvolnum></citerefentry>
73 function uses to wait for events. This file descriptor can be
74 polled for events. This makes it possible to embed the
75 <citerefentry><refentrytitle>sd-event
</refentrytitle><manvolnum>3</manvolnum></citerefentry>
76 event loop inside of another event loop.
</para>
80 <title>Return Value
</title>
82 <para>On success,
<function>sd_event_get_fd()
</function> returns a
83 non-negative integer. On failure, it returns a negative
84 errno-style error code.
</para>
90 <para>Returned errors may indicate the following problems:
</para>
94 <term><constant>-EINVAL
</constant></term>
96 <listitem><para><parameter>event
</parameter> is not a valid
97 pointer to an
<structname>sd_event
</structname> structure.
102 <term><constant>-ECHILD
</constant></term>
104 <listitem><para>The event loop has been created in a different process.
</para></listitem>
111 <title>Examples
</title>
114 <title>Integration in glib event loop
</title>
116 <programlisting><xi:include href=
"glib-event-glue.c" parse=
"text" /></programlisting>
123 <para><function>sd_event_get_fd()
</function> is available as a
124 shared library, which can be compiled and linked to with the
125 <constant>libsystemd
</constant> <citerefentry
126 project='die-net'
><refentrytitle>pkg-config
</refentrytitle><manvolnum>1</manvolnum></citerefentry>
131 <title>See Also
</title>
134 <citerefentry><refentrytitle>sd-event
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
135 <citerefentry><refentrytitle>sd_event_new
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
136 <citerefentry><refentrytitle>sd_event_ref
</refentrytitle><manvolnum>3</manvolnum></citerefentry>