mirror of
https://github.com/systemd/systemd.git
synced 2024-11-24 02:33:36 +08:00
man: document all the new APIs we added
This commit is contained in:
parent
51b13863a2
commit
d97eac36d8
@ -105,7 +105,12 @@ manpages = [
|
||||
['sd-journal', '3', [], ''],
|
||||
['sd-login', '3', [], 'HAVE_PAM'],
|
||||
['sd_booted', '3', [], ''],
|
||||
['sd_bus_add_match', '3', [], ''],
|
||||
['sd_bus_add_match',
|
||||
'3',
|
||||
['sd_bus_add_match_async',
|
||||
'sd_bus_match_signal',
|
||||
'sd_bus_match_signal_async'],
|
||||
''],
|
||||
['sd_bus_creds_get_pid',
|
||||
'3',
|
||||
['sd_bus_creds_get_audit_login_uid',
|
||||
@ -181,6 +186,7 @@ manpages = [
|
||||
['SD_BUS_ERROR_END', 'SD_BUS_ERROR_MAP', 'sd_bus_error_map'],
|
||||
''],
|
||||
['sd_bus_get_fd', '3', [], ''],
|
||||
['sd_bus_is_open', '3', ['sd_bus_is_ready'], ''],
|
||||
['sd_bus_message_append', '3', ['sd_bus_message_appendv'], ''],
|
||||
['sd_bus_message_append_array',
|
||||
'3',
|
||||
@ -200,6 +206,7 @@ manpages = [
|
||||
['sd_bus_message_get_realtime_usec', 'sd_bus_message_get_seqnum'],
|
||||
''],
|
||||
['sd_bus_message_read_basic', '3', [], ''],
|
||||
['sd_bus_message_set_destination', '3', ['sd_bus_message_set_sender'], ''],
|
||||
['sd_bus_negotiate_fds',
|
||||
'3',
|
||||
['sd_bus_negotiate_creds', 'sd_bus_negotiate_timestamp'],
|
||||
@ -210,7 +217,15 @@ manpages = [
|
||||
['sd_bus_path_decode', 'sd_bus_path_decode_many', 'sd_bus_path_encode_many'],
|
||||
''],
|
||||
['sd_bus_process', '3', [], ''],
|
||||
['sd_bus_request_name', '3', ['sd_bus_release_name'], ''],
|
||||
['sd_bus_request_name',
|
||||
'3',
|
||||
['sd_bus_release_name',
|
||||
'sd_bus_release_name_async',
|
||||
'sd_bus_request_name_async'],
|
||||
''],
|
||||
['sd_bus_set_connected_signal', '3', ['sd_bus_get_connected_signal'], ''],
|
||||
['sd_bus_set_sender', '3', ['sd_bus_get_sender'], ''],
|
||||
['sd_bus_set_watch_bind', '3', ['sd_bus_get_watch_bind'], ''],
|
||||
['sd_bus_track_add_name',
|
||||
'3',
|
||||
['sd_bus_track_add_sender',
|
||||
@ -655,6 +670,7 @@ manpages = [
|
||||
['systemd', '1', ['init'], ''],
|
||||
['systemd.automount', '5', [], ''],
|
||||
['systemd.device', '5', [], ''],
|
||||
['systemd.dnssd', '5', [], 'ENABLE_RESOLVE'],
|
||||
['systemd.environment-generator', '7', [], 'ENABLE_ENVIRONMENT_D'],
|
||||
['systemd.exec', '5', [], ''],
|
||||
['systemd.generator', '7', [], ''],
|
||||
@ -663,7 +679,6 @@ manpages = [
|
||||
['systemd.link', '5', [], ''],
|
||||
['systemd.mount', '5', [], ''],
|
||||
['systemd.netdev', '5', [], 'ENABLE_NETWORKD'],
|
||||
['systemd.dnssd', '5', [], 'ENABLE_RESOLVE'],
|
||||
['systemd.network', '5', [], 'ENABLE_NETWORKD'],
|
||||
['systemd.nspawn', '5', [], ''],
|
||||
['systemd.offline-updates', '7', [], ''],
|
||||
|
@ -45,14 +45,24 @@
|
||||
|
||||
<refnamediv>
|
||||
<refname>sd_bus_add_match</refname>
|
||||
<refname>sd_bus_add_match_async</refname>
|
||||
<refname>sd_bus_match_signal</refname>
|
||||
<refname>sd_bus_match_signal_async</refname>
|
||||
|
||||
<refpurpose>Add a match rule for message dispatching</refpurpose>
|
||||
<refpurpose>Add a match rule for incoming message dispatching</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<funcsynopsis>
|
||||
<funcsynopsisinfo>#include <systemd/sd-bus.h></funcsynopsisinfo>
|
||||
|
||||
<funcprototype>
|
||||
<funcdef>typedef int (*<function>sd_bus_message_handler_t</function>)</funcdef>
|
||||
<paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
|
||||
<paramdef>void *<parameter>userdata</parameter></paramdef>
|
||||
<paramdef>sd_bus_error *<parameter>ret_error</parameter></paramdef>
|
||||
</funcprototype>
|
||||
|
||||
<funcprototype>
|
||||
<funcdef>int <function>sd_bus_add_match</function></funcdef>
|
||||
<paramdef>sd_bus *<parameter>bus</parameter></paramdef>
|
||||
@ -63,65 +73,122 @@
|
||||
</funcprototype>
|
||||
|
||||
<funcprototype>
|
||||
<funcdef>typedef int (*<function>sd_bus_message_handler_t</function>)</funcdef>
|
||||
<paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
|
||||
<funcdef>int <function>sd_bus_add_match_async</function></funcdef>
|
||||
<paramdef>sd_bus *<parameter>bus</parameter></paramdef>
|
||||
<paramdef>sd_bus_slot **<parameter>slot</parameter></paramdef>
|
||||
<paramdef>const char *<parameter>match</parameter></paramdef>
|
||||
<paramdef>sd_bus_message_handler_t <parameter>callback</parameter></paramdef>
|
||||
<paramdef>sd_bus_message_handler_t <parameter>install_callback</parameter></paramdef>
|
||||
<paramdef>void *<parameter>userdata</parameter></paramdef>
|
||||
<paramdef>sd_bus_error *<parameter>ret_error</parameter></paramdef>
|
||||
</funcprototype>
|
||||
|
||||
<funcprototype>
|
||||
<funcdef>int <function>sd_bus_match_signal</function></funcdef>
|
||||
<paramdef>sd_bus *<parameter>bus</parameter></paramdef>
|
||||
<paramdef>sd_bus_slot **<parameter>slot</parameter></paramdef>
|
||||
<paramdef>const char *<parameter>sender</parameter></paramdef>
|
||||
<paramdef>const char *<parameter>path</parameter></paramdef>
|
||||
<paramdef>const char *<parameter>interface</parameter></paramdef>
|
||||
<paramdef>const char *<parameter>member</parameter></paramdef>
|
||||
<paramdef>sd_bus_message_handler_t <parameter>callback</parameter></paramdef>
|
||||
<paramdef>void *<parameter>userdata</parameter></paramdef>
|
||||
</funcprototype>
|
||||
|
||||
<funcprototype>
|
||||
<funcdef>int <function>sd_bus_match_signal_async</function></funcdef>
|
||||
<paramdef>sd_bus *<parameter>bus</parameter></paramdef>
|
||||
<paramdef>sd_bus_slot **<parameter>slot</parameter></paramdef>
|
||||
<paramdef>const char *<parameter>sender</parameter></paramdef>
|
||||
<paramdef>const char *<parameter>path</parameter></paramdef>
|
||||
<paramdef>const char *<parameter>interface</parameter></paramdef>
|
||||
<paramdef>const char *<parameter>member</parameter></paramdef>
|
||||
<paramdef>sd_bus_message_handler_t <parameter>callback</parameter></paramdef>
|
||||
<paramdef>sd_bus_message_handler_t <parameter>install_callback</parameter></paramdef>
|
||||
<paramdef>void *<parameter>userdata</parameter></paramdef>
|
||||
</funcprototype>
|
||||
|
||||
</funcsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
||||
<para>
|
||||
<function>sd_bus_add_match()</function> installs a match rule for incoming messages received on the specified bus
|
||||
connection object <parameter>bus</parameter>. The syntax of the match rule expression passed in
|
||||
<parameter>match</parameter> is described in the <ulink
|
||||
url="https://dbus.freedesktop.org/doc/dbus-specification.html">D-Bus Specification</ulink>. The specified handler
|
||||
function <parameter>callback</parameter> is called for eaching incoming message matching the specified
|
||||
expression, the <parameter>userdata</parameter> parameter is passed as-is to the callback function.
|
||||
<para><function>sd_bus_add_match()</function> installs a match rule for messages received on the specified bus
|
||||
connection object <parameter>bus</parameter>. The syntax of the match rule expression passed in
|
||||
<parameter>match</parameter> is described in the <ulink
|
||||
url="https://dbus.freedesktop.org/doc/dbus-specification.html">D-Bus Specification</ulink>. The specified handler
|
||||
function <parameter>callback</parameter> is called for eaching incoming message matching the specified expression,
|
||||
the <parameter>userdata</parameter> parameter is passed as-is to the callback function. The match is installed
|
||||
synchronously when connected to a bus broker, i.e. the call sends a control message requested the match to be added
|
||||
to the broker and waits until the broker confirms the match has been installed successfully.</para>
|
||||
|
||||
<para><function>sd_bus_add_match_async()</function> operates very similar to
|
||||
<function>sd_bus_match_signal()</function>, however it installs the match asynchronously, in a non-blocking
|
||||
fashion: a request is sent to the broker, but the call does not wait for a response. The
|
||||
<parameter>install_callback</parameter> function is called when the response is later received, with the response
|
||||
message from the broker as parameter. If this function is specified as <constant>NULL</constant> a default
|
||||
implementation is used that terminates the bus connection should installing the match fail.</para>
|
||||
|
||||
<para><function>sd_bus_match_signal()</function> is very similar to <function>sd_bus_add_match()</function>, but
|
||||
only matches signals, and instead of a match expression accepts four parameters: <parameter>sender</parameter> (the
|
||||
service name of the sender), <parameter>path</parameter> (the object path of the emitting object),
|
||||
<parameter>interface</parameter> (the interface the signal belongs to), <parameter>member</parameter> (the signal
|
||||
name), from which the match string is internally generated. Optionally, these parameters may be specified as
|
||||
<constant>NULL</constant> in which case the relevant field of incoming signals is not tested.</para>
|
||||
|
||||
<para><function>sd_bus_match_signal_async()</function> is combines the signal matching logic of
|
||||
<function>sd_bus_match_signal()</function> with the asynchronous behaviour of
|
||||
<function>sd_bus_add_match_async()</function>.</para>
|
||||
|
||||
<para>On success, and if non-<constant>NULL</constant>, the <parameter>slot</parameter> return parameter will be
|
||||
set to a slot object that may be used as a reference to the installed match, and may be utilized to remove it again
|
||||
at a later time with
|
||||
<citerefentry><refentrytitle>sd_bus_slot_unref</refentrytitle><manvolnum>3</manvolnum></citerefentry>. If specified
|
||||
as <constant>NULL</constant> the lifetime of the match is bound to the lifetime of the bus object itself, and the
|
||||
match cannot be removed independently.</para>
|
||||
|
||||
<para>The message <parameter>m</parameter> passed to the callback is only borrowed, that is, the callback should
|
||||
not call <citerefentry><refentrytitle>sd_bus_message_unref</refentrytitle><manvolnum>3</manvolnum></citerefentry>
|
||||
on it. If the callback wants to hold on to the message beyond the lifetime of the callback, it needs to call
|
||||
<citerefentry><refentrytitle>sd_bus_message_ref</refentrytitle><manvolnum>3</manvolnum></citerefentry> to create a
|
||||
new reference.</para>
|
||||
|
||||
<para>If an error occurs during the callback invocation, the callback should return a negative error number
|
||||
(optionally, a more precise error may be returned in <parameter>ret_error</parameter>, as well). If it wants other
|
||||
callbacks that match the same rule to be called, it should return 0. Otherwise it should return a positive integer.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
On success, and if non-<constant>NULL</constant>, the <parameter>slot</parameter> return parameter will be set to
|
||||
a slot object that may be used as a reference to the installed match, and may be utilized to remove it again at a
|
||||
later time with
|
||||
<citerefentry><refentrytitle>sd_bus_slot_unref</refentrytitle><manvolnum>3</manvolnum></citerefentry>. If
|
||||
specified as <constant>NULL</constant> the lifetime of the match is bound to the lifetime of the bus object itself, and the match
|
||||
cannot be removed independently.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The message <parameter>m</parameter> passed to the callback is only borrowed, that is, the callback should not
|
||||
call <citerefentry><refentrytitle>sd_bus_message_unref</refentrytitle><manvolnum>3</manvolnum></citerefentry> on
|
||||
it. If the callback wants to hold on to the message beyond the lifetime of the callback, it needs to call
|
||||
<citerefentry><refentrytitle>sd_bus_message_ref</refentrytitle><manvolnum>3</manvolnum></citerefentry> to create
|
||||
a new reference.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If an error occurs during the callback invocation, the callback should return a negative error number. If it
|
||||
wants other callbacks that match the same rule to be called, it should return 0. Otherwise it should return a
|
||||
positive integer.
|
||||
</para>
|
||||
<para>If the <parameter>bus</parameter> refers to a direct connection (i.e. not a bus connection, as set with
|
||||
<citerefentry><refentrytitle>sd_bus_set_bus_client</refentrytitle><manvolnum>3</manvolnum></citerefentry>) the
|
||||
match is only installed on the client side, and the synchronous and asynchronous functions operate the same.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Return Value</title>
|
||||
|
||||
<para>
|
||||
On success, <function>sd_bus_add_match()</function> returns 0 or a positive integer. On failure, it returns a
|
||||
negative errno-style error code.
|
||||
On success, <function>sd_bus_add_match()</function> and the other calls return 0 or a positive integer. On
|
||||
failure, they return a negative errno-style error code.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Notes</title>
|
||||
|
||||
<para><function>sd_bus_add_match()</function> and the other functions described here are available as a shared
|
||||
library, which can be compiled and linked to with the <constant>libsystemd</constant> <citerefentry
|
||||
project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry> file.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>See Also</title>
|
||||
|
||||
<para>
|
||||
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>
|
||||
<citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>sd_bus_slot_unref</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>sd_bus_message_ref</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>sd_bus_set_bus_client</refentrytitle><manvolnum>3</manvolnum></citerefentry>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
137
man/sd_bus_is_open.xml
Normal file
137
man/sd_bus_is_open.xml
Normal file
@ -0,0 +1,137 @@
|
||||
<?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
|
||||
|
||||
<!--
|
||||
SPDX-License-Identifier: LGPL-2.1+
|
||||
|
||||
This file is part of systemd.
|
||||
|
||||
Copyright 2017 Lennart Poettering
|
||||
|
||||
systemd is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
systemd is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<refentry id="sd_bus_is_open">
|
||||
|
||||
<refentryinfo>
|
||||
<title>sd_bus_is_open</title>
|
||||
<productname>systemd</productname>
|
||||
|
||||
<authorgroup>
|
||||
<author>
|
||||
<contrib>Developer</contrib>
|
||||
<firstname>Lennart</firstname>
|
||||
<surname>Poettering</surname>
|
||||
<email>lennart@poettering.net</email>
|
||||
</author>
|
||||
</authorgroup>
|
||||
</refentryinfo>
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>sd_bus_is_open</refentrytitle>
|
||||
<manvolnum>3</manvolnum>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>sd_bus_is_open</refname>
|
||||
<refname>sd_bus_is_ready</refname>
|
||||
|
||||
<refpurpose>Check whether the a bus connection is open or ready.</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<funcsynopsis>
|
||||
<funcsynopsisinfo>#include <systemd/sd-bus.h></funcsynopsisinfo>
|
||||
|
||||
<funcprototype>
|
||||
<funcdef>int <function>sd_bus_is_open</function></funcdef>
|
||||
<paramdef>sd_bus *<parameter>bus</parameter></paramdef>
|
||||
</funcprototype>
|
||||
|
||||
<funcprototype>
|
||||
<funcdef>int <function>sd_bus_is_ready</function></funcdef>
|
||||
<paramdef>sd_bus *<parameter>bus</parameter></paramdef>
|
||||
</funcprototype>
|
||||
|
||||
</funcsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
||||
<para><function>sd_bus_is_open()</function> checks whether the specified bus connection is open, i.e. in the
|
||||
process of being established, already established or in the process of being torn down. It returns zero when the
|
||||
connection has not been started yet
|
||||
(i.e. <citerefentry><refentrytitle>sd_bus_start</refentrytitle><manvolnum>3</manvolnum></citerefentry> or some
|
||||
equivalent call has not been invoked yet), or is fully terminated again (for example after
|
||||
<citerefentry><refentrytitle>sd_bus_close</refentrytitle><manvolnum>3</manvolnum></citerefentry>), it returns
|
||||
positive otherwise.</para>
|
||||
|
||||
<para><function>sd_bus_is_ready()</function> checks whether the specified connection is fully established,
|
||||
i.e. completed the connection and authentication phases of the protocol and received the
|
||||
<function>Hello()</function> method call response, and is not in the process of being torn down again. It returns
|
||||
zero outside of this state, and positive otherwise. Effectively, this function returns positive while regular
|
||||
messages can be sent or received on the connection.</para>
|
||||
|
||||
<para>To be notified when the connection is fully established, use
|
||||
<citerefentry><refentrytitle>sd_bus_set_connected_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry> and
|
||||
install a match for the <function>Connected()</function> signal on the
|
||||
<literal>org.freedesktop.DBus.Local</literal> interface. To be notified when the connection is torn down again,
|
||||
install a match for the <function>Disconnected()</function> signal on the
|
||||
<literal>org.freedesktop.DBus.Local</literal> interface.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Return Value</title>
|
||||
|
||||
<para>On success, these functions return 0 or a positive integer. On failure, they return a negative errno-style
|
||||
error code.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Errors</title>
|
||||
|
||||
<para>Returned errors may indicate the following problems:</para>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><constant>-ECHILD</constant></term>
|
||||
|
||||
<listitem><para>The bus connection has been created in a different process.</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Notes</title>
|
||||
|
||||
<para><function>sd_bus_is_open()</function> and <function>sd_bus_is_ready()</function> are available as
|
||||
a shared library, which can be compiled and linked to with the <constant>libsystemd</constant> <citerefentry
|
||||
project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry> file.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>See Also</title>
|
||||
|
||||
<para>
|
||||
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>sd_bus_start</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>sd_bus_close</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>sd_bus_set_connected_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
137
man/sd_bus_message_set_destination.xml
Normal file
137
man/sd_bus_message_set_destination.xml
Normal file
@ -0,0 +1,137 @@
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
|
||||
|
||||
<!--
|
||||
SPDX-License-Identifier: LGPL-2.1+
|
||||
|
||||
This file is part of systemd.
|
||||
|
||||
Copyright 2017 Lennart Poettering
|
||||
|
||||
systemd is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
systemd is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<refentry id="sd_bus_message_set_destination">
|
||||
|
||||
<refentryinfo>
|
||||
<title>sd_bus_message_set_destination</title>
|
||||
<productname>systemd</productname>
|
||||
|
||||
<authorgroup>
|
||||
<author>
|
||||
<contrib>Developer</contrib>
|
||||
<firstname>Lennart</firstname>
|
||||
<surname>Poettering</surname>
|
||||
<email>lennart@poettering.net</email>
|
||||
</author>
|
||||
</authorgroup>
|
||||
</refentryinfo>
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>sd_bus_message_set_destination</refentrytitle>
|
||||
<manvolnum>3</manvolnum>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>sd_bus_message_set_destination</refname>
|
||||
<refname>sd_bus_message_set_sender</refname>
|
||||
<refpurpose>Set the destination or sender service name of a bus message</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<funcsynopsis>
|
||||
<funcsynopsisinfo>#include <systemd/sd-bus.h></funcsynopsisinfo>
|
||||
|
||||
<funcprototype>
|
||||
<funcdef>int <function>sd_bus_message_set_destination</function></funcdef>
|
||||
<paramdef>sd_bus_message *<parameter>message</parameter></paramdef>
|
||||
<paramdef>const char *<parameter>destination</parameter></paramdef>
|
||||
</funcprototype>
|
||||
|
||||
<funcprototype>
|
||||
<funcdef>int <function>sd_bus_message_set_sender</function></funcdef>
|
||||
<paramdef>sd_bus_message *<parameter>message</parameter></paramdef>
|
||||
<paramdef>const char *<parameter>sender</parameter></paramdef>
|
||||
</funcprototype>
|
||||
</funcsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
||||
<para><function>sd_bus_message_set_destination()</function> sets the destination service name for the specified bus
|
||||
message object. The specified name must be a valid unique or well-known service name.</para>
|
||||
|
||||
<para><function>sd_bus_message_set_sender()</function> sets the sender service name for the specified bus message
|
||||
object. The specified name must be a valid unique or well-known service name. This function is useful only for
|
||||
messages to send on direct connections as for connections to bus brokers the broker will fill in the destination
|
||||
field anyway, and the sender field set by original sender is ignored.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Return Value</title>
|
||||
|
||||
<para>On success, these calls return 0 or a positive integer. On failure, these calls return a negative errno-style
|
||||
error code.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Errors</title>
|
||||
|
||||
<para>Returned errors may indicate the following problems:</para>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><constant>-EINVAL</constant></term>
|
||||
|
||||
<listitem><para>A specified parameter is invalid.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><constant>-EPERM</constant></term>
|
||||
|
||||
<listitem><para>The message is already sealed.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><constant>-EEXIST</constant></term>
|
||||
|
||||
<listitem><para>The message already has a destination or sender field set.</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Notes</title>
|
||||
|
||||
<para>The <function>sd_bus_message_set_destination()</function> and
|
||||
<function>sd_bus_message_set_sender()</function> interfaces
|
||||
are available as a shared library, which can be compiled and
|
||||
linked to with the
|
||||
<constant>libsystemd</constant> <citerefentry project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
|
||||
file.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>See Also</title>
|
||||
|
||||
<para>
|
||||
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>sd_bus_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>sd_bus_set_sender</refentrytitle><manvolnum>3</manvolnum></citerefentry>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
@ -46,7 +46,9 @@
|
||||
|
||||
<refnamediv>
|
||||
<refname>sd_bus_request_name</refname>
|
||||
<refname>sd_bus_request_name_async</refname>
|
||||
<refname>sd_bus_release_name</refname>
|
||||
<refname>sd_bus_release_name_async</refname>
|
||||
<refpurpose>Request or release a well-known service name on a bus</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
@ -61,71 +63,103 @@
|
||||
<paramdef>uint64_t <parameter>flags</parameter></paramdef>
|
||||
</funcprototype>
|
||||
|
||||
<funcprototype>
|
||||
<funcdef>int <function>sd_bus_request_name_async</function></funcdef>
|
||||
<paramdef>sd_bus *<parameter>bus</parameter></paramdef>
|
||||
<paramdef>sd_bus_slot **<parameter>slot</parameter></paramdef>
|
||||
<paramdef>const char *<parameter>name</parameter></paramdef>
|
||||
<paramdef>uint64_t <parameter>flags</parameter></paramdef>
|
||||
<paramdef>sd_bus_message_handler_t <parameter>callback</parameter></paramdef>
|
||||
<paramdef>void *<parameter>userdata</parameter></paramdef>
|
||||
</funcprototype>
|
||||
|
||||
<funcprototype>
|
||||
<funcdef>int <function>sd_bus_release_name</function></funcdef>
|
||||
<paramdef>sd_bus *<parameter>bus</parameter></paramdef>
|
||||
<paramdef>const char *<parameter>name</parameter></paramdef>
|
||||
</funcprototype>
|
||||
|
||||
<funcprototype>
|
||||
<funcdef>int <function>sd_bus_release_name_async</function></funcdef>
|
||||
<paramdef>sd_bus *<parameter>bus</parameter></paramdef>
|
||||
<paramdef>sd_bus_slot **<parameter>slot</parameter></paramdef>
|
||||
<paramdef>const char *<parameter>name</parameter></paramdef>
|
||||
<paramdef>sd_bus_message_handler_t <parameter>callback</parameter></paramdef>
|
||||
<paramdef>void *<parameter>userdata</parameter></paramdef>
|
||||
</funcprototype>
|
||||
</funcsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
||||
<para><function>sd_bus_request_name()</function> requests a
|
||||
well-known service name on a bus. It takes a bus connection, a
|
||||
valid bus name and a flags parameter. The flags parameter is a
|
||||
combination of the following flags:</para>
|
||||
<para><function>sd_bus_request_name()</function> requests a well-known service name on a bus. It takes a bus
|
||||
connection, a valid bus name and a flags parameter. The flags parameter is a combination of the following
|
||||
flags:</para>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><varname>SD_BUS_NAME_ALLOW_REPLACEMENT</varname></term>
|
||||
|
||||
<listitem><para>After acquiring the name successfully, permit
|
||||
other peers to take over the name when they try to acquire it
|
||||
with the <varname>SD_BUS_NAME_REPLACE_EXISTING</varname> flag
|
||||
set. If <varname>SD_BUS_NAME_ALLOW_REPLACEMENT</varname> is
|
||||
not set on the original request, such a request by other peers
|
||||
will be denied.</para></listitem>
|
||||
<listitem><para>After acquiring the name successfully, permit other peers to take over the name when they try
|
||||
to acquire it with the <varname>SD_BUS_NAME_REPLACE_EXISTING</varname> flag set. If
|
||||
<varname>SD_BUS_NAME_ALLOW_REPLACEMENT</varname> is not set on the original request, such a request by other
|
||||
peers will be denied.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>SD_BUS_NAME_REPLACE_EXISTING</varname></term>
|
||||
|
||||
<listitem><para>Take over the name if it is already acquired
|
||||
by another peer, and that other peer has permitted takeover by
|
||||
setting <varname>SD_BUS_NAME_ALLOW_REPLACEMENT</varname> while
|
||||
acquiring it.</para></listitem>
|
||||
<listitem><para>Take over the name if it is already acquired by another peer, and that other peer has permitted
|
||||
takeover by setting <varname>SD_BUS_NAME_ALLOW_REPLACEMENT</varname> while acquiring it.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>SD_BUS_NAME_QUEUE</varname></term>
|
||||
|
||||
<listitem><para>Queue the acquisition of the name when the
|
||||
name is already taken.</para></listitem>
|
||||
<listitem><para>Queue the acquisition of the name when the name is already taken.</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
|
||||
<para><function>sd_bus_release_name()</function> releases an
|
||||
acquired well-known name. It takes a bus connection and a valid
|
||||
bus name as parameters.</para>
|
||||
<para><function>sd_bus_request_name()</function> operates in a synchronous fashion: a message requesting the name
|
||||
is sent to the bus broker, and the call waits until the broker responds.</para>
|
||||
|
||||
<para><function>sd_bus_request_name_async()</function> is an asynchronous version of of
|
||||
<function>sd_bus_release_name()</function>. Instead of waiting for the request to complete, the request message is
|
||||
enqueued. The specified <parameter>callback</parameter> will be called when the broker's response is received. If
|
||||
the parameter is specified as <constant>NULL</constant> a default implementation is used instead which will
|
||||
terminate the connection when the name cannot be acquired. The function returns a slot object in its
|
||||
<parameter>slot</parameter> parameter — if it is passed as non-<constant>NULL</constant> — which may be used as a
|
||||
reference to the name request operation. Use
|
||||
<citerefentry><refentrytitle>sd_bus_slot_unref</refentrytitle><manvolnum>3</manvolnum></citerefentry> to destroy
|
||||
this reference. Note that destroying the reference will not unregister the name, but simply ensure the specified
|
||||
callback is no longer called.</para>
|
||||
|
||||
<para><function>sd_bus_release_name()</function> releases an acquired well-known name. It takes a bus connection
|
||||
and a valid bus name as parameters. This function operates synchronously, sending a release request message to the
|
||||
bus broker and waiting for it to reply.</para>
|
||||
|
||||
<para><function>sd_bus_release_name_async()</function> is an asynchronous version of
|
||||
<function>sd_bus_release_name()</function>. The specified <parameter>callback</parameter> function is called when
|
||||
the name has been released successfully. If specified as <constant>NULL</constant> a generic implementation is used
|
||||
that ignores the result of the operation. As above, the <parameter>slot</parameter> (if
|
||||
non-<constant>NULL</constant>) is set to an object that may be used to reference the operation.</para>
|
||||
|
||||
<para>These functions are supported only on bus connections, i.e. connections to a bus broker and not on direct
|
||||
connections.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Return Value</title>
|
||||
|
||||
<para>On success, these calls return 0 or a positive integer. On
|
||||
failure, these calls return a negative errno-style error
|
||||
code.</para>
|
||||
<para>On success, these calls return 0 or a positive integer. On failure, these calls return a negative errno-style
|
||||
error code.</para>
|
||||
|
||||
<para>If <varname>SD_BUS_NAME_QUEUE</varname> is specified,
|
||||
<function>sd_bus_request_name()</function> will return 0 when the
|
||||
name is already taken by another peer and the client has been
|
||||
added to the queue for the name. In that case, the caller can
|
||||
subscribe to <literal>NameOwnerChanged</literal> signals to be
|
||||
notified when the name is successfully acquired.
|
||||
<function>sd_bus_request_name()</function> returns > 0 when the
|
||||
name has immediately been acquired successfully.</para>
|
||||
<para>If <varname>SD_BUS_NAME_QUEUE</varname> is specified, <function>sd_bus_request_name()</function> will return
|
||||
0 when the name is already taken by another peer and the client has been added to the queue for the name. In that
|
||||
case, the caller can subscribe to <literal>NameOwnerChanged</literal> signals to be notified when the name is
|
||||
successfully acquired. <function>sd_bus_request_name()</function> returns > 0 when the name has immediately
|
||||
been acquired successfully.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
@ -137,56 +171,50 @@
|
||||
<varlistentry>
|
||||
<term><constant>-EALREADY</constant></term>
|
||||
|
||||
<listitem><para>The caller already is the owner of the
|
||||
specified name.</para></listitem>
|
||||
<listitem><para>The caller already is the owner of the specified name.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><constant>-EEXIST</constant></term>
|
||||
|
||||
<listitem><para>The name has already been acquired by a
|
||||
different peer, and SD_BUS_NAME_REPLACE_EXISTING was not
|
||||
specified or the other peer did not specify
|
||||
SD_BUS_NAME_ALLOW_REPLACEMENT while acquiring the
|
||||
<listitem><para>The name has already been acquired by a different peer, and SD_BUS_NAME_REPLACE_EXISTING was
|
||||
not specified or the other peer did not specify SD_BUS_NAME_ALLOW_REPLACEMENT while acquiring the
|
||||
name.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><constant>-ESRCH</constant></term>
|
||||
|
||||
<listitem><para>It was attempted to release a name that is
|
||||
currently not registered on the bus.</para></listitem>
|
||||
<listitem><para>It was attempted to release a name that is currently not registered on the
|
||||
bus.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><constant>-EADDRINUSE</constant></term>
|
||||
|
||||
<listitem><para>It was attempted to release a name that is
|
||||
owned by a different peer on the bus.</para></listitem>
|
||||
<listitem><para>It was attempted to release a name that is owned by a different peer on the
|
||||
bus.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><constant>-EINVAL</constant></term>
|
||||
|
||||
<listitem><para>A specified parameter is invalid. This is also
|
||||
generated when the requested name is a special service name
|
||||
reserved by the D-Bus specification, or when the operation is
|
||||
requested on a connection that does not refer to a
|
||||
bus.</para></listitem>
|
||||
<listitem><para>A specified parameter is invalid. This is also generated when the requested name is a special
|
||||
service name reserved by the D-Bus specification, or when the operation is requested on a connection that does
|
||||
not refer to a bus.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><constant>-ENOTCONN</constant></term>
|
||||
|
||||
<listitem><para>The bus connection has been
|
||||
disconnected.</para></listitem>
|
||||
<listitem><para>The bus connection has been disconnected.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><constant>-ECHILD</constant></term>
|
||||
|
||||
<listitem><para>The bus connection has been created in a
|
||||
different process than the current one.</para></listitem>
|
||||
<listitem><para>The bus connection has been created in a different process than the current
|
||||
one.</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
@ -194,12 +222,9 @@
|
||||
<refsect1>
|
||||
<title>Notes</title>
|
||||
|
||||
<para>The <function>sd_bus_acquire_name()</function> and
|
||||
<function>sd_bus_release_name()</function> interfaces are
|
||||
available as a shared library, which can be compiled and linked to
|
||||
with the
|
||||
<constant>libsystemd</constant> <citerefentry project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
|
||||
file.</para>
|
||||
<para>The <function>sd_bus_acquire_name()</function> and the other interfaces described here are available as a
|
||||
shared library, which can be compiled and linked to with the <constant>libsystemd</constant> <citerefentry
|
||||
project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry> file.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
@ -208,7 +233,8 @@
|
||||
<para>
|
||||
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>sd_bus_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>
|
||||
<citerefentry><refentrytitle>sd_bus_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>sd_bus_slot_unref</refentrytitle><manvolnum>3</manvolnum></citerefentry>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
143
man/sd_bus_set_connected_signal.xml
Normal file
143
man/sd_bus_set_connected_signal.xml
Normal file
@ -0,0 +1,143 @@
|
||||
<?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
|
||||
|
||||
<!--
|
||||
SPDX-License-Identifier: LGPL-2.1+
|
||||
|
||||
This file is part of systemd.
|
||||
|
||||
Copyright 2017 Lennart Poettering
|
||||
|
||||
systemd is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
systemd is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<refentry id="sd_bus_set_connected_signal">
|
||||
|
||||
<refentryinfo>
|
||||
<title>sd_bus_set_connected_signal</title>
|
||||
<productname>systemd</productname>
|
||||
|
||||
<authorgroup>
|
||||
<author>
|
||||
<contrib>Developer</contrib>
|
||||
<firstname>Lennart</firstname>
|
||||
<surname>Poettering</surname>
|
||||
<email>lennart@poettering.net</email>
|
||||
</author>
|
||||
</authorgroup>
|
||||
</refentryinfo>
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>sd_bus_set_connected_signal</refentrytitle>
|
||||
<manvolnum>3</manvolnum>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>sd_bus_set_connected_signal</refname>
|
||||
<refname>sd_bus_get_connected_signal</refname>
|
||||
|
||||
<refpurpose>Control emmission of local connection establishment signal on bus connections</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<funcsynopsis>
|
||||
<funcsynopsisinfo>#include <systemd/sd-bus.h></funcsynopsisinfo>
|
||||
|
||||
<funcprototype>
|
||||
<funcdef>int <function>sd_bus_set_connected_signal</function></funcdef>
|
||||
<paramdef>sd_bus *<parameter>bus</parameter></paramdef>
|
||||
<paramdef>int <parameter>b</parameter></paramdef>
|
||||
</funcprototype>
|
||||
|
||||
<funcprototype>
|
||||
<funcdef>int <function>sd_bus_get_connected_signal</function></funcdef>
|
||||
<paramdef>sd_bus *<parameter>bus</parameter></paramdef>
|
||||
</funcprototype>
|
||||
|
||||
</funcsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
||||
<para><function>sd_bus_set_connected_signal()</function> may be used to control whether a local, synthetic
|
||||
<function>Connected()</function> signal message shall be generated and enqueued for dispatching when the connection
|
||||
is fully established. If the <parameter>b</parameter> parameter is zero the message is not generated (the default),
|
||||
otherwise it is generated.</para>
|
||||
|
||||
<para><function>sd_bus_get_connected_signal()</function> may be used to query whether this feature is enabled. It
|
||||
returns zero if not, positive otherwise.</para>
|
||||
|
||||
<para>The <function>Connected()</function> signal message is generated from the
|
||||
<literal>org.freedesktop.DBus.Local</literal> service and interface, and
|
||||
<literal>/org/freedesktop/DBus/Local</literal> object path. Use
|
||||
<citerefentry><refentrytitle>sd_bus_match_signal_async</refentrytitle><manvolnum>3</manvolnum></citerefentry> to
|
||||
match on this signal.</para>
|
||||
|
||||
<para>This message is particularly useful on slow transports where connections take a long time to be
|
||||
established. This is especially the case when
|
||||
<citerefentry><refentrytitle>sd_bus_set_watch_bind</refentrytitle><manvolnum>3</manvolnum></citerefentry> is
|
||||
used. The signal is generated when the
|
||||
<citerefentry><refentrytitle>sd_bus_is_ready</refentrytitle><manvolnum>3</manvolnum></citerefentry> returns
|
||||
positive for the first time.</para>
|
||||
|
||||
<para>The <function>Connected()</function> signal corresponds with the <function>Disconnected()</function> signal
|
||||
that is synthesized locally when the connection is terminated. The latter is generated unconditionally however,
|
||||
unlike the former which needs to be enabled explicitly before it is generated, with
|
||||
<function>sd_bus_set_connected_signal()</function>.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Return Value</title>
|
||||
|
||||
<para>On success, these functions return 0 or a positive integer. On failure, they return a negative errno-style
|
||||
error code.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Errors</title>
|
||||
|
||||
<para>Returned errors may indicate the following problems:</para>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><constant>-ECHILD</constant></term>
|
||||
|
||||
<listitem><para>The bus connection has been created in a different process.</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Notes</title>
|
||||
|
||||
<para><function>sd_bus_set_connected_signal()</function> and <function>sd_bus_get_connected_signal()</function> are available as
|
||||
a shared library, which can be compiled and linked to with the <constant>libsystemd</constant> <citerefentry
|
||||
project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry> file.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>See Also</title>
|
||||
|
||||
<para>
|
||||
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>sd_bus_match_signal_async</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>sd_bus_set_watch_bind</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>sd_bus_is_ready</refentrytitle><manvolnum>3</manvolnum></citerefentry>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
136
man/sd_bus_set_sender.xml
Normal file
136
man/sd_bus_set_sender.xml
Normal file
@ -0,0 +1,136 @@
|
||||
<?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
|
||||
|
||||
<!--
|
||||
SPDX-License-Identifier: LGPL-2.1+
|
||||
|
||||
This file is part of systemd.
|
||||
|
||||
Copyright 2017 Lennart Poettering
|
||||
|
||||
systemd is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
systemd is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<refentry id="sd_bus_set_sender">
|
||||
|
||||
<refentryinfo>
|
||||
<title>sd_bus_set_sender</title>
|
||||
<productname>systemd</productname>
|
||||
|
||||
<authorgroup>
|
||||
<author>
|
||||
<contrib>Developer</contrib>
|
||||
<firstname>Lennart</firstname>
|
||||
<surname>Poettering</surname>
|
||||
<email>lennart@poettering.net</email>
|
||||
</author>
|
||||
</authorgroup>
|
||||
</refentryinfo>
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>sd_bus_set_sender</refentrytitle>
|
||||
<manvolnum>3</manvolnum>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>sd_bus_set_sender</refname>
|
||||
<refname>sd_bus_get_sender</refname>
|
||||
|
||||
<refpurpose>Configure default sender for outgoing messages</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<funcsynopsis>
|
||||
<funcsynopsisinfo>#include <systemd/sd-bus.h></funcsynopsisinfo>
|
||||
|
||||
<funcprototype>
|
||||
<funcdef>int <function>sd_bus_set_sender</function></funcdef>
|
||||
<paramdef>sd_bus *<parameter>bus</parameter></paramdef>
|
||||
<paramdef>const char* <parameter>name</parameter></paramdef>
|
||||
</funcprototype>
|
||||
|
||||
<funcprototype>
|
||||
<funcdef>int <function>sd_bus_get_sender</function></funcdef>
|
||||
<paramdef>sd_bus *<parameter>bus</parameter></paramdef>
|
||||
<paramdef>const char** <parameter>name</parameter></paramdef>
|
||||
</funcprototype>
|
||||
|
||||
</funcsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
||||
<para><function>sd_bus_set_sender()</function> configures the default sender service name to use for outgoing
|
||||
messages. The service name specified in the <parameter>name</parameter> parameter is set on all outgoing messages
|
||||
that are sent on the connection and have no sender set yet, for example through
|
||||
<citerefentry><refentrytitle>sd_bus_message_set_sender</refentrytitle><manvolnum>3</manvolnum></citerefentry>. Note
|
||||
that this function is only supported on direct connections, i.e. not on connections to a bus broker as the broker
|
||||
will fill in the sender service name automatically anyway. By default no sender name is configured, and hence
|
||||
messages are sent without sender field set. If the <parameter>name</parameter> parameter is specified as
|
||||
<constant>NULL</constant> the default sender service name is cleared, returning to the default state if a default
|
||||
sender service name was set before. If passed as non-<constant>NULL</constant> the specified name must be a valid
|
||||
unique or well-known service name.</para>
|
||||
|
||||
<para><function>sd_bus_get_sender()</function> may be used to query the current default service name for outgoing
|
||||
messages.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Return Value</title>
|
||||
|
||||
<para>On success, these functions return 0 or a positive integer. On failure, they return a negative errno-style
|
||||
error code.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Errors</title>
|
||||
|
||||
<para>Returned errors may indicate the following problems:</para>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><constant>-ECHILD</constant></term>
|
||||
|
||||
<listitem><para>The bus connection has been created in a different process.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><constant>-EPERM</constant></term>
|
||||
|
||||
<listitem><para>The specified bus connection object is a not a direct but a brokered connection.</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Notes</title>
|
||||
|
||||
<para><function>sd_bus_set_sender()</function> and <function>sd_bus_get_sender()</function> are available as
|
||||
a shared library, which can be compiled and linked to with the <constant>libsystemd</constant> <citerefentry
|
||||
project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry> file.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>See Also</title>
|
||||
|
||||
<para>
|
||||
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>sd_bus_message_set_sender</refentrytitle><manvolnum>3</manvolnum></citerefentry>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
152
man/sd_bus_set_watch_bind.xml
Normal file
152
man/sd_bus_set_watch_bind.xml
Normal file
@ -0,0 +1,152 @@
|
||||
<?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
|
||||
|
||||
<!--
|
||||
SPDX-License-Identifier: LGPL-2.1+
|
||||
|
||||
This file is part of systemd.
|
||||
|
||||
Copyright 2017 Lennart Poettering
|
||||
|
||||
systemd is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
systemd is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<refentry id="sd_bus_set_watch_bind">
|
||||
|
||||
<refentryinfo>
|
||||
<title>sd_bus_set_watch_bind</title>
|
||||
<productname>systemd</productname>
|
||||
|
||||
<authorgroup>
|
||||
<author>
|
||||
<contrib>Developer</contrib>
|
||||
<firstname>Lennart</firstname>
|
||||
<surname>Poettering</surname>
|
||||
<email>lennart@poettering.net</email>
|
||||
</author>
|
||||
</authorgroup>
|
||||
</refentryinfo>
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>sd_bus_set_watch_bind</refentrytitle>
|
||||
<manvolnum>3</manvolnum>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>sd_bus_set_watch_bind</refname>
|
||||
<refname>sd_bus_get_watch_bind</refname>
|
||||
|
||||
<refpurpose>Control socket binding watching on bus connections</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<funcsynopsis>
|
||||
<funcsynopsisinfo>#include <systemd/sd-bus.h></funcsynopsisinfo>
|
||||
|
||||
<funcprototype>
|
||||
<funcdef>int <function>sd_bus_set_watch_bind</function></funcdef>
|
||||
<paramdef>sd_bus *<parameter>bus</parameter></paramdef>
|
||||
<paramdef>int <parameter>b</parameter></paramdef>
|
||||
</funcprototype>
|
||||
|
||||
<funcprototype>
|
||||
<funcdef>int <function>sd_bus_get_watch_bind</function></funcdef>
|
||||
<paramdef>sd_bus *<parameter>bus</parameter></paramdef>
|
||||
</funcprototype>
|
||||
|
||||
</funcsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
|
||||
<para><function>sd_bus_set_watch_bind()</function> may be used to enable or disable client-side watching of server
|
||||
socket binding for a bus connection object. If the <parameter>b</parameter> is true, the feature is enabled,
|
||||
otherwise disabled (which is the default). When enabled, and the selected bus address refers to an
|
||||
<filename>AF_UNIX</filename> socket in the file system which does not exist while the connection attempt is made an
|
||||
<citerefentry><refentrytitle>inotify</refentrytitle><manvolnum>7</manvolnum></citerefentry> watch is installed on
|
||||
it, waiting for the socket to appear. As soon as the socket appears the connection is made. This functionality is
|
||||
useful in particular in early-boot programs that need to run before the system bus is available, but want to
|
||||
connect to it the instant it may be connected to.</para>
|
||||
|
||||
<para><function>sd_bus_get_watch_bind()</function> may be used to query the current setting of this feature. It
|
||||
returns zero when the feature is disabled, and positive if enabled.</para>
|
||||
|
||||
<para>Note that no timeout is applied while it is waited for the socket to appear. This means that any synchronous
|
||||
remote operation (such as
|
||||
<citerefentry><refentrytitle>sd_bus_call</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>sd_bus_add_match</refentrytitle><manvolnum>3</manvolnum></citerefentry> or
|
||||
<citerefentry><refentrytitle>sd_bus_request_name</refentrytitle><manvolnum>3</manvolnum></citerefentry>), that is
|
||||
used on a connection with this feature enabled that is not established yet might block unbounded if the socket is
|
||||
never created. However, asynchronous remote operations (such as
|
||||
<citerefentry><refentrytitle>sd_bus_send</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>sd_bus_add_match_async</refentrytitle><manvolnum>3</manvolnum></citerefentry> or
|
||||
<citerefentry><refentrytitle>sd_bus_request_match_async</refentrytitle><manvolnum>3</manvolnum></citerefentry>) do
|
||||
not block in this case, and safely enqueue the requested operations to be dispatched the instant the connection is
|
||||
set up.</para>
|
||||
|
||||
<para>Use <citerefentry><refentrytitle>sd_bus_is_ready</refentrytitle><manvolnum>3</manvolnum></citerefentry> to
|
||||
determine whether the connection is fully established, i.e. whether the peer socket has been bound, connected to
|
||||
and authenticated. Use
|
||||
<citerefentry><refentrytitle>sd_bus_set_connected_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry> to
|
||||
be notified when the connection is fully established.</para>
|
||||
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Return Value</title>
|
||||
|
||||
<para>On success, these functions return 0 or a positive integer. On failure, they return a negative errno-style
|
||||
error code.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Errors</title>
|
||||
|
||||
<para>Returned errors may indicate the following problems:</para>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><constant>-ECHILD</constant></term>
|
||||
|
||||
<listitem><para>The bus connection has been created in a different process.</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Notes</title>
|
||||
|
||||
<para><function>sd_bus_set_watch_bind()</function> and <function>sd_bus_get_watch_bind()</function> are available as
|
||||
a shared library, which can be compiled and linked to with the <constant>libsystemd</constant> <citerefentry
|
||||
project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry> file.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>See Also</title>
|
||||
|
||||
<para>
|
||||
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>inotify</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>sd_bus_call</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>sd_bus_add_match</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>sd_bus_request_name</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>sd_bus_is_ready</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
|
||||
<citerefentry><refentrytitle>sd_bus_set_connected_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
Loading…
Reference in New Issue
Block a user