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