sd-bus: Rewrap sd_bus_set_close_on_exit + small fixes

This commit is contained in:
Daan De Meyer 2020-04-20 19:57:25 +02:00
parent 37409a1c68
commit 23139f89dc
2 changed files with 41 additions and 23 deletions

View File

@ -20,7 +20,8 @@
<refname>sd_bus_set_close_on_exit</refname> <refname>sd_bus_set_close_on_exit</refname>
<refname>sd_bus_get_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> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
@ -44,30 +45,35 @@
<refsect1> <refsect1>
<title>Description</title> <title>Description</title>
<para><function>sd_bus_set_close_on_exit()</function> may be used to enable or disable whether the bus connection <para><function>sd_bus_set_close_on_exit()</function> may be used to enable or disable whether
is automatically flushed (as in 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_flush</refentrytitle><manvolnum>3</manvolnum></citerefentry>)
<citerefentry><refentrytitle>sd_bus_close</refentrytitle><manvolnum>3</manvolnum></citerefentry>) during the exit and closed (as in
phase of the event loop. This logic only applies to bus connections that are attached to an <citerefentry><refentrytitle>sd_bus_close</refentrytitle><manvolnum>3</manvolnum></citerefentry>)
<citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry> event loop, see during the exit phase of the event loop. This logic only applies to bus connections that are
<citerefentry><refentrytitle>sd_bus_attach_event</refentrytitle><manvolnum>3</manvolnum></citerefentry>. By default attached to an
this mechanism is enabled and makes sure that any pending messages that have not been written to the bus connection <citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry>
are written out when the event loop is shutting down. In some cases this behaviour is not desirable, for example event loop, see
when the bus connection shall remain usable until after the event loop exited. If <parameter>b</parameter> is <citerefentry><refentrytitle>sd_bus_attach_event</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
true, the feature is enabled (which is the default), otherwise disabled.</para> 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 <para><function>sd_bus_get_close_on_exit()</function> may be used to query the current setting
returns zero when the feature is disabled, and positive if enabled.</para> of this feature. It returns zero when the feature is disabled, and positive if enabled.</para>
</refsect1> </refsect1>
<refsect1> <refsect1>
<title>Return Value</title> <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 <para>On success, <function>sd_bus_set_close_on_exit()</function> returns a non-negative
error code.</para> 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 <para><function>sd_bus_get_close_on_exit()</function> returns 0 if the feature is currently
positive integer if it is on. On failure, it returns a negative errno-style error code.</para> disabled or a positive integer if it is enabled. On failure, it returns a negative errno-style
error code.</para>
<refsect2> <refsect2>
<title>Errors</title> <title>Errors</title>
@ -78,7 +84,8 @@
<varlistentry> <varlistentry>
<term><constant>-ECHILD</constant></term> <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> </varlistentry>
</variablelist> </variablelist>
</refsect2> </refsect2>
@ -98,5 +105,4 @@
<citerefentry><refentrytitle>sd_event_add_exit</refentrytitle><manvolnum>3</manvolnum></citerefentry> <citerefentry><refentrytitle>sd_event_add_exit</refentrytitle><manvolnum>3</manvolnum></citerefentry>
</para> </para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@ -65,11 +65,11 @@
<refsect1> <refsect1>
<title>Return Value</title> <title>Return Value</title>
<para>On success, <function>sd_bus_set_close_on_exit()</function> returns a non-negative <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> integer. On failure, it returns a negative errno-style error code.</para>
<para><function>sd_bus_get_close_on_exit()</function> returns a positive integer if the exit on <para><function>sd_bus_get_exit_on_disconnect()</function> returns a positive integer if the
disconnect behavior is enabled. Otherwise, it returns zero.</para> exit on disconnect behavior is enabled. Otherwise, it returns zero.</para>
<refsect2> <refsect2>
<title>Errors</title> <title>Errors</title>
@ -77,6 +77,18 @@
<para>Returned errors may indicate the following problems:</para> <para>Returned errors may indicate the following problems:</para>
<variablelist> <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> <varlistentry>
<term><constant>-ECHILD</constant></term> <term><constant>-ECHILD</constant></term>