| 1 |
'\" t |
| 2 |
.TH "SD_EVENT_SOURCE_SET_USERDATA" "3" "" "systemd 261~rc3" "sd_event_source_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_event_source_set_userdata, sd_event_source_get_userdata \- Set or retrieve user data pointer of event sources |
| 24 |
.SH "SYNOPSIS" |
| 25 |
.sp |
| 26 |
.ft B |
| 27 |
.nf |
| 28 |
#include <systemd/sd\-event\&.h> |
| 29 |
.fi |
| 30 |
.ft |
| 31 |
.HP \w'void*\ sd_event_source_set_userdata('u |
| 32 |
.BI "void* sd_event_source_set_userdata(sd_event_source\ *" "source" ", void\ *" "userdata" ");" |
| 33 |
.HP \w'void*\ sd_event_source_get_userdata('u |
| 34 |
.BI "void* sd_event_source_get_userdata(sd_event_source\ *" "source" ");" |
| 35 |
.SH "DESCRIPTION" |
| 36 |
.PP |
| 37 |
\fBsd_event_source_set_userdata()\fR |
| 38 |
may be used to set an arbitrary user data pointer for the event source object specified as |
| 39 |
\fIsource\fR\&. The user data pointer is usually specified when creating an event source object with calls such as |
| 40 |
\fBsd_event_add_io\fR(3) |
| 41 |
or |
| 42 |
\fBsd_event_add_time\fR(3), and may be updated with this call\&. The user data pointer is also passed to all handler callback functions associated with the event source\&. The |
| 43 |
\fIuserdata\fR |
| 44 |
parameter specifies the new user data pointer to set, the function returns the previous user data pointer\&. Note that |
| 45 |
\fBNULL\fR |
| 46 |
is a valid user data pointer\&. |
| 47 |
.PP |
| 48 |
\fBsd_event_source_get_userdata()\fR |
| 49 |
may be used to query the current user data pointer assigned to the event source object |
| 50 |
\fIsource\fR\&. |
| 51 |
.SH "RETURN VALUE" |
| 52 |
.PP |
| 53 |
On success, |
| 54 |
\fBsd_event_source_set_userdata()\fR |
| 55 |
and |
| 56 |
\fBsd_event_source_get_userdata()\fR |
| 57 |
return the previously set user data pointer\&. On failure, they return |
| 58 |
\fBNULL\fR\&. |
| 59 |
.SH "NOTES" |
| 60 |
.PP |
| 61 |
Functions described here are available as a shared library, which can be compiled against and linked to with the |
| 62 |
\fBlibsystemd\fR\ \&\fBpkg-config\fR(1) |
| 63 |
file\&. |
| 64 |
.PP |
| 65 |
The code described here uses |
| 66 |
\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 |
| 67 |
\fBsetenv\fR(3) |
| 68 |
from a parallel thread\&. It is recommended to only do calls to |
| 69 |
\fBsetenv()\fR |
| 70 |
from an early phase of the program when no other threads have been started\&. |
| 71 |
.SH "HISTORY" |
| 72 |
.PP |
| 73 |
\fBsd_event_source_set_userdata()\fR |
| 74 |
and |
| 75 |
\fBsd_event_source_get_userdata()\fR |
| 76 |
were added in version 229\&. |
| 77 |
.SH "SEE ALSO" |
| 78 |
.PP |
| 79 |
\fBsd-event\fR(3), \fBsd_event_add_io\fR(3), \fBsd_event_add_time\fR(3), \fBsd_event_add_signal\fR(3), \fBsd_event_add_child\fR(3), \fBsd_event_add_inotify\fR(3), \fBsd_event_add_defer\fR(3), \fBsd_event_source_set_description\fR(3) |