1explain_utimes(3) Library Functions Manual explain_utimes(3)
2
3
4
6 explain_utimes - explain utimes(2) errors
7
9 #include <libexplain/utimes.h>
10 const char *explain_utimes(const char *pathname, const struct timeval
11 *data);
12 const char *explain_errno_utimes(int errnum, const char *pathname,
13 const struct timeval *data);
14 void explain_message_utimes(char *message, int message_size, const char
15 *pathname, const struct timeval *data);
16 void explain_message_errno_utimes(char *message, int message_size, int
17 errnum, const char *pathname, const struct timeval *data);
18
20 These functions may be used to obtain explanations for errors returned
21 by the utimes(2) system call.
22
23 explain_utimes
24 const char *explain_utimes(const char *pathname, const struct timeval
25 *data);
26
27 The explain_utimes function is used to obtain an explanation of an
28 error returned by the utimes(2) system call. The least the message will
29 contain is the value of strerror(errno), but usually it will do much
30 better, and indicate the underlying cause in more detail.
31
32 The errno global variable will be used to obtain the error value to be
33 decoded.
34
35 pathname
36 The original pathname, exactly as passed to the utimes(2) sys‐
37 tem call.
38
39 data The original data, exactly as passed to the utimes(2) system
40 call.
41
42 Returns:
43 The message explaining the error. This message buffer is shared
44 by all libexplain functions which do not supply a buffer in
45 their argument list. This will be overwritten by the next call
46 to any libexplain function which shares this buffer, including
47 other threads.
48
49 Note: This function is not thread safe, because it shares a return buf‐
50 fer across all threads, and many other functions in this library.
51
52 Example: This function is intended to be used in a fashion similar to
53 the following example:
54 if (utimes(pathname, data) < 0)
55 {
56 fprintf(stderr, "%s\n", explain_utimes(pathname, data));
57 exit(EXIT_FAILURE);
58 }
59
60 The above code example is available pre‐packaged as the
61 explain_utimes_or_die(3) function.
62
63 explain_errno_utimes
64 const char *explain_errno_utimes(int errnum, const char *pathname,
65 const struct timeval *data);
66
67 The explain_errno_utimes function is used to obtain an explanation of
68 an error returned by the utimes(2) system call. The least the message
69 will contain is the value of strerror(errno), but usually it will do
70 much better, and indicate the underlying cause in more detail.
71
72 errnum The error value to be decoded, usually obtained from the errno
73 global variable just before this function is called. This is
74 necessary if you need to call any code between the system call
75 to be explained and this function, because many libc functions
76 will alter the value of errno.
77
78 pathname
79 The original pathname, exactly as passed to the utimes(2) sys‐
80 tem call.
81
82 data The original data, exactly as passed to the utimes(2) system
83 call.
84
85 Returns:
86 The message explaining the error. This message buffer is shared
87 by all libexplain functions which do not supply a buffer in
88 their argument list. This will be overwritten by the next call
89 to any libexplain function which shares this buffer, including
90 other threads.
91
92 Note: This function is not thread safe, because it shares a return buf‐
93 fer across all threads, and many other functions in this library.
94
95 Example: This function is intended to be used in a fashion similar to
96 the following example:
97 if (utimes(pathname, data) < 0)
98 {
99 int err = errno;
100 fprintf(stderr, "%s\n", explain_errno_utimes(err, pathname,
101 data));
102 exit(EXIT_FAILURE);
103 }
104
105 The above code example is available pre‐packaged as the
106 explain_utimes_or_die(3) function.
107
108 explain_message_utimes
109 void explain_message_utimes(char *message, int message_size, const char
110 *pathname, const struct timeval *data);
111
112 The explain_message_utimes function is used to obtain an explanation of
113 an error returned by the utimes(2) system call. The least the message
114 will contain is the value of strerror(errno), but usually it will do
115 much better, and indicate the underlying cause in more detail.
116
117 The errno global variable will be used to obtain the error value to be
118 decoded.
119
120 message The location in which to store the returned message. If a suit‐
121 able message return buffer is supplied, this function is thread
122 safe.
123
124 message_size
125 The size in bytes of the location in which to store the
126 returned message.
127
128 pathname
129 The original pathname, exactly as passed to the utimes(2) sys‐
130 tem call.
131
132 data The original data, exactly as passed to the utimes(2) system
133 call.
134
135 Example: This function is intended to be used in a fashion similar to
136 the following example:
137 if (utimes(pathname, data) < 0)
138 {
139 char message[3000];
140 explain_message_utimes(message, sizeof(message), pathname,
141 data);
142 fprintf(stderr, "%s\n", message);
143 exit(EXIT_FAILURE);
144 }
145
146 The above code example is available pre‐packaged as the
147 explain_utimes_or_die(3) function.
148
149 explain_message_errno_utimes
150 void explain_message_errno_utimes(char *message, int message_size, int
151 errnum, const char *pathname, const struct timeval *data);
152
153 The explain_message_errno_utimes function is used to obtain an explana‐
154 tion of an error returned by the utimes(2) system call. The least the
155 message will contain is the value of strerror(errno), but usually it
156 will do much better, and indicate the underlying cause in more detail.
157
158 message The location in which to store the returned message. If a suit‐
159 able message return buffer is supplied, this function is thread
160 safe.
161
162 message_size
163 The size in bytes of the location in which to store the
164 returned message.
165
166 errnum The error value to be decoded, usually obtained from the errno
167 global variable just before this function is called. This is
168 necessary if you need to call any code between the system call
169 to be explained and this function, because many libc functions
170 will alter the value of errno.
171
172 pathname
173 The original pathname, exactly as passed to the utimes(2) sys‐
174 tem call.
175
176 data The original data, exactly as passed to the utimes(2) system
177 call.
178
179 Example: This function is intended to be used in a fashion similar to
180 the following example:
181 if (utimes(pathname, data) < 0)
182 {
183 int err = errno;
184 char message[3000];
185 explain_message_errno_utimes(message, sizeof(message), err,
186 pathname, data);
187 fprintf(stderr, "%s\n", message);
188 exit(EXIT_FAILURE);
189 }
190
191 The above code example is available pre‐packaged as the
192 explain_utimes_or_die(3) function.
193
195 utimes(2)
196 change file last access and modification times
197
198 explain_utimes_or_die(3)
199 change file last access and modification times and report
200 errors
201
203 libexplain version 0.40
204 Copyright (C) 2010 Peter Miller
205
206
207
208 explain_utimes(3)