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

NAME

6       explain_fchdir - explain fchdir(2) errors
7

SYNOPSIS

9       #include <libexplain/fchdir.h>
10       const char *explain_fchdir(int fildes);
11       void   explain_message_fchdir(char   *message,  int  message_size,  int
12       fildes);
13       const char *explain_errno_fchdir(int errnum, int fildes);
14       void explain_message_errno_fchdir(char *message, int message_size,  int
15       errnum, int fildes);
16

DESCRIPTION

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

AUTHOR

165       Written by Peter Miller <pmiller@opensource.org.au>
166
167
168
169                                                             explain_fchdir(3)
Impressum