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