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 This file is part of systemd.
10 Copyright 2016 Julian Orth
13 <refentry id="sd_bus_process">
16 <title>sd_bus_process</title>
17 <productname>systemd</productname>
21 <firstname>Julian</firstname>
22 <surname>Orth</surname>
23 <email>ju.orth@gmail.com</email>
29 <refentrytitle>sd_bus_process</refentrytitle>
30 <manvolnum>3</manvolnum>
34 <refname>sd_bus_process</refname>
36 <refpurpose>Drive the connection</refpurpose>
41 <funcsynopsisinfo>#include <systemd/sd-bus.h></funcsynopsisinfo>
44 <funcdef>int <function>sd_bus_process</function></funcdef>
45 <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
46 <paramdef>sd_bus_message **<parameter>r</parameter></paramdef>
52 <title>Description</title>
55 <function>sd_bus_process()</function> drives the connection between the
56 message bus and the client. That is, it handles connecting,
57 authentication, and message processing. It should be called in a loop
58 until no further progress can be made or an error occurs.
62 Once no further progress can be made,
63 <citerefentry><refentrytitle>sd_bus_wait</refentrytitle><manvolnum>3</manvolnum></citerefentry>
64 should be called. Alternatively the user can wait for incoming data on
65 the file descriptor returned by
66 <citerefentry><refentrytitle>sd_bus_get_fd</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
70 <function>sd_bus_process</function> processes at most one incoming
71 message per call. If the parameter <parameter>r</parameter> is not NULL
72 and the call processed a message, <code>*r</code> is set to this message.
73 The caller owns a reference to this message and should call
74 <citerefentry><refentrytitle>sd_bus_message_unref</refentrytitle><manvolnum>3</manvolnum></citerefentry>
75 when the message is no longer needed. If <parameter>r</parameter> is not
76 NULL, progress was made, but no message was processed, <code>*r</code> is
82 <title>Return Value</title>
85 If progress was made, a positive integer is returned. If no progress was
86 made, 0 is returned. If an error occurs, a negative errno-style error code
92 <title>See Also</title>
95 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
96 <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,