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