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