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 for
44       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

ERRORS

58       Returned errors may indicate the following problems:
59
60       -EINVAL
61           The slot or track parameter is NULL.
62

NOTES

64       These APIs are implemented as a shared library, which can be compiled
65       and linked to with the libsystemd pkg-config(1) file.
66

SEE ALSO

68       systemd(1), sd-bus(3), sd_bus_slot_set_floating(3),
69       sd_bus_add_match(3), sd_bus_track_new(3), sd_bus_slot_set_userdata(3),
70       sd_bus_track_set_userdata(3)
71
72
73
74systemd 239                                SD_BUS_SLOT_SET_DESTROY_CALLBACK(3)
Impressum