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

NAME

6       explain_rmdir - explain rmdir(2) errors
7

SYNOPSIS

9       #include <libexplain/rmdir.h>
10       const char *explain_rmdir(const char *pathname);
11       const char *explain_errno_rmdir(int errnum, const char  pathname);
12       void  explain_message_rmdir(char *message, int message_size, const char
13       *pathname);
14       void explain_message_errno_rmdir(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 rmdir(2) system call.
20
21   explain_rmdir
22       const char *explain_rmdir(const char *pathname);
23
24       The explain_rmdir function may be used to describe errors  returned  by
25       the  rmdir()  system  call.   The least the message will contain is the
26       value of strerror(errno), but usually it will do much better, and indi‐
27       cate 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 (rmdir(pathname) < 0)
35              {
36                  fprintf(stderr, "%s\n", explain_rmdir(pathname));
37                  exit(EXIT_FAILURE);
38              }
39
40       pathname
41               The original pathname, exactly as passed to the rmdir(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_rmdir
55       const char *explain_errno_rmdir(int errnum, const char *pathname);
56
57       The  explain_errno_rmdir  function  may  be  used  to  describe  errors
58       returned by the rmdir() system call.  The least the message  will  con‐
59       tain is the value of strerror(errnum), but usually it will do much bet‐
60       ter, 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 (rmdir(pathname) < 0)
65              {
66                  int err = errno;
67                  fprintf(stderr, "%s\n", explain_rmdir(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 rmdir(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_rmdir
92       void  explain_message_rmdir(char *message, int message_size, const char
93       *pathname);
94
95       The explain_message_rmdir function  may  be  used  to  describe  errors
96       returned  by  the rmdir() system call.  The least the message will con‐
97       tain is the value of strerror(errno), but usually it will do much  bet‐
98       ter, 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 (rmdir(pathname) < 0)
106              {
107                  char message[3000];
108                  explain_message_rmdir(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 rmdir(2) system
123               call.
124
125   explain_message_errno_rmdir
126       void  explain_message_errno_rmdir(char  *message, int message_size, int
127       errnum, const char *pathname);
128
129       The explain_message_errno_rmdir function may be used to describe errors
130       returned  by  the rmdir() system call.  The least the message will con‐
131       tain is the value of strerror(errnum), but usually it will do much bet‐
132       ter, and indicate the underlying cause in more detail.
133
134       This  function  is intended to be used in a fashion similar to the fol‐
135       lowing example:
136              if (rmdir(pathname) < 0)
137              {
138                  int err = errno;
139                  char message[3000];
140                  explain_message_errno_rmdir(message, sizeof(message), err, pathname);
141                  fprintf(stderr, "%s\n", message);
142                  exit(EXIT_FAILURE);
143              }
144
145       message The location in which to store  the  returned  message.   If  a
146               suitable  message  return  buffer is supplied, this function is
147               thread safe.
148
149       message_size
150               The size in bytes  of  the  location  in  which  to  store  the
151               returned message.
152
153       errnum  The  error value to be decoded, usually obtained from the errno
154               global variable just before this function is called.   This  is
155               necessary  if you need to call any code between the system call
156               to be explained and this function, because many libc  functions
157               will alter the value of errno.
158
159       pathname
160               The original pathname, exactly as passed to the rmdir(2) system
161               call.
162

SEE ALSO

164       rmdir   delete a directory
165
166       explain_rmdir_or_die
167               delete a directory and report errors
168
170       libexplain version 1.4
171       Copyright (C) 2008 Peter Miller
172
173
174
175                                                              explain_rmdir(3)
Impressum