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