1explain_signalfd(3)        Library Functions Manual        explain_signalfd(3)
2
3
4

NAME

6       explain_signalfd - explain signalfd(2) errors
7

SYNOPSIS

9       #include <libexplain/signalfd.h>
10       const char *explain_signalfd(int fildes, const sigset_t *mask, int
11       flags);
12       const char *explain_errno_signalfd(int errnum, int fildes, const
13       sigset_t *mask, int flags);
14       void explain_message_signalfd(char *message, int message_size, int
15       fildes, const sigset_t *mask, int flags);
16       void explain_message_errno_signalfd(char *message, int message_size,
17       int errnum, int fildes, const sigset_t *mask, int flags);
18

DESCRIPTION

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

SEE ALSO

209       signalfd(2)
210               create a file descriptor for accepting signals
211
212       explain_signalfd_or_die(3)
213               create  a  file  descriptor  for  accepting  signals and report
214               errors
215
217       libexplain version 0.40
218       Copyright (C) 2009 Peter Miller
219
220
221
222                                                           explain_signalfd(3)
Impressum