summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-04-21 09:23:16 +0200
committerGitHub <noreply@github.com>2020-04-21 09:23:16 +0200
commit55c0fbde8ffcc7c531fed90f9f8c9b3f4ff9a19c (patch)
treeb982057c7ca0b73f6b9072406227f335dfc2d2f4
parent309b7d41f22e4ea58ebc584bbda2e819e2367388 (diff)
parent23139f89dc0ab115fb1e423f0d64c5a5f04eee41 (diff)
downloadsystemd-55c0fbde8ffcc7c531fed90f9f8c9b3f4ff9a19c.tar.gz
Merge pull request #15502 from DaanDeMeyer/sd-bus-exit-on-disconnect-docs
sd-bus: Add sd_bus_get/set_exit_on_disconnect docs
-rw-r--r--man/rules/meson.build1
-rw-r--r--man/sd-bus.xml6
-rw-r--r--man/sd_bus_set_close_on_exit.xml48
-rw-r--r--man/sd_bus_set_exit_on_disconnect.xml114
-rw-r--r--man/sd_bus_set_server.xml3
5 files changed, 148 insertions, 24 deletions
diff --git a/man/rules/meson.build b/man/rules/meson.build
index 659edab1ab..7b5b13b176 100644
--- a/man/rules/meson.build
+++ b/man/rules/meson.build
@@ -388,6 +388,7 @@ manpages = [
'sd_bus_set_anonymous',
'sd_bus_set_trusted'],
''],
+ ['sd_bus_set_exit_on_disconnect', '3', ['sd_bus_get_exit_on_disconnect'], ''],
['sd_bus_set_method_call_timeout',
'3',
['sd_bus_get_method_call_timeout'],
diff --git a/man/sd-bus.xml b/man/sd-bus.xml
index c073d3bccc..9918e0c737 100644
--- a/man/sd-bus.xml
+++ b/man/sd-bus.xml
@@ -77,6 +77,7 @@
<citerefentry><refentrytitle>sd_bus_get_current_message</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_get_current_slot</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_get_current_userdata</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+<citerefentry><refentrytitle>sd_bus_get_exit_on_disconnect</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_get_fd</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_get_method_call_timeout</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_get_n_queued_read</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
@@ -124,16 +125,17 @@
<citerefentry><refentrytitle>sd_bus_request_name</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_send</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_address</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+<citerefentry><refentrytitle>sd_bus_set_bus_client</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+<citerefentry><refentrytitle>sd_bus_set_close_on_exit</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_connected_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_description</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+<citerefentry><refentrytitle>sd_bus_set_exit_on_disconnect</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_method_call_timeout</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_property</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_propertyv</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_sender</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
-<citerefentry><refentrytitle>sd_bus_set_bus_client</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_server</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_set_watch_bind</refentrytitle><manvolnum>3</manvolnum></citerefentry>
-<citerefentry><refentrytitle>sd_bus_set_close_on_exit</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_slot_get_current_handler</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_slot_get_current_message</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_bus_slot_get_current_userdata</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
diff --git a/man/sd_bus_set_close_on_exit.xml b/man/sd_bus_set_close_on_exit.xml
index 751fc0a729..64ca356443 100644
--- a/man/sd_bus_set_close_on_exit.xml
+++ b/man/sd_bus_set_close_on_exit.xml
@@ -20,7 +20,8 @@
<refname>sd_bus_set_close_on_exit</refname>
<refname>sd_bus_get_close_on_exit</refname>
- <refpurpose>Control whether to close the bus connection during the event loop exit phase</refpurpose>
+ <refpurpose>Control whether to close the bus connection during the event loop exit phase
+ </refpurpose>
</refnamediv>
<refsynopsisdiv>
@@ -44,30 +45,35 @@
<refsect1>
<title>Description</title>
- <para><function>sd_bus_set_close_on_exit()</function> may be used to enable or disable whether the bus connection
- is automatically flushed (as in
- <citerefentry><refentrytitle>sd_bus_flush</refentrytitle><manvolnum>3</manvolnum></citerefentry>) and closed (as in
- <citerefentry><refentrytitle>sd_bus_close</refentrytitle><manvolnum>3</manvolnum></citerefentry>) during the exit
- phase of the event loop. This logic only applies to bus connections that are attached to an
- <citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry> event loop, see
- <citerefentry><refentrytitle>sd_bus_attach_event</refentrytitle><manvolnum>3</manvolnum></citerefentry>. By default
- this mechanism is enabled and makes sure that any pending messages that have not been written to the bus connection
- are written out when the event loop is shutting down. In some cases this behaviour is not desirable, for example
- when the bus connection shall remain usable until after the event loop exited. If <parameter>b</parameter> is
- true, the feature is enabled (which is the default), otherwise disabled.</para>
-
- <para><function>sd_bus_get_close_on_exit()</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><function>sd_bus_set_close_on_exit()</function> may be used to enable or disable whether
+ the bus connection is automatically flushed (as in
+ <citerefentry><refentrytitle>sd_bus_flush</refentrytitle><manvolnum>3</manvolnum></citerefentry>)
+ and closed (as in
+ <citerefentry><refentrytitle>sd_bus_close</refentrytitle><manvolnum>3</manvolnum></citerefentry>)
+ during the exit phase of the event loop. This logic only applies to bus connections that are
+ attached to an
+ <citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry>
+ event loop, see
+ <citerefentry><refentrytitle>sd_bus_attach_event</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
+ By default this mechanism is enabled and makes sure that any pending messages that have not been
+ written to the bus connection are written out when the event loop is shutting down. In some
+ cases this behaviour is not desirable, for example when the bus connection shall remain usable
+ until after the event loop exited. If <parameter>b</parameter> is true, the feature is enabled
+ (which is the default), otherwise disabled.</para>
+
+ <para><function>sd_bus_get_close_on_exit()</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>
</refsect1>
<refsect1>
<title>Return Value</title>
- <para>On success, <function>sd_bus_set_close_on_exit()</function> returns 0 or a positive integer. On failure, it returns a negative errno-style
- error code.</para>
+ <para>On success, <function>sd_bus_set_close_on_exit()</function> returns a non-negative
+ integer. On failure, it returns a negative errno-style error code.</para>
- <para><function>sd_bus_get_close_on_exit()</function> returns 0 if the feature is currently turned off or a
- positive integer if it is on. On failure, it returns a negative errno-style error code.</para>
+ <para><function>sd_bus_get_close_on_exit()</function> returns 0 if the feature is currently
+ disabled or a positive integer if it is enabled. On failure, it returns a negative errno-style
+ error code.</para>
<refsect2>
<title>Errors</title>
@@ -78,7 +84,8 @@
<varlistentry>
<term><constant>-ECHILD</constant></term>
- <listitem><para>The bus connection has been created in a different process.</para></listitem>
+ <listitem><para>The bus connection was created in a different process.</para>
+ </listitem>
</varlistentry>
</variablelist>
</refsect2>
@@ -98,5 +105,4 @@
<citerefentry><refentrytitle>sd_event_add_exit</refentrytitle><manvolnum>3</manvolnum></citerefentry>
</para>
</refsect1>
-
</refentry>
diff --git a/man/sd_bus_set_exit_on_disconnect.xml b/man/sd_bus_set_exit_on_disconnect.xml
new file mode 100644
index 0000000000..8bd904ba40
--- /dev/null
+++ b/man/sd_bus_set_exit_on_disconnect.xml
@@ -0,0 +1,114 @@
+<?xml version='1.0'?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+<!-- SPDX-License-Identifier: LGPL-2.1+ -->
+
+<refentry id="sd_bus_set_exit_on_disconnect"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
+
+ <refentryinfo>
+ <title>sd_bus_set_exit_on_disconnect</title>
+ <productname>systemd</productname>
+ </refentryinfo>
+
+ <refmeta>
+ <refentrytitle>sd_bus_set_exit_on_disconnect</refentrytitle>
+ <manvolnum>3</manvolnum>
+ </refmeta>
+
+ <refnamediv>
+ <refname>sd_bus_set_exit_on_disconnect</refname>
+ <refname>sd_bus_get_exit_on_disconnect</refname>
+
+ <refpurpose>Control the exit behavior when the bus object disconnects</refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <funcsynopsis>
+ <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
+
+ <funcprototype>
+ <funcdef>int <function>sd_bus_set_exit_on_disconnect</function></funcdef>
+ <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
+ <paramdef>int <parameter>b</parameter></paramdef>
+ </funcprototype>
+
+ <funcprototype>
+ <funcdef>int <function>sd_bus_get_exit_on_disconnect</function></funcdef>
+ <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ </refsynopsisdiv>
+
+ <refsect1>
+ <title>Description</title>
+
+ <para><function>sd_bus_set_exit_on_disconnect()</function> may be used to configure the exit
+ behavior when the given bus object disconnects. If <parameter>b</parameter> is zero, no special
+ logic is executed when the bus object disconnects. If <parameter>b</parameter> is non-zero, the
+ behavior on disconnect depends on whether the bus object is attached to an event loop or not. If
+ the bus object is attached to an event loop (see
+ <citerefentry><refentrytitle>sd_bus_attach_event</refentrytitle><manvolnum>3</manvolnum></citerefentry>),
+ the event loop is closed when the bus object disconnects (as if calling
+ <citerefentry><refentrytitle>sd_event_exit</refentrytitle><manvolnum>3</manvolnum></citerefentry>).
+ Otherwise,
+ <citerefentry project='man-pages'><refentrytitle>exit</refentrytitle><manvolnum>3</manvolnum></citerefentry>
+ is called. The exit code passed to <function>sd_event_exit()</function> and
+ <function>exit()</function> is <constant>EXIT_FAILURE</constant>. If the bus object has already
+ disconnected when enabling the exit behavior, the exit behavior is executed immediately. By
+ default, the exit behavior is disabled.</para>
+
+ <para><function>sd_bus_get_exit_on_disconnect()</function> returns whether the exit on
+ disconnect behavior is enabled for the given bus object.</para>
+ </refsect1>
+
+ <refsect1>
+ <title>Return Value</title>
+
+ <para>On success, <function>sd_bus_set_exit_on_disconnect()</function> returns a non-negative
+ integer. On failure, it returns a negative errno-style error code.</para>
+
+ <para><function>sd_bus_get_exit_on_disconnect()</function> returns a positive integer if the
+ exit on disconnect behavior is enabled. Otherwise, it returns zero.</para>
+
+ <refsect2>
+ <title>Errors</title>
+
+ <para>Returned errors may indicate the following problems:</para>
+
+ <variablelist>
+ <varlistentry>
+ <term><constant>-EINVAL</constant></term>
+
+ <listitem><para>A required parameter was <constant>NULL</constant>.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><constant>-ENOPKG</constant></term>
+
+ <listitem><para>The bus object could not be resolved.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><constant>-ECHILD</constant></term>
+
+ <listitem><para>The bus connection was created in a different process.</para></listitem>
+ </varlistentry>
+ </variablelist>
+ </refsect2>
+ </refsect1>
+
+ <xi:include href="libsystemd-pkgconfig.xml" />
+
+ <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_attach_event</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>sd_event_exit</refentrytitle><manvolnum>3</manvolnum></citerefentry>
+ </para>
+ </refsect1>
+</refentry>
diff --git a/man/sd_bus_set_server.xml b/man/sd_bus_set_server.xml
index 228dc806e4..6b93b92594 100644
--- a/man/sd_bus_set_server.xml
+++ b/man/sd_bus_set_server.xml
@@ -110,7 +110,8 @@
a non-negative integer. On failure, they return a negative errno-style error code.</para>
<para><function>sd_bus_is_server()</function> and <function>sd_bus_is_bus_client()</function>
- return 1 when the server or client mode is enabled, respectively. Otherwise, they return 0.
+ return a positive integer when the server or client mode is enabled, respectively. Otherwise,
+ they return zero.
</para>
<refsect2>