man-pages/man3/sd_bus_process.3.html
2021-03-31 01:06:50 +01:00

179 lines
4.6 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of SD_BUS_PROCESS</TITLE>
</HEAD><BODY>
<H1>SD_BUS_PROCESS</H1>
Section: sd_bus_process (3)<BR>Updated: <BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
sd_bus_process - Drive the connection
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<P>
<B>
</B><PRE>
#include &lt;<A HREF="file:///usr/include/systemd/sd-bus.h">systemd/sd-bus.h</A>&gt;
</PRE>
<DL COMPACT>
<DT id="1">
<B>int sd_bus_process(sd_bus&nbsp;*</B><I>bus</I><B>, sd_bus_message&nbsp;**</B><I>ret</I><B>);</B>
</DL>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<P>
<B>sd_bus_process()</B>
<DD>drives the connection between the client and the message bus. That is, it handles connecting, authentication, and message processing. When invoked pending I/O work is executed, and queued incoming messages are dispatched to registered callbacks. Each time it is invoked a single operation is executed. It returns zero when no operations were pending and positive if a message was processed. When zero is returned the caller should synchronously poll for I/O events before calling into
<B>sd_bus_process()</B>
again. For that either user the simple, synchronous
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_wait">sd_bus_wait</A></B>(3)
call, or hook up the bus connection object to an external or manual event loop using
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_get_fd">sd_bus_get_fd</A></B>(3).
<P>
<B>sd_bus_process()</B>
processes at most one incoming message per call. If the parameter
<I>ret</I>
is not
<B>NULL</B>
and the call processed a message,
<I>*ret</I>
is set to this message. The caller owns a reference to this message and should call
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_message_unref">sd_bus_message_unref</A></B>(3)
when the message is no longer needed. If
<I>ret</I>
is not NULL, progress was made, but no message was processed,
<I>*ret</I>
is set to
<B>NULL</B>.
<P>
If a the bus object is connected to an
<B><A HREF="/cgi-bin/man/man2html?3+sd-event">sd-event</A></B>(3)
event loop (with
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_attach_event">sd_bus_attach_event</A></B>(3)), it is not necessary to call
<B>sd_bus_process()</B>
directly as it is invoked automatically when necessary.
<A NAME="lbAE">&nbsp;</A>
<H2>RETURN VALUE</H2>
<P>
If progress was made, a positive integer is returned. If no progress was made, 0 is returned. If an error occurs, a negative
<I>errno</I>-style error code is returned.
<A NAME="lbAF">&nbsp;</A>
<H3>Errors</H3>
<P>
Returned errors may indicate the following problems:
<P>
<B>-EINVAL</B>
<DL COMPACT><DT id="2"><DD>
An invalid bus object was passed.
</DL>
<P>
<B>-ECHILD</B>
<DL COMPACT><DT id="3"><DD>
The bus connection was allocated in a parent process and is being reused in a child process after
<B>fork()</B>.
</DL>
<P>
<B>-ENOTCONN</B>
<DL COMPACT><DT id="4"><DD>
The bus connection has been terminated already.
</DL>
<P>
<B>-ECONNRESET</B>
<DL COMPACT><DT id="5"><DD>
The bus connection has been terminated just now.
</DL>
<P>
<B>-EBUSY</B>
<DL COMPACT><DT id="6"><DD>
This function is already being called, i.e.
<B>sd_bus_process()</B>
has been called from a callback function that itself was called by
<B>sd_bus_process()</B>.
</DL>
<A NAME="lbAG">&nbsp;</A>
<H2>NOTES</H2>
<P>
These APIs are implemented as a shared library, which can be compiled and linked to with the
<B>libsystemd</B>&nbsp;<B><A HREF="/cgi-bin/man/man2html?1+pkg-config">pkg-config</A></B>(1)
file.
<A NAME="lbAH">&nbsp;</A>
<H2>SEE ALSO</H2>
<P>
<B><A HREF="/cgi-bin/man/man2html?1+systemd">systemd</A></B>(1),
<B><A HREF="/cgi-bin/man/man2html?3+sd-bus">sd-bus</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_wait">sd_bus_wait</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_get_fd">sd_bus_get_fd</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_message_unref">sd_bus_message_unref</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+sd-event">sd-event</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_attach_event">sd_bus_attach_event</A></B>(3)
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="7"><A HREF="#lbAB">NAME</A><DD>
<DT id="8"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="9"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="10"><A HREF="#lbAE">RETURN VALUE</A><DD>
<DL>
<DT id="11"><A HREF="#lbAF">Errors</A><DD>
</DL>
<DT id="12"><A HREF="#lbAG">NOTES</A><DD>
<DT id="13"><A HREF="#lbAH">SEE ALSO</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:55 GMT, March 31, 2021
</BODY>
</HTML>