1SD_BUS_SLOT_SET_DESTROY_sCdA_LbLuBsA_CsKl(o3t)_set_destrSoDy__BcUaSl_lSbLaOcTk_SET_DESTROY_CALLBACK(3)
2
3
4

NAME

6       sd_bus_slot_set_destroy_callback, sd_bus_slot_get_destroy_callback,
7       sd_bus_track_set_destroy_callback, sd_bus_track_get_destroy_callback,
8       sd_bus_destroy_t - Define the callback function for resource cleanup
9

SYNOPSIS

11       #include <systemd/sd-bus.h>
12
13       typedef int (*sd_bus_destroy_t)(void *userdata);
14
15       int sd_bus_slot_set_destroy_callback(sd_bus_slot *slot,
16                                            sd_bus_destroy_t callback);
17
18       int sd_bus_slot_get_destroy_callback(sd_bus_slot *slot,
19                                            sd_bus_destroy_t *callback);
20
21       int sd_bus_track_set_destroy_callback(sd_bus_track *track,
22                                             sd_bus_destroy_t callback);
23
24       int sd_bus_track_get_destroy_callback(sd_bus_track *track,
25                                             sd_bus_destroy_t *callback);
26

DESCRIPTION

28       sd_bus_slot_set_destroy_callback() sets callback as the callback
29       function to be called right before the bus slot object slot is
30       deallocated. The userdata pointer from the slot object will be passed
31       as the userdata parameter. This pointer can be set by an argument to
32       the constructor functions, see sd_bus_add_match(3), or directly, see
33       sd_bus_slot_set_userdata(3). This callback function is called even if
34       userdata is NULL. Note that this callback is invoked at a time where
35       the bus slot object itself is already invalidated, and executing
36       operations or taking new references to the bus slot object is not
37       permissible.
38
39       sd_bus_slot_get_destroy_callback() returns the current callback for
40       slot in the callback parameter.
41
42       sd_bus_track_set_destroy_callback() and
43       sd_bus_track_get_destroy_callback() provide equivalent functionality
44       for the userdata pointer associated with bus peer tracking objects. For
45       details about bus peer tracking objects, see sd_bus_track_new(3).
46

RETURN VALUE

48       On success, sd_bus_slot_set_destroy_callback() and
49       sd_bus_track_set_destroy_callback() return 0 or a positive integer. On
50       failure, they return a negative errno-style error code.
51
52       sd_bus_slot_get_destroy_callback() and
53       sd_bus_track_get_destroy_callback() return positive if the destroy
54       callback function is set, 0 if not. On failure, they return a negative
55       errno-style error code.
56
57   Errors
58       Returned errors may indicate the following problems:
59
60       -EINVAL
61           The slot or track parameter is NULL.
62

NOTES

64       Functions described here are available as a shared library, which can
65       be compiled against and linked to with the libsystemd pkg-config(1)
66       file.
67
68       The code described here uses getenv(3), which is declared to be not
69       multi-thread-safe. This means that the code calling the functions
70       described here must not call setenv(3) from a parallel thread. It is
71       recommended to only do calls to setenv() from an early phase of the
72       program when no other threads have been started.
73

SEE ALSO

75       systemd(1), sd-bus(3), sd_bus_slot_set_floating(3),
76       sd_bus_add_match(3), sd_bus_track_new(3), sd_bus_slot_set_userdata(3),
77       sd_bus_track_set_userdata(3)
78
79
80
81systemd 254                                SD_BUS_SLOT_SET_DESTROY_CALLBACK(3)
Impressum