1explain_pread_or_die(3) Library Functions Manual explain_pread_or_die(3)
2
3
4
6 explain_pread_or_die - seek and read from a file descriptor and report
7 errors
8
10 #include <libexplain/pread.h>
11 ssize_t explain_pread_or_die(int fildes, void *data, size_t data_size,
12 off_t offset);
13 ssize_t explain_pread_on_error(int fildes, void *data, size_t
14 data_size, off_t offset))
15
17 The explain_pread_or_die function is used to call the pread(2) system
18 call. On failure an explanation will be printed to stderr, obtained
19 from the explain_pread(3) function, and then the process terminates by
20 calling exit(EXIT_FAILURE).
21
22 The explain_pread_on_error function is used to call the pread(2) system
23 call. On failure an explanation will be printed to stderr, obtained
24 from the explain_pread(3) function, but still returns to the caller.
25
26 fildes The fildes, exactly as to be passed to the pread(2) system
27 call.
28
29 data The data, exactly as to be passed to the pread(2) system call.
30
31 data_size
32 The data_size, exactly as to be passed to the pread(2) system
33 call.
34
35 offset The offset, exactly as to be passed to the pread(2) system
36 call.
37
39 The explain_pread_or_die function only returns on success, see pread(2)
40 for more information. On failure, prints an explanation and exits, it
41 does not return.
42
43 The explain_pread_on_error function always returns the value return by
44 the wrapped pread(2) system call.
45
47 The explain_pread_or_die function is intended to be used in a fashion
48 similar to the following example:
49 ssize_t result = explain_pread_or_die(fildes, data, data_size, offset);
50
52 pread(2)
53 read from a file descriptor at a given offset
54
55 explain_pread(3)
56 explain pread(2) errors
57
58 exit(2) terminate the calling process
59
61 libexplain version 0.40
62 Copyright (C) 2009 Peter Miller
63
64
65
66 explain_pread_or_die(3)