Debian Codegraph @

upstream/debian-unstable/man3/sd_bus_slot_set_destroy_callback.3

raw
1 '\" t
2 .TH "SD_BUS_SLOT_SET_DESTROY_CALLBACK" "3" "" "systemd 261~rc3" "sd_bus_slot_set_destroy_callback"
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_destroy_callback, sd_bus_slot_get_destroy_callback, sd_bus_track_set_destroy_callback, sd_bus_track_get_destroy_callback, sd_bus_destroy_t \- Define the callback function for resource cleanup
24 .SH "SYNOPSIS"
25 .sp
26 .ft B
27 .nf
28 #include <systemd/sd\-bus\&.h>
29 .fi
30 .ft
31 .HP \w'typedef\ int\ (*sd_bus_destroy_t)('u
32 .BI "typedef int (*sd_bus_destroy_t)(void\ *" "userdata" ");"
33 .HP \w'int\ sd_bus_slot_set_destroy_callback('u
34 .BI "int sd_bus_slot_set_destroy_callback(sd_bus_slot\ *" "slot" ", sd_bus_destroy_t\ " "callback" ");"
35 .HP \w'int\ sd_bus_slot_get_destroy_callback('u
36 .BI "int sd_bus_slot_get_destroy_callback(sd_bus_slot\ *" "slot" ", sd_bus_destroy_t\ *" "callback" ");"
37 .HP \w'int\ sd_bus_track_set_destroy_callback('u
38 .BI "int sd_bus_track_set_destroy_callback(sd_bus_track\ *" "track" ", sd_bus_destroy_t\ " "callback" ");"
39 .HP \w'int\ sd_bus_track_get_destroy_callback('u
40 .BI "int sd_bus_track_get_destroy_callback(sd_bus_track\ *" "track" ", sd_bus_destroy_t\ *" "callback" ");"
41 .SH "DESCRIPTION"
42 .PP
43 \fBsd_bus_slot_set_destroy_callback()\fR
44 sets
45 \fIcallback\fR
46 as the callback function to be called right before the bus slot object
47 \fIslot\fR
48 is deallocated\&. The
49 \fIuserdata\fR
50 pointer from the slot object will be passed as the
51 \fIuserdata\fR
52 parameter\&. This pointer can be set by an argument to the constructor functions, see
53 \fBsd_bus_add_match\fR(3), or directly, see
54 \fBsd_bus_slot_set_userdata\fR(3)\&. This callback function is called even if
55 \fIuserdata\fR
56 is
57 \fBNULL\fR\&. Note that this callback is invoked at a time where the bus slot object itself is already invalidated, and executing operations or taking new references to the bus slot object is not permissible\&.
58 .PP
59 \fBsd_bus_slot_get_destroy_callback()\fR
60 returns the current callback for
61 \fIslot\fR
62 in the
63 \fIcallback\fR
64 parameter\&.
65 .PP
66 \fBsd_bus_track_set_destroy_callback()\fR
67 and
68 \fBsd_bus_track_get_destroy_callback()\fR
69 provide equivalent functionality for the
70 \fIuserdata\fR
71 pointer associated with bus peer tracking objects\&. For details about bus peer tracking objects, see
72 \fBsd_bus_track_new\fR(3)\&.
73 .SH "RETURN VALUE"
74 .PP
75 On success,
76 \fBsd_bus_slot_set_destroy_callback()\fR
77 and
78 \fBsd_bus_track_set_destroy_callback()\fR
79 return 0 or a positive integer\&. On failure, they return a negative errno\-style error code\&.
80 .PP
81 \fBsd_bus_slot_get_destroy_callback()\fR
82 and
83 \fBsd_bus_track_get_destroy_callback()\fR
84 return positive if the destroy callback function is set, 0 if not\&. On failure, they return a negative errno\-style error code\&.
85 .SS "Errors"
86 .PP
87 Returned errors may indicate the following problems:
88 .PP
89 \fB\-EINVAL\fR
90 .RS 4
91 The
92 \fIslot\fR
93 or
94 \fItrack\fR
95 parameter is
96 \fBNULL\fR\&.
97 .RE
98 .SH "NOTES"
99 .PP
100 Functions described here are available as a shared library, which can be compiled against and linked to with the
101 \fBlibsystemd\fR\ \&\fBpkg-config\fR(1)
102 file\&.
103 .PP
104 The code described here uses
105 \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
106 \fBsetenv\fR(3)
107 from a parallel thread\&. It is recommended to only do calls to
108 \fBsetenv()\fR
109 from an early phase of the program when no other threads have been started\&.
110 .SH "HISTORY"
111 .PP
112 \fBsd_bus_destroy_t()\fR,
113 \fBsd_bus_slot_set_destroy_callback()\fR,
114 \fBsd_bus_slot_get_destroy_callback()\fR,
115 \fBsd_bus_track_set_destroy_callback()\fR, and
116 \fBsd_bus_track_get_destroy_callback()\fR
117 were added in version 239\&.
118 .SH "SEE ALSO"
119 .PP
120 \fBsystemd\fR(1), \fBsd-bus\fR(3), \fBsd_bus_slot_set_floating\fR(3), \fBsd_bus_add_match\fR(3), \fBsd_bus_track_new\fR(3), \fBsd_bus_slot_set_userdata\fR(3), \fBsd_bus_track_set_userdata\fR(3)