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">
6 SPDX-License-Identifier: LGPL-2.1+
8 Copyright © 2016 Julian Orth
11 <refentry id="sd_bus_process">
14 <title>sd_bus_process</title>
15 <productname>systemd</productname>
19 <firstname>Julian</firstname>
20 <surname>Orth</surname>
21 <email>ju.orth@gmail.com</email>
27 <refentrytitle>sd_bus_process</refentrytitle>
28 <manvolnum>3</manvolnum>
32 <refname>sd_bus_process</refname>
34 <refpurpose>Drive the connection</refpurpose>
39 <funcsynopsisinfo>#include <systemd/sd-bus.h></funcsynopsisinfo>
42 <funcdef>int <function>sd_bus_process</function></funcdef>
43 <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
44 <paramdef>sd_bus_message **<parameter>r</parameter></paramdef>
50 <title>Description</title>
53 <function>sd_bus_process()</function> drives the connection between the
54 message bus and the client. That is, it handles connecting,
55 authentication, and message processing. It should be called in a loop
56 until no further progress can be made or an error occurs.
60 Once no further progress can be made,
61 <citerefentry><refentrytitle>sd_bus_wait</refentrytitle><manvolnum>3</manvolnum></citerefentry>
62 should be called. Alternatively the user can wait for incoming data on
63 the file descriptor returned by
64 <citerefentry><refentrytitle>sd_bus_get_fd</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
68 <function>sd_bus_process</function> processes at most one incoming
69 message per call. If the parameter <parameter>r</parameter> is not NULL
70 and the call processed a message, <code>*r</code> is set to this message.
71 The caller owns a reference to this message and should call
72 <citerefentry><refentrytitle>sd_bus_message_unref</refentrytitle><manvolnum>3</manvolnum></citerefentry>
73 when the message is no longer needed. If <parameter>r</parameter> is not
74 NULL, progress was made, but no message was processed, <code>*r</code> is
80 <title>Return Value</title>
83 If progress was made, a positive integer is returned. If no progress was
84 made, 0 is returned. If an error occurs, a negative errno-style error code
90 <title>See Also</title>
93 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
94 <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,