1explain_utimens(3) Library Functions Manual explain_utimens(3)
2
3
4
6 explain_utimens - explain utimens(2) errors
7
9 #include <libexplain/utimens.h>
10 const char *explain_utimens(const char *pathname, const struct timespec
11 *data);
12 const char *explain_errno_utimens(int errnum, const char *pathname,
13 const struct timespec *data);
14 void explain_message_utimens(char *message, int message_size, const
15 char *pathname, const struct timespec *data);
16 void explain_message_errno_utimens(char *message, int message_size, int
17 errnum, const char *pathname, const struct timespec *data);
18
20 These functions may be used to obtain explanations for errors returned
21 by the utimens(2) system call.
22
23 explain_utimens
24 const char *explain_utimens(const char *pathname, const struct timespec
25 *data);
26
27 The explain_utimens function is used to obtain an explanation of an
28 error returned by the utimens(2) system call. The least the message
29 will contain is the value of strerror(errno), but usually it will do
30 much 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 utimens(2) sys‐
37 tem call.
38
39 data The original data, exactly as passed to the utimens(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 (utimens(pathname, data) < 0)
55 {
56 fprintf(stderr, "%s\n", explain_utimens(pathname, data));
57 exit(EXIT_FAILURE);
58 }
59
60 The above code example is available pre-packaged as the explain_uti‐
61 mens_or_die(3) function.
62
63 explain_errno_utimens
64 const char *explain_errno_utimens(int errnum, const char *pathname,
65 const struct timespec *data);
66
67 The explain_errno_utimens function is used to obtain an explanation of
68 an error returned by the utimens(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 utimens(2) sys‐
80 tem call.
81
82 data The original data, exactly as passed to the utimens(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 (utimens(pathname, data) < 0)
98 {
99 int err = errno;
100 fprintf(stderr, "%s\n", explain_errno_utimens(err, pathname,
101 data));
102 exit(EXIT_FAILURE);
103 }
104
105 The above code example is available pre-packaged as the explain_uti‐
106 mens_or_die(3) function.
107
108 explain_message_utimens
109 void explain_message_utimens(char *message, int message_size, const
110 char *pathname, const struct timespec *data);
111
112 The explain_message_utimens function is used to obtain an explanation
113 of an error returned by the utimens(2) system call. The least the mes‐
114 sage will contain is the value of strerror(errno), but usually it will
115 do 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 utimens(2) sys‐
130 tem call.
131
132 data The original data, exactly as passed to the utimens(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 (utimens(pathname, data) < 0)
138 {
139 char message[3000];
140 explain_message_utimens(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 explain_uti‐
147 mens_or_die(3) function.
148
149 explain_message_errno_utimens
150 void explain_message_errno_utimens(char *message, int message_size, int
151 errnum, const char *pathname, const struct timespec *data);
152
153 The explain_message_errno_utimens function is used to obtain an expla‐
154 nation of an error returned by the utimens(2) system call. The least
155 the message will contain is the value of strerror(errno), but usually
156 it will do much better, and indicate the underlying cause in more
157 detail.
158
159 message The location in which to store the returned message. If a suit‐
160 able message return buffer is supplied, this function is thread
161 safe.
162
163 message_size
164 The size in bytes of the location in which to store the
165 returned message.
166
167 errnum The error value to be decoded, usually obtained from the errno
168 global variable just before this function is called. This is
169 necessary if you need to call any code between the system call
170 to be explained and this function, because many libc functions
171 will alter the value of errno.
172
173 pathname
174 The original pathname, exactly as passed to the utimens(2) sys‐
175 tem call.
176
177 data The original data, exactly as passed to the utimens(2) system
178 call.
179
180 Example: This function is intended to be used in a fashion similar to
181 the following example:
182 if (utimens(pathname, data) < 0)
183 {
184 int err = errno;
185 char message[3000];
186 explain_message_errno_utimens(message, sizeof(message), err,
187 pathname, data);
188 fprintf(stderr, "%s\n", message);
189 exit(EXIT_FAILURE);
190 }
191
192 The above code example is available pre-packaged as the explain_uti‐
193 mens_or_die(3) function.
194
196 utimens(2)
197 change file last access and modification times
198
199 explain_utimens_or_die(3)
200 change file last access and modification times and report
201 errors
202
204 libexplain version 1.4
205 Copyright (C) 2012 Peter Miller
206
207
208
209 explain_utimens(3)