]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/sd_bus_slot_set_destroy_callback.xml
Merge pull request #9165 from ssahani/networkd-netdevsim
[thirdparty/systemd.git] / man / sd_bus_slot_set_destroy_callback.xml
1 <?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
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
7 <refentry id="sd_bus_slot_set_destroy_callback"
8 xmlns:xi="http://www.w3.org/2001/XInclude">
9
10 <refentryinfo>
11 <title>sd_bus_slot_set_destroy_callback</title>
12 <productname>systemd</productname>
13 </refentryinfo>
14
15 <refmeta>
16 <refentrytitle>sd_bus_slot_set_destroy_callback</refentrytitle>
17 <manvolnum>3</manvolnum>
18 </refmeta>
19
20 <refnamediv>
21 <refname>sd_bus_slot_set_destroy_callback</refname>
22 <refname>sd_bus_slot_get_destroy_callback</refname>
23
24 <refpurpose>Define the callback function for resource cleanup.</refpurpose>
25 </refnamediv>
26
27 <refsynopsisdiv>
28 <funcsynopsis>
29 <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
30
31 <funcprototype>
32 <funcdef>typedef int (*<function>sd_bus_destroy_t</function>)</funcdef>
33 <paramdef>void *<parameter>userdata</parameter></paramdef>
34 </funcprototype>
35
36 <funcprototype>
37 <funcdef>int <function>sd_bus_slot_set_destroy_callback</function></funcdef>
38 <paramdef>sd_bus_slot *<parameter>slot</parameter></paramdef>
39 <paramdef>sd_bus_destroy_t <parameter>callback</parameter></paramdef>
40 </funcprototype>
41
42 <funcprototype>
43 <funcdef>int <function>sd_bus_slot_get_destroy_callback</function></funcdef>
44 <paramdef>sd_bus_slot *<parameter>slot</parameter></paramdef>
45 <paramdef>sd_bus_destroy_t *<parameter>callback</parameter></paramdef>
46 </funcprototype>
47 </funcsynopsis>
48 </refsynopsisdiv>
49
50 <refsect1>
51 <title>Description</title>
52
53 <para><function>sd_bus_slot_set_destroy_callback()</function> sets
54 <parameter>callback</parameter> as the callback function to be called right before the bus slot
55 object <parameter>slot</parameter> is deallocated. The <parameter>userdata</parameter> pointer
56 from the slot object will be passed as the <parameter>userdata</parameter> parameter. This
57 pointer can be set specified as an argument to the constuctor functions, see
58 <citerefentry><refentrytitle>sd_bus_add_match</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
59 or directly, see
60 <citerefentry><refentrytitle>sd_bus_set_userdata</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
61 This callback function is called even if <parameter>userdata</parameter> is
62 <constant>NULL</constant>.</para>
63
64 <para><function>sd_bus_slot_get_destroy_callback()</function> returns the current callback
65 for <parameter>slot</parameter> in the <parameter>callback</parameter> parameter.</para>
66 </refsect1>
67
68 <refsect1>
69 <title>Return Value</title>
70
71 <para>On success, <function>sd_bus_slot_set_destroy_callback()</function> returns 0 or a
72 positive integer. On failure, it returns a negative errno-style error code.</para>
73
74 <para><function>sd_bus_slot_get_destroy_callback()</function> returns 1 if the destroy callback
75 function is set, 0 if not. On failure, it returns a negative errno-style 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>
84 <varlistentry>
85 <term><constant>-EINVAL</constant></term>
86
87 <listitem><para>The <parameter>slot</parameter> parameter is <constant>NULL</constant>.
88 </para></listitem>
89 </varlistentry>
90 </variablelist>
91 </refsect1>
92
93 <xi:include href="libsystemd-pkgconfig.xml" />
94
95 <refsect1>
96 <title>See Also</title>
97
98 <para>
99 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
100 <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
101 <citerefentry><refentrytitle>sd_bus_slot_set_floating</refentrytitle><manvolnum>3</manvolnum></citerefentry>
102 </para>
103 </refsect1>
104
105 </refentry>