sd_event_get_fd.xml revision 3802a3d3d7af51ddff31943d5514382f01265770
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"
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-SzmekThis file is part of systemd.
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-SzmekCopyright 2014 Zbigniew Jędrzejewski-Szmek
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmeksystemd is free software; you can redistribute it and/or modify it
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmekunder the terms of the GNU Lesser General Public License as published by
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmekthe Free Software Foundation; either version 2.1 of the License, or
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek(at your option) any later version.
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmeksystemd is distributed in the hope that it will be useful, but
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-SzmekWITHOUT ANY WARRANTY; without even the implied warranty of
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-SzmekMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-SzmekLesser General Public License for more details.
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-SzmekYou should have received a copy of the GNU Lesser General Public License
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmekalong with systemd; If not, see <http://www.gnu.org/licenses/>.
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek<refentry id="sd_event_get_fd" conditional="ENABLE_KDBUS"
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek 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>
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek <funcsynopsisinfo>#include <systemd/sd-bus.h></funcsynopsisinfo>
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek <funcdef>int <function>sd_event_get_fd</function></funcdef>
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek <paramdef>sd_bus *<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
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek descriptor that the event loop object returned by the
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek <citerefentry><refentrytitle>sd_event_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek function uses to wait for events. This file descriptor can be
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek polled for events. This makes it possible to embed the
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek <citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry>
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek event loop inside of another event loop.</para>
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek <para>On success, <function>sd_event_get_fd()</function> returns a
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek non-negative integer. 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>
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek <title>Integration in glib event loop</title>
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek <programlisting><xi:include href="glib-event-glue.c" parse="text" /></programlisting>
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek <para><function>sd_event_get_fd()</function> is available as a
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek shared library, which can be compiled and linked to with the
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek <constant>libsystemd</constant> <citerefentry
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
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>,
ba4b35669ef233fef414b1429fbdc085537b33e7Zbigniew Jędrzejewski-Szmek <citerefentry><refentrytitle>sd_event_ref</refentrytitle><manvolnum>3</manvolnum></citerefentry>