]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/sd_bus_slot_set_userdata.xml
travis: use UBSan checks from OSS-Fuzz
[thirdparty/systemd.git] / man / sd_bus_slot_set_userdata.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_userdata" xmlns:xi="http://www.w3.org/2001/XInclude">
7
8 <refentryinfo>
9 <title>sd_bus_slot_set_userdata</title>
10 <productname>systemd</productname>
11 </refentryinfo>
12
13 <refmeta>
14 <refentrytitle>sd_bus_slot_set_userdata</refentrytitle>
15 <manvolnum>3</manvolnum>
16 </refmeta>
17
18 <refnamediv>
19 <refname>sd_bus_slot_set_userdata</refname>
20 <refname>sd_bus_slot_get_userdata</refname>
21
22 <refpurpose>Set and query the value in the "userdata" field</refpurpose>
23 </refnamediv>
24
25 <refsynopsisdiv>
26 <funcsynopsis>
27 <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
28
29 <funcprototype>
30 <funcdef>void* <function>sd_bus_slot_set_userdata</function></funcdef>
31 <paramdef>sd_bus_slot* <parameter>slot</parameter></paramdef>
32 <paramdef>void* <parameter>userdata</parameter></paramdef>
33 </funcprototype>
34
35 <funcprototype>
36 <funcdef>void* <function>sd_bus_slot_get_userdata</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>The userdata pointer allows data to be passed between the point where a callback is
47 registered, for example when a filter is added using
48 <citerefentry><refentrytitle>sd_bus_add_filter</refentrytitle><manvolnum>3</manvolnum></citerefentry>
49 or an asynchronous function call is made using
50 <citerefentry><refentrytitle>sd_bus_call_async</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
51 and the point where the callback is called, without having any global state. The pointer has
52 type <type>void*</type> and is not used by the sd-bus functions in any way, except to pass to
53 the callback function.</para>
54
55 <para>Usually, the userdata field is set when the slot object is initially
56 registered. <function>sd_bus_slot_set_userdata()</function> may be used to change it later for
57 the bus slot object <parameter>slot</parameter>. Previous value of the field is returned. The
58 argument and returned value may be <constant>NULL</constant>. It will be passed as the
59 <parameter>userdata</parameter> argument to the callback function attached to the slot.</para>
60
61 <para><function>sd_bus_slot_set_userdata()</function> gets the value of the userdata field in
62 the bus slot object <parameter>slot</parameter>.</para>
63 </refsect1>
64
65 <refsect1>
66 <title>Return Value</title>
67
68 <para>On success, these functions return the value of the userdata field before the function
69 call. If the <parameter>slot</parameter> object is <constant>NULL</constant>,
70 <constant>NULL</constant> will be returned to signify an error, but this is not distinguishable
71 from the userdata field value being <constant>NULL</constant>.</para>
72 </refsect1>
73
74 <xi:include href="libsystemd-pkgconfig.xml" />
75
76 <refsect1>
77 <title>See Also</title>
78
79 <para>
80 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
81 <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
82 <citerefentry><refentrytitle>sd_bus_slot_set_destroy_callback</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
83 <citerefentry><refentrytitle>sd_bus_add_match</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
84 <citerefentry><refentrytitle>sd_bus_slot_get_current_userdata</refentrytitle><manvolnum>3</manvolnum></citerefentry>
85 </para>
86 </refsect1>
87
88 </refentry>