1explain_read_or_die(3) Library Functions Manual explain_read_or_die(3)
2
3
4
6 explain_read_or_die - read from a file descriptor and report errors
7
9 #include <libexplain/read.h>
10 long explain_read_or_die(int fildes, const void *data, long data_size);
11
13 The explain_read_or_die function is used to call the read(2) system
14 call. On failure an explanation will be printed to stderr, obtained
15 from explain_read(3), and then the process terminates by calling
16 exit(EXIT_FAILURE).
17
18 This function is intended to be used in a fashion similar to the fol‐
19 lowing example:
20 explain_read_or_die(fildes, data, data_size);
21
22 fildes The fildes, exactly as to be passed to the read(2) system call.
23
24 data The data, exactly as to be passed to the read(2) system call.
25
26 data_size
27 The data_size, exactly as to be passed to the read(2) system
28 call.
29
30 Returns:
31 This function only returns on success. On failure, prints an
32 explanation and exits.
33
35 read(2) read from a file descriptor
36
37 explain_read(3)
38 explain read(2) errors
39
40 exit(2) terminate the calling process
41
43 libexplain version 1.4
44 Copyright (C) 2008 Peter Miller
45
46
47
48 explain_read_or_die(3)