1explain_timerfd_create(3) Library Functions Manual explain_timerfd_create(3)
2
3
4
6 explain_timerfd_create - explain timerfd_create(2) errors
7
9 #include <libexplain/timerfd_create.h>
10 const char *explain_timerfd_create(int clockid, int flags);
11 const char *explain_errno_timerfd_create(int errnum, int clockid, int
12 flags);
13 void explain_message_timerfd_create(char *message, int message_size,
14 int clockid, int flags);
15 void explain_message_errno_timerfd_create(char *message, int mes‐
16 sage_size, int errnum, int clockid, int flags);
17
19 These functions may be used to obtain explanations for errors returned
20 by the timerfd_create(2) system call.
21
22 explain_timerfd_create
23 const char *explain_timerfd_create(int clockid, int flags);
24
25 The explain_timerfd_create function is used to obtain an explanation of
26 an error returned by the timerfd_create(2) system call. The least the
27 message will contain is the value of strerror(errno), but usually it
28 will do much better, and indicate the underlying cause in more detail.
29
30 The errno global variable will be used to obtain the error value to be
31 decoded.
32
33 clockid The original clockid, exactly as passed to the timerfd_cre‐
34 ate(2) system call.
35
36 flags The original flags, exactly as passed to the timerfd_create(2)
37 system call.
38
39 Returns:
40 The message explaining the error. This message buffer is shared
41 by all libexplain functions which do not supply a buffer in
42 their argument list. This will be overwritten by the next call
43 to any libexplain function which shares this buffer, including
44 other threads.
45
46 Note: This function is not thread safe, because it shares a return buf‐
47 fer across all threads, and many other functions in this library.
48
49 Example: This function is intended to be used in a fashion similar to
50 the following example:
51 int result = timerfd_create(clockid, flags);
52 if (result < 0)
53 {
54 fprintf(stderr, "%s\n", explain_timerfd_create(clockid,
55 flags));
56 exit(EXIT_FAILURE);
57 }
58
59 The above code example is available pre‐packaged as the
60 explain_timerfd_create_or_die(3) function.
61
62 explain_errno_timerfd_create
63 const char *explain_errno_timerfd_create(int errnum, int clockid, int
64 flags);
65
66 The explain_errno_timerfd_create function is used to obtain an explana‐
67 tion of an error returned by the timerfd_create(2) system call. The
68 least the message will contain is the value of strerror(errno), but
69 usually it will do much better, and indicate the underlying cause in
70 more detail.
71
72 errnum The error value to be decoded, usually obtained from the errno
73 global variable just before this function is called. This is
74 necessary if you need to call any code between the system call
75 to be explained and this function, because many libc functions
76 will alter the value of errno.
77
78 clockid The original clockid, exactly as passed to the timerfd_cre‐
79 ate(2) system call.
80
81 flags The original flags, exactly as passed to the timerfd_create(2)
82 system call.
83
84 Returns:
85 The message explaining the error. This message buffer is shared
86 by all libexplain functions which do not supply a buffer in
87 their argument list. This will be overwritten by the next call
88 to any libexplain function which shares this buffer, including
89 other threads.
90
91 Note: This function is not thread safe, because it shares a return buf‐
92 fer across all threads, and many other functions in this library.
93
94 Example: This function is intended to be used in a fashion similar to
95 the following example:
96 int result = timerfd_create(clockid, flags);
97 if (result < 0)
98 {
99 int err = errno;
100 fprintf(stderr, "%s\n", explain_errno_timerfd_create(err,
101 clockid, flags));
102 exit(EXIT_FAILURE);
103 }
104
105 The above code example is available pre‐packaged as the
106 explain_timerfd_create_or_die(3) function.
107
108 explain_message_timerfd_create
109 void explain_message_timerfd_create(char *message, int message_size,
110 int clockid, int flags);
111
112 The explain_message_timerfd_create function is used to obtain an expla‐
113 nation of an error returned by the timerfd_create(2) system call. The
114 least the message will contain is the value of strerror(errno), but
115 usually it will do much better, and indicate the underlying cause in
116 more detail.
117
118 The errno global variable will be used to obtain the error value to be
119 decoded.
120
121 message The location in which to store the returned message. If a suit‐
122 able message return buffer is supplied, this function is thread
123 safe.
124
125 message_size
126 The size in bytes of the location in which to store the
127 returned message.
128
129 clockid The original clockid, exactly as passed to the timerfd_cre‐
130 ate(2) system call.
131
132 flags The original flags, exactly as passed to the timerfd_create(2)
133 system call.
134
135 Example: This function is intended to be used in a fashion similar to
136 the following example:
137 int result = timerfd_create(clockid, flags);
138 if (result < 0)
139 {
140 char message[3000];
141 explain_message_timerfd_create(message, sizeof(message),
142 clockid, flags);
143 fprintf(stderr, "%s\n", message);
144 exit(EXIT_FAILURE);
145 }
146
147 The above code example is available pre‐packaged as the
148 explain_timerfd_create_or_die(3) function.
149
150 explain_message_errno_timerfd_create
151 void explain_message_errno_timerfd_create(char *message, int mes‐
152 sage_size, int errnum, int clockid, int flags);
153
154 The explain_message_errno_timerfd_create function is used to obtain an
155 explanation of an error returned by the timerfd_create(2) system call.
156 The least the message will contain is the value of strerror(errno), but
157 usually it will do much better, and indicate the underlying cause in
158 more detail.
159
160 message The location in which to store the returned message. If a suit‐
161 able message return buffer is supplied, this function is thread
162 safe.
163
164 message_size
165 The size in bytes of the location in which to store the
166 returned message.
167
168 errnum The error value to be decoded, usually obtained from the errno
169 global variable just before this function is called. This is
170 necessary if you need to call any code between the system call
171 to be explained and this function, because many libc functions
172 will alter the value of errno.
173
174 clockid The original clockid, exactly as passed to the timerfd_cre‐
175 ate(2) system call.
176
177 flags The original flags, exactly as passed to the timerfd_create(2)
178 system call.
179
180 Example: This function is intended to be used in a fashion similar to
181 the following example:
182 int result = timerfd_create(clockid, flags);
183 if (result < 0)
184 {
185 int err = errno;
186 char message[3000];
187 explain_message_errno_timerfd_create(message, sizeof(mes‐
188 sage), err, clockid, flags);
189 fprintf(stderr, "%s\n", message);
190 exit(EXIT_FAILURE);
191 }
192
193 The above code example is available pre‐packaged as the
194 explain_timerfd_create_or_die(3) function.
195
197 timerfd_create(2)
198 timers that notify via file descriptors
199
200 explain_timerfd_create_or_die(3)
201 timers that notify via file descriptors and report errors
202
204 libexplain version 1.4
205 Copyright (C) 2009 Peter Miller
206
207
208
209 explain_timerfd_create(3)