Debian Codegraph @

upstream/debian-unstable/man3/sd_bus_slot_set_userdata.3

raw
1 '\" t
2 .TH "SD_BUS_SLOT_SET_USERDATA" "3" "" "systemd 261~rc3" "sd_bus_slot_set_userdata"
3 .\" -----------------------------------------------------------------
4 .\" * Define some portability stuff
5 .\" -----------------------------------------------------------------
6 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 .\" http://bugs.debian.org/507673
8 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
9 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10 .ie \n(.g .ds Aq \(aq
11 .el .ds Aq '
12 .\" -----------------------------------------------------------------
13 .\" * set default formatting
14 .\" -----------------------------------------------------------------
15 .\" disable hyphenation
16 .nh
17 .\" disable justification (adjust text to left margin only)
18 .ad l
19 .\" -----------------------------------------------------------------
20 .\" * MAIN CONTENT STARTS HERE *
21 .\" -----------------------------------------------------------------
22 .SH "NAME"
23 sd_bus_slot_set_userdata, sd_bus_slot_get_userdata \- Set and query the value in the "userdata" field
24 .SH "SYNOPSIS"
25 .sp
26 .ft B
27 .nf
28 #include <systemd/sd\-bus\&.h>
29 .fi
30 .ft
31 .HP \w'void*\ sd_bus_slot_set_userdata('u
32 .BI "void* sd_bus_slot_set_userdata(sd_bus_slot*\ " "slot" ", void*\ " "userdata" ");"
33 .HP \w'void*\ sd_bus_slot_get_userdata('u
34 .BI "void* sd_bus_slot_get_userdata(sd_bus_slot*\ " "slot" ");"
35 .SH "DESCRIPTION"
36 .PP
37 The userdata pointer allows data to be passed between the point where a callback is registered, for example when a filter is added using
38 \fBsd_bus_add_filter\fR(3)
39 or an asynchronous function call is made using
40 \fBsd_bus_call_async\fR(3), and the point where the callback is called, without having any global state\&. The pointer has type
41 \fBvoid*\fR
42 and is not used by the sd\-bus functions in any way, except to pass to the callback function\&.
43 .PP
44 Usually, the userdata field is set when the slot object is initially registered\&.
45 \fBsd_bus_slot_set_userdata()\fR
46 may be used to change it later for the bus slot object
47 \fIslot\fR\&. Previous value of the field is returned\&. The argument and returned value may be
48 \fBNULL\fR\&. It will be passed as the
49 \fIuserdata\fR
50 argument to the callback function attached to the slot\&.
51 .PP
52 \fBsd_bus_slot_set_userdata()\fR
53 gets the value of the userdata field in the bus slot object
54 \fIslot\fR\&.
55 .SH "RETURN VALUE"
56 .PP
57 On success, these functions return the value of the userdata field before the function call\&. If the
58 \fIslot\fR
59 object is
60 \fBNULL\fR,
61 \fBNULL\fR
62 will be returned to signify an error, but this is not distinguishable from the userdata field value being
63 \fBNULL\fR\&.
64 .SH "NOTES"
65 .PP
66 Functions described here are available as a shared library, which can be compiled against and linked to with the
67 \fBlibsystemd\fR\ \&\fBpkg-config\fR(1)
68 file\&.
69 .PP
70 The code described here uses
71 \fBgetenv\fR(3), which is declared to be not multi\-thread\-safe\&. This means that the code calling the functions described here must not call
72 \fBsetenv\fR(3)
73 from a parallel thread\&. It is recommended to only do calls to
74 \fBsetenv()\fR
75 from an early phase of the program when no other threads have been started\&.
76 .SH "HISTORY"
77 .PP
78 \fBsd_bus_slot_set_userdata()\fR
79 and
80 \fBsd_bus_slot_get_userdata()\fR
81 were added in version 240\&.
82 .SH "SEE ALSO"
83 .PP
84 \fBsystemd\fR(1), \fBsd-bus\fR(3), \fBsd_bus_slot_set_destroy_callback\fR(3), \fBsd_bus_add_match\fR(3), \fBsd_bus_slot_get_current_userdata\fR(3)