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

NAME

6       explain_tcdrain - explain tcdrain(3) errors
7

SYNOPSIS

9       #include <libexplain/tcdrain.h>
10       const char *explain_tcdrain(int fildes);
11       const char *explain_errno_tcdrain(int errnum, int fildes);
12       void explain_message_tcdrain(char *message, int message_size, int
13       fildes);
14       void explain_message_errno_tcdrain(char *message, int message_size, int
15       errnum, int fildes);
16

DESCRIPTION

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

SEE ALSO

174       tcdrain(3)
175               Execute tcdrain(3)
176
177       explain_tcdrain_or_die(3)
178               Execute tcdrain(3) and report errors
179
181       libexplain version 1.4
182       Copyright (C) 2009 Peter Miller,,,
183
184
185
186                                                            explain_tcdrain(3)
Impressum