1explain_adjtime(3)         Library Functions Manual         explain_adjtime(3)
2
3
4

NAME

6       explain_adjtime - explain adjtime(2) errors
7

SYNOPSIS

9       #include <libexplain/adjtime.h>
10       const char *explain_adjtime(const struct timeval *delta, struct timeval
11       *olddelta);
12       const char *explain_errno_adjtime(int errnum, const struct timeval
13       *delta, struct timeval *olddelta);
14       void explain_message_adjtime(char *message, int message_size, const
15       struct timeval *delta, struct timeval *olddelta);
16       void explain_message_errno_adjtime(char *message, int message_size, int
17       errnum, const struct timeval *delta, struct timeval *olddelta);
18

DESCRIPTION

20       These  functions may be used to obtain explanations for errors returned
21       by the adjtime(2) system call.
22
23   explain_adjtime
24       const char *explain_adjtime(const struct timeval *delta, struct timeval
25       *olddelta);
26
27       The  explain_adjtime  function  is  used to obtain an explanation of an
28       error returned by the adjtime(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       delta   The  original delta, exactly as passed to the adjtime(2) system
36               call.
37
38       olddelta
39               The original olddelta, exactly as passed to the adjtime(2) sys‐
40               tem 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 (adjtime(delta, olddelta) < 0)
55              {
56                  fprintf(stderr, "%s\n", explain_adjtime(delta, olddelta));
57                  exit(EXIT_FAILURE);
58              }
59
60       The  above  code  example is available pre‐packaged as the explain_adj‐
61       time_or_die(3) function.
62
63   explain_errno_adjtime
64       const char *explain_errno_adjtime(int errnum, const struct timeval
65       *delta, struct timeval *olddelta);
66
67       The  explain_errno_adjtime function is used to obtain an explanation of
68       an error returned by the adjtime(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       delta   The original delta, exactly as passed to the adjtime(2)  system
79               call.
80
81       olddelta
82               The original olddelta, exactly as passed to the adjtime(2) sys‐
83               tem 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 (adjtime(delta, olddelta) < 0)
98              {
99                  int err = errno;
100                  fprintf(stderr, "%s\n", explain_errno_adjtime(err, delta,
101                  olddelta));
102                  exit(EXIT_FAILURE);
103              }
104
105       The  above  code  example is available pre‐packaged as the explain_adj‐
106       time_or_die(3) function.
107
108   explain_message_adjtime
109       void explain_message_adjtime(char *message, int message_size, const
110       struct timeval *delta, struct timeval *olddelta);
111
112       The  explain_message_adjtime  function is used to obtain an explanation
113       of an error returned by the adjtime(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       delta   The original delta, exactly as passed to the adjtime(2)  system
129               call.
130
131       olddelta
132               The original olddelta, exactly as passed to the adjtime(2) sys‐
133               tem call.
134
135       Example: This function is intended to be used in a fashion  similar  to
136       the following example:
137              if (adjtime(delta, olddelta) < 0)
138              {
139                  char message[3000];
140                  explain_message_adjtime(message, sizeof(message), delta,
141                  olddelta);
142                  fprintf(stderr, "%s\n", message);
143                  exit(EXIT_FAILURE);
144              }
145
146       The above code example is available pre‐packaged  as  the  explain_adj‐
147       time_or_die(3) function.
148
149   explain_message_errno_adjtime
150       void explain_message_errno_adjtime(char *message, int message_size, int
151       errnum, const struct timeval *delta, struct timeval *olddelta);
152
153       The explain_message_errno_adjtime function is used to obtain an  expla‐
154       nation  of  an  error returned by the adjtime(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       delta   The  original delta, exactly as passed to the adjtime(2) system
174               call.
175
176       olddelta
177               The original olddelta, exactly as passed to the adjtime(2) sys‐
178               tem call.
179
180       Example:  This  function is intended to be used in a fashion similar to
181       the following example:
182              if (adjtime(delta, olddelta) < 0)
183              {
184                  int err = errno;
185                  char message[3000];
186                  explain_message_errno_adjtime(message, sizeof(message), err,
187                  delta, olddelta);
188                  fprintf(stderr, "%s\n", message);
189                  exit(EXIT_FAILURE);
190              }
191
192       The  above  code  example is available pre‐packaged as the explain_adj‐
193       time_or_die(3) function.
194

SEE ALSO

196       adjtime(2)
197               smoothly tune kernel clock
198
199       explain_adjtime_or_die(3)
200               smoothly tune kernel clock and report errors
201
203       libexplain version 1.4
204       Copyright (C) 2009 Peter Miller
205
206
207
208                                                            explain_adjtime(3)
Impressum