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

NAME

6       explain_pathconf - explain pathconf(3) errors
7

SYNOPSIS

9       #include <libexplain/pathconf.h>
10       const char *explain_pathconf(const char *pathname, int name);
11       const  char  *explain_errno_pathconf(int  errnum, const char *pathname,
12       int name);
13       void explain_message_pathconf(char *message,  int  message_size,  const
14       char *pathname, int name);
15       void  explain_message_errno_pathconf(char  *message,  int message_size,
16       int errnum, const char *pathname, int name);
17

DESCRIPTION

19       These functions may be used to obtain explanations for errors  returned
20       by the pathconf(3) system call.
21
22   explain_pathconf
23       const char *explain_pathconf(const char *pathname, int name);
24
25       The  explain_pathconf  function  is used to obtain an explanation of an
26       error returned by the pathconf(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 (pathconf(pathname, name) < 0)
36              {
37                  fprintf(stderr, "%s\n", explain_pathconf(pathname, name));
38                  exit(EXIT_FAILURE);
39              }
40
41       The above code example is available pre‐packaged as  the  explain_path‐
42       conf_or_die(3) function.
43
44       pathname
45               The  original  pathname,  exactly  as passed to the pathconf(3)
46               system call.
47
48       name    The original name, exactly as passed to the pathconf(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_pathconf
62       const char *explain_errno_pathconf(int errnum,  const  char  *pathname,
63       int name);
64
65       The explain_errno_pathconf function is used to obtain an explanation of
66       an error returned by the pathconf(3) system call.  The least  the  mes‐
67       sage will contain is the value of strerror(errnum), but usually it will
68       do 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 (pathconf(pathname, name) < 0)
73              {
74                  int err = errno;
75                  fprintf(stderr, "%s\n", explain_errno_pathconf(err, pathname, name));
76                  exit(EXIT_FAILURE);
77              }
78
79       The  above  code example is available pre‐packaged as the explain_path‐
80       conf_or_die(3) function.
81
82       errnum  The error value to be decoded, usually obtained from the  errno
83               global  variable  just before this function is called.  This is
84               necessary if you need to call any code between the system  call
85               to  be explained and this function, because many libc functions
86               will alter the value of errno.
87
88       pathname
89               The original pathname, exactly as  passed  to  the  pathconf(3)
90               system call.
91
92       name    The  original name, exactly as passed to the pathconf(3) system
93               call.
94
95       Returns:
96               The message explaining  the  error.   This  message  buffer  is
97               shared by all libexplain functions which do not supply a buffer
98               in their argument list.  This will be overwritten by  the  next
99               call  to  any  libexplain  function  which  shares this buffer,
100               including other threads.
101
102       Note: This function is not thread safe, because it shares a return buf‐
103       fer across all threads, and many other functions in this library.
104
105   explain_message_pathconf
106       void  explain_message_pathconf(char  *message,  int message_size, const
107       char *pathname, int name);
108
109       The explain_message_pathconf function may be used to  obtain an  expla‐
110       nation  of an error returned by the pathconf(3) system call.  The least
111       the message will contain is the value of strerror(errno),  but  usually
112       it  will  do  much  better,  and  indicate the underlying cause in more
113       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 (pathconf(pathname, name) < 0)
121              {
122                  char message[3000];
123                  explain_message_pathconf(message, sizeof(message), pathname, name);
124                  fprintf(stderr, "%s\n", message);
125                  exit(EXIT_FAILURE);
126              }
127
128       The above code example is available pre‐packaged as  the  explain_path‐
129       conf_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  pathconf(3)
141               system call.
142
143       name    The  original name, exactly as passed to the pathconf(3) system
144               call.
145
146   explain_message_errno_pathconf
147       void explain_message_errno_pathconf(char  *message,  int  message_size,
148       int errnum, const char *pathname, int name);
149
150       The  explain_message_errno_pathconf  function  may be used to obtain an
151       explanation of an error returned by the pathconf(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 (pathconf(pathname, name) < 0)
159              {
160                  int err = errno;
161                  char message[3000];
162                  explain_message_errno_pathconf(message, sizeof(message), err,
163                      pathname, name);
164                  fprintf(stderr, "%s\n", message);
165                  exit(EXIT_FAILURE);
166              }
167
168       The above code example is available pre‐packaged as  the  explain_path‐
169       conf_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  pathconf(3)
187               system call.
188
189       name    The  original name, exactly as passed to the pathconf(3) system
190               call.
191

SEE ALSO

193       pathconf(3)
194               get configuration values for files
195
196       explain_pathconf_or_die(3)
197               get configuration values for files and report errors
198
200       libexplain version 0.40
201       Copyright (C) 2008 Peter Miller
202
203
204
205                                                           explain_pathconf(3)
Impressum