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

NAME

6       explain_execvp - explain execvp(3) errors
7

SYNOPSIS

9       #include <libexplain/execvp.h>
10       const char *explain_execvp(const char *pathname, char *const *argv);
11       const char *explain_errno_execvp(int errnum, const char *pathname, char
12       *const *argv);
13       void explain_message_execvp(char *message, int message_size, const char
14       *pathname, char *const *argv);
15       void  explain_message_errno_execvp(char *message, int message_size, int
16       errnum, const char *pathname, char *const *argv);
17

DESCRIPTION

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

SEE ALSO

193       execvp(3)
194               execute a file
195
196       explain_execvp_or_die(3)
197               execute a file and report errors
198
200       libexplain version 0.40
201       Copyright (C) 2009 Peter Miller
202
203
204
205                                                             explain_execvp(3)
Impressum