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 These APIs are implemented as a shared library, which can be compiled
42 and linked to with the libsystemd pkg-config(1) file.
43
45 systemd(1), sd-bus(3), sd_bus_slot_set_destroy_callback(3),
46 sd_bus_add_match(3), sd_bus_slot_get_current_userdata(3)
47
48
49
50systemd 245 SD_BUS_SLOT_SET_USERDATA(3)