1explain_sleep_or_die(3) Library Functions Manual explain_sleep_or_die(3)
2
3
4
6 explain_sleep_or_die - Sleep for a number of seconds and report errors
7
9 #include <libexplain/sleep.h>
10 unsigned int explain_sleep_or_die(unsigned int seconds);
11 unsigned int explain_sleep_on_error(unsigned int seconds);
12
14 The explain_sleep_or_die function is used to call the sleep(3) system
15 call. On failure an explanation will be printed to stderr, obtained
16 from the explain_sleep(3) function, and then the process terminates by
17 calling exit(EXIT_FAILURE).
18
19 The explain_sleep_on_error function is used to call the sleep(3) system
20 call. On failure an explanation will be printed to stderr, obtained
21 from the explain_sleep(3) function, but still returns to the caller.
22
23 seconds The seconds, exactly as to be passed to the sleep(3) system
24 call.
25
27 The explain_sleep_or_die function only returns on success, see sleep(3)
28 for more information. On failure, prints an explanation and exits, it
29 does not return.
30
31 The explain_sleep_on_error function always returns the value return by
32 the wrapped sleep(3) system call.
33
35 The explain_sleep_or_die function is intended to be used in a fashion
36 similar to the following example:
37 unsigned int result = explain_sleep_or_die(seconds);
38
40 sleep(3)
41 Sleep for the specified number of seconds
42
43 explain_sleep(3)
44 explain sleep(3) errors
45
46 exit(2) terminate the calling process
47
49 libexplain version 1.4
50 Copyright (C) 2013 Peter Miller
51
52
53
54 explain_sleep_or_die(3)