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