1explain_nanosleep_or_die(3)Library Functions Manualexplain_nanosleep_or_die(3)
2
3
4
6 explain_nanosleep_or_die - high‐resolution sleep and report errors
7
9 #include <libexplain/nanosleep.h>
10 void explain_nanosleep_or_die(const struct timespec *req, struct time‐
11 spec *rem);
12 int explain_nanosleep_on_error(const struct timespec *req, struct time‐
13 spec *rem);
14
16 The explain_nanosleep_or_die function is used to call the nanosleep(2)
17 system call. On failure an explanation will be printed to stderr,
18 obtained from the explain_nanosleep(3) function, and then the process
19 terminates by calling exit(EXIT_FAILURE).
20
21 The explain_nanosleep_on_error function is used to call the
22 nanosleep(2) system call. On failure an explanation will be printed to
23 stderr, obtained from the explain_nanosleep(3) function, but still
24 returns to the caller.
25
26 req The req, exactly as to be passed to the nanosleep(2) system
27 call.
28
29 rem The rem, exactly as to be passed to the nanosleep(2) system
30 call.
31
33 The explain_nanosleep_or_die function only returns on success, see
34 nanosleep(2) for more information. On failure, prints an explanation
35 and exits, it does not return.
36
37 The explain_nanosleep_on_error function always returns the value return
38 by the wrapped nanosleep(2) system call.
39
41 The explain_nanosleep_or_die function is intended to be used in a fash‐
42 ion similar to the following example:
43 explain_nanosleep_or_die(req, rem);
44
46 nanosleep(2)
47 high‐resolution sleep
48
49 explain_nanosleep(3)
50 explain nanosleep(2) errors
51
52 exit(2) terminate the calling process
53
55 libexplain version 1.4
56 Copyright (C) 2013 Peter Miller
57
58
59
60 explain_nanosleep_or_die(3)