3802a3d3d7af51ddff31943d5514382f01265770Lennart Poettering<?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
12b42c76672a66c2d4ea7212c14f8f1b5a62b78dTom Gundersen"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
5de0ccffcc4a5a946102a14e0b0e681d964e3225Zbigniew Jędrzejewski-Szmek This file is part of systemd.
5de0ccffcc4a5a946102a14e0b0e681d964e3225Zbigniew Jędrzejewski-Szmek Copyright 2014 Zbigniew Jędrzejewski-Szmek
5de0ccffcc4a5a946102a14e0b0e681d964e3225Zbigniew Jędrzejewski-Szmek systemd is free software; you can redistribute it and/or modify it
5de0ccffcc4a5a946102a14e0b0e681d964e3225Zbigniew Jędrzejewski-Szmek under the terms of the GNU Lesser General Public License as published by
5de0ccffcc4a5a946102a14e0b0e681d964e3225Zbigniew Jędrzejewski-Szmek the Free Software Foundation; either version 2.1 of the License, or
5de0ccffcc4a5a946102a14e0b0e681d964e3225Zbigniew Jędrzejewski-Szmek (at your option) any later version.
5de0ccffcc4a5a946102a14e0b0e681d964e3225Zbigniew Jędrzejewski-Szmek systemd is distributed in the hope that it will be useful, but
5de0ccffcc4a5a946102a14e0b0e681d964e3225Zbigniew Jędrzejewski-Szmek WITHOUT ANY WARRANTY; without even the implied warranty of
5de0ccffcc4a5a946102a14e0b0e681d964e3225Zbigniew Jędrzejewski-Szmek MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5de0ccffcc4a5a946102a14e0b0e681d964e3225Zbigniew Jędrzejewski-Szmek Lesser General Public License for more details.
5de0ccffcc4a5a946102a14e0b0e681d964e3225Zbigniew Jędrzejewski-Szmek You should have received a copy of the GNU Lesser General Public License
5de0ccffcc4a5a946102a14e0b0e681d964e3225Zbigniew Jędrzejewski-Szmek along with systemd; If not, see <http://www.gnu.org/licenses/>.
dc83f27a7cf03757dec11a69ec18504ad4ea8f89Lennart Poettering<refentry id="sd_event_get_fd" xmlns:xi="http://www.w3.org/2001/XInclude">
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek <productname>systemd</productname>
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek <surname>Jędrzejewski-Szmek</surname>
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek <email>zbyszek@in.waw.pl</email>
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek <refentrytitle>sd_event_get_fd</refentrytitle>
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek <refname>sd_event_get_fd</refname>
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek <refpurpose>Obtain a file descriptor to poll for event loop events</refpurpose>
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek <refsynopsisdiv>
dc83f27a7cf03757dec11a69ec18504ad4ea8f89Lennart Poettering <funcsynopsisinfo>#include <systemd/sd-event.h></funcsynopsisinfo>
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek <funcdef>int <function>sd_event_get_fd</function></funcdef>
dc83f27a7cf03757dec11a69ec18504ad4ea8f89Lennart Poettering <paramdef>sd_event *<parameter>event</parameter></paramdef>
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek </funcprototype>
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek </refsynopsisdiv>
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek <para><function>sd_event_get_fd()</function> returns the file
dc83f27a7cf03757dec11a69ec18504ad4ea8f89Lennart Poettering descriptor that an event loop object returned by the
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek <citerefentry><refentrytitle>sd_event_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>
dc83f27a7cf03757dec11a69ec18504ad4ea8f89Lennart Poettering function uses to wait for events. This file descriptor may itself
dc83f27a7cf03757dec11a69ec18504ad4ea8f89Lennart Poettering <constant>POLLIN</constant>/<constant>EPOLLIN</constant>
dc83f27a7cf03757dec11a69ec18504ad4ea8f89Lennart Poettering events. This makes it possible to embed an
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek <citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry>
dc83f27a7cf03757dec11a69ec18504ad4ea8f89Lennart Poettering event loop into another, possibly foreign, event loop.</para>
dc83f27a7cf03757dec11a69ec18504ad4ea8f89Lennart Poettering <para>The returned file descriptor refers to an <citerefentry
dc83f27a7cf03757dec11a69ec18504ad4ea8f89Lennart Poettering project='man-pages'><refentrytitle>epoll</refentrytitle><manvolnum>7</manvolnum></citerefentry>
dc83f27a7cf03757dec11a69ec18504ad4ea8f89Lennart Poettering object. It is recommended not to alter it by invoking
dc83f27a7cf03757dec11a69ec18504ad4ea8f89Lennart Poettering project='man-pages'><refentrytitle>epoll_ctl</refentrytitle><manvolnum>2</manvolnum></citerefentry>
dc83f27a7cf03757dec11a69ec18504ad4ea8f89Lennart Poettering on it, in order to avoid interference with the event loop's inner
dc83f27a7cf03757dec11a69ec18504ad4ea8f89Lennart Poettering logic and assumptions.</para>
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek <para>On success, <function>sd_event_get_fd()</function> returns a
dc83f27a7cf03757dec11a69ec18504ad4ea8f89Lennart Poettering non-negative file descriptor. On failure, it returns a negative
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek errno-style error code.</para>
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek <para>Returned errors may indicate the following problems:</para>
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek <term><constant>-EINVAL</constant></term>
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek <listitem><para><parameter>event</parameter> is not a valid
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek pointer to an <structname>sd_event</structname> structure.
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek <term><constant>-ECHILD</constant></term>
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek <listitem><para>The event loop has been created in a different process.</para></listitem>
dc83f27a7cf03757dec11a69ec18504ad4ea8f89Lennart Poettering <title>Integration in the GLib event loop</title>
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek <programlisting><xi:include href="glib-event-glue.c" parse="text" /></programlisting>
dc83f27a7cf03757dec11a69ec18504ad4ea8f89Lennart Poettering <xi:include href="libsystemd-pkgconfig.xml" />
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek <citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek <citerefentry><refentrytitle>sd_event_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
dc83f27a7cf03757dec11a69ec18504ad4ea8f89Lennart Poettering <citerefentry><refentrytitle>sd_event_wait</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
dc83f27a7cf03757dec11a69ec18504ad4ea8f89Lennart Poettering <citerefentry project='man-pages'><refentrytitle>epoll_ctl</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
dc83f27a7cf03757dec11a69ec18504ad4ea8f89Lennart Poettering <citerefentry project='man-pages'><refentrytitle>epoll</refentrytitle><manvolnum>7</manvolnum></citerefentry>