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

NAME

6       explain_mknod - explain mknod(2) errors
7

SYNOPSIS

9       #include <libexplain/mknod.h>
10       const char *explain_mknod(const char *pathname, mode_t mode, dev_t
11       dev);
12       const char *explain_errno_mknod(int errnum, const char *pathname,
13       mode_t mode, dev_t dev);
14       void explain_message_mknod(char *message, int message_size, const char
15       *pathname, mode_t mode, dev_t dev);
16       void explain_message_errno_mknod(char *message, int message_size, int
17       errnum, const char *pathname, mode_t mode, dev_t dev);
18

DESCRIPTION

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

SEE ALSO

207       mknod(2)
208               create a special or ordinary file
209
210       explain_mknod_or_die(3)
211               create a special or ordinary file and report errors
212
214       libexplain version 1.4
215       Copyright (C) 2009 Peter Miller
216
217
218
219                                                              explain_mknod(3)
Impressum