'\" t .TH "SD_BUS_SLOT_SET_USERDATA" "3" "" "systemd 241" "sd_bus_slot_set_userdata" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" sd_bus_slot_set_userdata, sd_bus_slot_get_userdata \- Set and query the value in the "userdata" field .SH "SYNOPSIS" .sp .ft B .nf #include .fi .ft .HP \w'void*\ sd_bus_slot_set_userdata('u .BI "void* sd_bus_slot_set_userdata(sd_bus_slot*\ " "slot" ", void*\ " "userdata" ");" .HP \w'void*\ sd_bus_slot_get_userdata('u .BI "void* sd_bus_slot_get_userdata(sd_bus_slot*\ " "slot" ");" .SH "DESCRIPTION" .PP The userdata pointer allows data to be passed between the point where a callback is registered, for example when a filter is added using \fBsd_bus_add_filter\fR(3) or an asynchronous function call is made using \fBsd_bus_call_async\fR(3), and the point where the callback is called, without having any global state\&. The pointer has type \fBvoid*\fR and is not used by the sd\-bus functions in any way, except to pass to the callback function\&. .PP Usually, the userdata field is set when the slot object is initially registered\&. \fBsd_bus_slot_set_userdata()\fR may be used to change it later for the bus slot object \fIslot\fR\&. Previous value of the field is returned\&. The argument and returned value may be \fBNULL\fR\&. It will be passed as the \fIuserdata\fR argument to the callback function attached to the slot\&. .PP \fBsd_bus_slot_set_userdata()\fR gets the value of the userdata field in the bus slot object \fIslot\fR\&. .SH "RETURN VALUE" .PP On success, these functions return the value of the userdata field before the function call\&. If the \fIslot\fR object is \fBNULL\fR, \fBNULL\fR will be returned to signify an error, but this is not distinguishable from the userdata field value being \fBNULL\fR\&. .SH "NOTES" .PP These APIs are implemented as a shared library, which can be compiled and linked to with the \fBlibsystemd\fR\ \&\fBpkg-config\fR(1) file\&. .SH "SEE ALSO" .PP \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)