| 1 |
'\" t |
| 2 |
.TH "SD_EVENT_SOURCE_SET_DESCRIPTION" "3" "" "systemd 261~rc3" "sd_event_source_set_description" |
| 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_description, sd_event_source_get_description \- Set or retrieve descriptive names 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'int\ sd_event_source_set_description('u |
| 32 |
.BI "int sd_event_source_set_description(sd_event_source\ *" "source" ", const\ char\ *" "description" ");" |
| 33 |
.HP \w'int\ sd_event_source_get_description('u |
| 34 |
.BI "int sd_event_source_get_description(sd_event_source\ *" "source" ", const\ char\ **" "ret" ");" |
| 35 |
.SH "DESCRIPTION" |
| 36 |
.PP |
| 37 |
\fBsd_event_source_set_description()\fR |
| 38 |
may be used to set an arbitrary descriptive name for the event source object specified as |
| 39 |
\fIsource\fR\&. This name will be used in debugging messages generated by |
| 40 |
\fBsd-event\fR(3) |
| 41 |
for this event source, and may be queried using |
| 42 |
\fBsd_event_source_get_description()\fR |
| 43 |
for debugging purposes\&. The |
| 44 |
\fIdescription\fR |
| 45 |
parameter shall point to a |
| 46 |
\fBNUL\fR\-terminated string or be |
| 47 |
\fBNULL\fR\&. In the latter case, the descriptive name will be unset\&. The string is copied internally, hence the |
| 48 |
\fIdescription\fR |
| 49 |
argument is not referenced after the function returns\&. |
| 50 |
.PP |
| 51 |
\fBsd_event_source_get_description()\fR |
| 52 |
may be used to query the current descriptive name assigned to the event source object |
| 53 |
\fIsource\fR\&. It returns a pointer to the current name in |
| 54 |
\fIret\fR, stored in memory internal to the event source\&. The memory is invalidated when the event source is destroyed or the descriptive name is changed\&. |
| 55 |
.PP |
| 56 |
Event source objects generally have no description set when they are created, except for UNIX signal event sources created with |
| 57 |
\fBsd_event_add_signal\fR(3), whose descriptive name is initialized to the signal\*(Aqs C constant name (e\&.g\&. |
| 58 |
"SIGINT" |
| 59 |
or |
| 60 |
"SIGTERM")\&. |
| 61 |
.SH "RETURN VALUE" |
| 62 |
.PP |
| 63 |
On success, |
| 64 |
\fBsd_event_source_set_description()\fR |
| 65 |
and |
| 66 |
\fBsd_event_source_get_description()\fR |
| 67 |
return a non\-negative integer\&. On failure, they return a negative errno\-style error code\&. |
| 68 |
.SS "Errors" |
| 69 |
.PP |
| 70 |
Returned errors may indicate the following problems: |
| 71 |
.PP |
| 72 |
\fB\-EINVAL\fR |
| 73 |
.RS 4 |
| 74 |
\fIsource\fR |
| 75 |
is not a valid pointer to an |
| 76 |
sd_event_source |
| 77 |
object or the |
| 78 |
\fIdescription\fR |
| 79 |
argument for |
| 80 |
\fBsd_event_source_get_description()\fR |
| 81 |
is |
| 82 |
\fBNULL\fR\&. |
| 83 |
.RE |
| 84 |
.PP |
| 85 |
\fB\-ENOMEM\fR |
| 86 |
.RS 4 |
| 87 |
Not enough memory to copy the name\&. |
| 88 |
.RE |
| 89 |
.PP |
| 90 |
\fB\-ECHILD\fR |
| 91 |
.RS 4 |
| 92 |
The event loop has been created in a different process, library or module instance\&. |
| 93 |
.RE |
| 94 |
.PP |
| 95 |
\fB\-ENXIO\fR |
| 96 |
.RS 4 |
| 97 |
No name was set for the event source\&. |
| 98 |
.RE |
| 99 |
.SH "NOTES" |
| 100 |
.PP |
| 101 |
Functions described here are available as a shared library, which can be compiled against and linked to with the |
| 102 |
\fBlibsystemd\fR\ \&\fBpkg-config\fR(1) |
| 103 |
file\&. |
| 104 |
.PP |
| 105 |
The code described here uses |
| 106 |
\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 |
| 107 |
\fBsetenv\fR(3) |
| 108 |
from a parallel thread\&. It is recommended to only do calls to |
| 109 |
\fBsetenv()\fR |
| 110 |
from an early phase of the program when no other threads have been started\&. |
| 111 |
.SH "HISTORY" |
| 112 |
.PP |
| 113 |
\fBsd_event_source_set_description()\fR |
| 114 |
and |
| 115 |
\fBsd_event_source_get_description()\fR |
| 116 |
were added in version 229\&. |
| 117 |
.SH "SEE ALSO" |
| 118 |
.PP |
| 119 |
\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_userdata\fR(3) |