1SD_BUS_SLOT_SET_USERDATA(3)sd_bus_slot_set_userdataSD_BUS_SLOT_SET_USERDATA(3)
2
3
4
6 sd_bus_slot_set_userdata, sd_bus_slot_get_userdata - Set and query the
7 value in the "userdata" field
8
10 #include <systemd/sd-bus.h>
11
12 void* sd_bus_slot_set_userdata(sd_bus_slot* slot, void* userdata);
13
14 void* sd_bus_slot_get_userdata(sd_bus_slot* slot);
15
17 The userdata pointer allows data to be passed between the point where a
18 callback is registered, for example when a filter is added using
19 sd_bus_add_filter(3) or an asynchronous function call is made using
20 sd_bus_call_async(3), and the point where the callback is called,
21 without having any global state. The pointer has type void* and is not
22 used by the sd-bus functions in any way, except to pass to the callback
23 function.
24
25 Usually, the userdata field is set when the slot object is initially
26 registered. sd_bus_slot_set_userdata() may be used to change it later
27 for the bus slot object slot. Previous value of the field is returned.
28 The argument and returned value may be NULL. It will be passed as the
29 userdata argument to the callback function attached to the slot.
30
31 sd_bus_slot_set_userdata() gets the value of the userdata field in the
32 bus slot object slot.
33
35 On success, these functions return the value of the userdata field
36 before the function call. If the slot object is NULL, NULL will be
37 returned to signify an error, but this is not distinguishable from the
38 userdata field value being NULL.
39
41 Functions described here are available as a shared library, which can
42 be compiled against and linked to with the libsystemd pkg-config(1)
43 file.
44
45 The code described here uses getenv(3), which is declared to be not
46 multi-thread-safe. This means that the code calling the functions
47 described here must not call setenv(3) from a parallel thread. It is
48 recommended to only do calls to setenv() from an early phase of the
49 program when no other threads have been started.
50
52 systemd(1), sd-bus(3), sd_bus_slot_set_destroy_callback(3),
53 sd_bus_add_match(3), sd_bus_slot_get_current_userdata(3)
54
55
56
57systemd 254 SD_BUS_SLOT_SET_USERDATA(3)