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