1<?xml version='1.0'?>
2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3  "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
5
6<refentry id="sd_bus_enqueue_for_read"
7          xmlns:xi="http://www.w3.org/2001/XInclude">
8
9  <refentryinfo>
10    <title>sd_bus_enqueue_for_read</title>
11    <productname>systemd</productname>
12  </refentryinfo>
13
14  <refmeta>
15    <refentrytitle>sd_bus_enqueue_for_read</refentrytitle>
16    <manvolnum>3</manvolnum>
17  </refmeta>
18
19  <refnamediv>
20    <refname>sd_bus_enqueue_for_read</refname>
21
22    <refpurpose>Re-enqueue a bus message on a bus connection, for reading</refpurpose>
23  </refnamediv>
24
25  <refsynopsisdiv>
26    <funcsynopsis>
27      <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
28
29      <funcprototype>
30        <funcdef>int <function>sd_bus_enqueue_for_read</function></funcdef>
31        <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
32        <paramdef>sd_bus_message *<parameter>message</parameter></paramdef>
33      </funcprototype>
34
35    </funcsynopsis>
36  </refsynopsisdiv>
37
38  <refsect1>
39    <title>Description</title>
40
41    <para><function>sd_bus_enqueue_for_read()</function> may be used to re-enqueue an incoming bus message on
42    the local read queue, so that it is processed and dispatched locally again, similar to how an incoming
43    message from the peer is processed. Takes a bus connection object and the message to enqueue. A reference
44    is taken of the message and the caller's reference thus remains in possession of the caller. The message
45    is enqueued at the end of the queue, thus will be dispatched after all other already queued messages are
46    dispatched.</para>
47
48    <para>This call is primarily useful for dealing with incoming method calls that may be processed only
49    after an additional asynchronous operation completes. One example are PolicyKit authorization requests
50    that are determined to be necessary to authorize a newly incoming method call: when the PolicyKit response
51    is received the original method call may be re-enqueued to process it again, this time with the
52    authorization result known.</para>
53  </refsect1>
54
55  <refsect1>
56    <title>Return Value</title>
57
58    <para>On success, this function return 0 or a positive integer. On failure, it returns a negative errno-style
59    error code.</para>
60
61    <refsect2>
62      <title>Errors</title>
63
64      <para>Returned errors may indicate the following problems:</para>
65
66      <variablelist>
67        <varlistentry>
68          <term><constant>-ECHILD</constant></term>
69
70          <listitem><para>The bus connection has been created in a different process.</para></listitem>
71        </varlistentry>
72      </variablelist>
73    </refsect2>
74  </refsect1>
75
76  <xi:include href="libsystemd-pkgconfig.xml" />
77
78  <refsect1>
79    <title>See Also</title>
80
81    <para>
82      <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
83      <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
84      <citerefentry><refentrytitle>sd_bus_send</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
85    </para>
86  </refsect1>
87
88</refentry>
89