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 <refentrytitle>sd_bus_process</refentrytitle>
20 <manvolnum>3</manvolnum>
24 <refname>sd_bus_process</refname>
26 <refpurpose>Drive the connection</refpurpose>
31 <funcsynopsisinfo>#include <systemd/sd-bus.h></funcsynopsisinfo>
34 <funcdef>int <function>sd_bus_process</function></funcdef>
35 <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
36 <paramdef>sd_bus_message **<parameter>r</parameter></paramdef>
42 <title>Description</title>
45 <function>sd_bus_process()</function> drives the connection between the
46 message bus and the client. That is, it handles connecting,
47 authentication, and message processing. It should be called in a loop
48 until no further progress can be made or an error occurs.
52 Once no further progress can be made,
53 <citerefentry><refentrytitle>sd_bus_wait</refentrytitle><manvolnum>3</manvolnum></citerefentry>
54 should be called. Alternatively the user can wait for incoming data on
55 the file descriptor returned by
56 <citerefentry><refentrytitle>sd_bus_get_fd</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
60 <function>sd_bus_process</function> processes at most one incoming
61 message per call. If the parameter <parameter>r</parameter> is not NULL
62 and the call processed a message, <code>*r</code> is set to this message.
63 The caller owns a reference to this message and should call
64 <citerefentry><refentrytitle>sd_bus_message_unref</refentrytitle><manvolnum>3</manvolnum></citerefentry>
65 when the message is no longer needed. If <parameter>r</parameter> is not
66 NULL, progress was made, but no message was processed, <code>*r</code> is
72 <title>Return Value</title>
75 If progress was made, a positive integer is returned. If no progress was
76 made, 0 is returned. If an error occurs, a negative errno-style error code
82 <title>See Also</title>
85 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
86 <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,