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

NAME

6       explain_mkdir - explain mkdir(2) errors
7

SYNOPSIS

9       #include <libexplain/mkdir.h>
10       const char *explain_mkdir(const char *pathname);
11       const char *explain_errno_mkdir(int errnum, const char *pathname);
12       void  explain_message_mkdir(char *message, int message_size, const char
13       *pathname);
14       void explain_message_errno_mkdir(char *message, int  message_size,  int
15       errnum, const char *pathname);
16

DESCRIPTION

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

SEE ALSO

165       mkdir(2)
166               create a directory
167
168       explain_mkdir_or_die(3)
169               create a directory and report errors
170
172       libexplain version 0.40
173       Copyright (C) 2008 Peter Miller
174
175
176
177                                                              explain_mkdir(3)
Impressum