]>
Commit | Line | Data |
---|---|---|
514094f9 | 1 | <?xml version='1.0'?> |
3a54a157 ZJS |
2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> | |
1004b2c7 LP |
4 | <!-- SPDX-License-Identifier: LGPL-2.1+ --> |
5 | ||
7d6b2723 | 6 | <refentry id="sd_bus_slot_set_floating" xmlns:xi="http://www.w3.org/2001/XInclude"> |
1004b2c7 LP |
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 <systemd/sd-bus.h></funcsynopsisinfo> | |
28 | ||
29 | <funcprototype> | |
30 | <funcdef>int <function>sd_bus_slot_set_floating</function></funcdef> | |
e3736e02 | 31 | <paramdef>sd_bus_slot *<parameter>slot</parameter></paramdef> |
1004b2c7 LP |
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 | |
1b2ad5d9 | 52 | object and the bus slot objects: if floating the bus pins the bus slot, and otherwise the bus slot pins the bus |
1004b2c7 LP |
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 | ||
b1de39de ZJS |
73 | <para>On success, these functions return 0 or a positive integer. On failure, they return a negative |
74 | errno-style error code.</para> | |
1004b2c7 | 75 | |
b1de39de ZJS |
76 | <refsect2> |
77 | <title>Errors</title> | |
1004b2c7 | 78 | |
b1de39de | 79 | <para>Returned errors may indicate the following problems:</para> |
1004b2c7 | 80 | |
b1de39de ZJS |
81 | <variablelist> |
82 | <varlistentry> | |
83 | <term><constant>-EINVAL</constant></term> | |
e3736e02 | 84 | |
b1de39de ZJS |
85 | <listitem><para>The <parameter>slot</parameter> parameter is <constant>NULL</constant>.</para></listitem> |
86 | </varlistentry> | |
e3736e02 | 87 | |
b1de39de ZJS |
88 | <varlistentry> |
89 | <term><constant>-ECHILD</constant></term> | |
1004b2c7 | 90 | |
b1de39de ZJS |
91 | <listitem><para>The bus connection has been created in a different process.</para></listitem> |
92 | </varlistentry> | |
1004b2c7 | 93 | |
b1de39de ZJS |
94 | <varlistentry> |
95 | <term><constant>-ESTALE</constant></term> | |
1004b2c7 | 96 | |
b1de39de ZJS |
97 | <listitem><para>The bus object the specified bus slot object is associated with has already been |
98 | freed, and hence no change in the floating state can be made anymore.</para></listitem> | |
99 | </varlistentry> | |
100 | </variablelist> | |
101 | </refsect2> | |
1004b2c7 LP |
102 | </refsect1> |
103 | ||
7d6b2723 | 104 | <xi:include href="libsystemd-pkgconfig.xml" /> |
1004b2c7 LP |
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>, | |
fa17b4e8 | 112 | <citerefentry><refentrytitle>sd_bus_slot_set_destroy_callback</refentrytitle><manvolnum>3</manvolnum></citerefentry>, |
1004b2c7 LP |
113 | <citerefentry><refentrytitle>sd_bus_add_match</refentrytitle><manvolnum>3</manvolnum></citerefentry> |
114 | </para> | |
115 | </refsect1> | |
116 | ||
117 | </refentry> |