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

NAME

6       explain_accept4 - explain accept4(2) errors
7

SYNOPSIS

9       #include <libexplain/accept4.h>
10       const char *explain_accept4(int fildes, struct sockaddr *sock_addr,
11       socklen_t *sock_addr_size, int flags);
12       const char *explain_errno_accept4(int errnum, int fildes, struct sock‐
13       addr *sock_addr, socklen_t *sock_addr_size, int flags);
14       void explain_message_accept4(char *message, int message_size, int
15       fildes, struct sockaddr *sock_addr, socklen_t *sock_addr_size, int
16       flags);
17       void explain_message_errno_accept4(char *message, int message_size, int
18       errnum, int fildes, struct sockaddr *sock_addr, socklen_t
19       *sock_addr_size, int flags);
20

DESCRIPTION

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

SEE ALSO

233       accept4(2)
234               accept a connection on a socket
235
236       explain_accept4_or_die(3)
237               accept a connection on a socket and report errors
238
240       libexplain version 1.4
241       Copyright (C) 2009 Peter Miller
242
243
244
245                                                            explain_accept4(3)
Impressum