]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/sd_bus_slot_set_floating.xml
Merge pull request #11975 from keszybz/fuzzer-fixes-n
[thirdparty/systemd.git] / man / sd_bus_slot_set_floating.xml
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+ -->
5
6 <refentry id="sd_bus_slot_set_floating" xmlns:xi="http://www.w3.org/2001/XInclude">
7
8 <refentryinfo>
9 <title>sd_bus_slot_set_floating</title>
10 <productname>systemd</productname>
11 </refentryinfo>
12
13 <refmeta>
14 <refentrytitle>sd_bus_slot_set_floating</refentrytitle>
15 <manvolnum>3</manvolnum>
16 </refmeta>
17
18 <refnamediv>
19 <refname>sd_bus_slot_set_floating</refname>
20 <refname>sd_bus_slot_get_floating</refname>
21
22 <refpurpose>Control whether a bus slot object is "floating".</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_slot_set_floating</function></funcdef>
31 <paramdef>sd_bus_slot *<parameter>slot</parameter></paramdef>
32 <paramdef>int <parameter>b</parameter></paramdef>
33 </funcprototype>
34
35 <funcprototype>
36 <funcdef>int <function>sd_bus_slot_get_floating</function></funcdef>
37 <paramdef>sd_bus_slot *<parameter>slot</parameter></paramdef>
38 </funcprototype>
39
40 </funcsynopsis>
41 </refsynopsisdiv>
42
43 <refsect1>
44 <title>Description</title>
45
46 <para><function>sd_bus_slot_set_floating()</function> controls whether the specified bus slot object
47 <parameter>slot</parameter> shall be "floating" or not. A floating bus slot object's lifetime is bound to the
48 lifetime of the bus object it is associated with, meaning that it remains allocated as long as the bus object
49 itself and is freed automatically when the bus object is freed. Regular (i.e. non-floating) bus slot objects keep
50 the bus referenced, hence the bus object remains allocated at least as long as there remains at least one
51 referenced bus slot object around. The floating state hence controls the direction of referencing between the bus
52 object and the bus slot objects: if floating the bus pins the bus slot, and otherwise the bus slot pins the bus
53 objects. Use <function>sd_bus_slot_set_floating()</function> to switch between both modes: if the
54 <parameter>b</parameter> parameter is zero, the slot object is considered floating, otherwise it is made a regular
55 (non-floating) slot object.</para>
56
57 <para>Bus slot objects may be allocated with calls such as
58 <citerefentry><refentrytitle>sd_bus_add_match</refentrytitle><manvolnum>3</manvolnum></citerefentry>. If the
59 <parameter>slot</parameter> of these functions is non-<constant>NULL</constant> the slot object will be of the
60 regular kind (i.e. non-floating), otherwise it will be created floating. With
61 <function>sd_bus_slot_set_floating()</function> a bus slot object allocated as regular can be converted into a
62 floating object and back. This is particularly useful for creating a bus slot object, then changing parameters of
63 it, and then turning it into a floating object, whose lifecycle is managed by the bus object.</para>
64
65 <para><function>sd_bus_slot_get_floating()</function> returns the current floating state of the specified bus slot
66 object. It returns negative on error, zero if the bus slot object is a regular (non-floating) object and positive
67 otherwise.</para>
68 </refsect1>
69
70 <refsect1>
71 <title>Return Value</title>
72
73 <para>On success, these functions return 0 or a positive integer. On failure, they return a negative errno-style
74 error code.</para>
75 </refsect1>
76
77 <refsect1>
78 <title>Errors</title>
79
80 <para>Returned errors may indicate the following problems:</para>
81
82 <variablelist>
83 <varlistentry>
84 <term><constant>-EINVAL</constant></term>
85
86 <listitem><para>The <parameter>slot</parameter> parameter is <constant>NULL</constant>.</para></listitem>
87 </varlistentry>
88
89 <varlistentry>
90 <term><constant>-ECHILD</constant></term>
91
92 <listitem><para>The bus connection has been created in a different process.</para></listitem>
93 </varlistentry>
94
95 <varlistentry>
96 <term><constant>-ESTALE</constant></term>
97
98 <listitem><para>The bus object the specified bus slot object is associated with has already been freed, and
99 hence no change in the floating state can be made anymore.</para></listitem>
100 </varlistentry>
101 </variablelist>
102 </refsect1>
103
104 <xi:include href="libsystemd-pkgconfig.xml" />
105
106 <refsect1>
107 <title>See Also</title>
108
109 <para>
110 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
111 <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
112 <citerefentry><refentrytitle>sd_bus_slot_set_destroy_callback</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
113 <citerefentry><refentrytitle>sd_bus_add_match</refentrytitle><manvolnum>3</manvolnum></citerefentry>
114 </para>
115 </refsect1>
116
117 </refentry>