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

NAME

6       explain_tcsendbreak - explain tcsendbreak(3) errors
7

SYNOPSIS

9       #include <libexplain/tcsendbreak.h>
10       const char *explain_tcsendbreak(int fildes, int duration);
11       const char *explain_errno_tcsendbreak(int errnum, int fildes, int dura‐
12       tion);
13       void explain_message_tcsendbreak(char *message, int message_size, int
14       fildes, int duration);
15       void explain_message_errno_tcsendbreak(char *message, int message_size,
16       int errnum, int fildes, int duration);
17

DESCRIPTION

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

SEE ALSO

196       tcsendbreak(3)
197               send terminal line break
198
199       explain_tcsendbreak_or_die(3)
200               send terminal line break and report errors
201
203       libexplain version 0.40
204       Copyright (C) 2009 Peter Miller
205
206
207
208                                                        explain_tcsendbreak(3)
Impressum