1explain_openat_or_die(3) Library Functions Manual explain_openat_or_die(3)
2
3
4
6 explain_openat_or_die - open a file relative to a dir fd and report
7 errors
8
10 #include <libexplain/openat.h>
11 int explain_openat_or_die(int fildes, const char *pathname, int flags,
12 mode_t mode);
13 int explain_openat_on_error(int fildes, const char *pathname, int
14 flags, mode_t mode);
15
17 The explain_openat_or_die function is used to call the openat(2) system
18 call. On failure an explanation will be printed to stderr, obtained
19 from the explain_openat(3) function, and then the process terminates by
20 calling exit(EXIT_FAILURE).
21
22 The explain_openat_on_error function is used to call the openat(2) sys‐
23 tem call. On failure an explanation will be printed to stderr, obtained
24 from the explain_openat(3) function, but still returns to the caller.
25
26 fildes The fildes, exactly as to be passed to the openat(2) system
27 call.
28
29 pathname
30 The pathname, exactly as to be passed to the openat(2) system
31 call.
32
33 flags The flags, exactly as to be passed to the openat(2) system
34 call.
35
36 mode The mode, exactly as to be passed to the openat(2) system call.
37
39 The explain_openat_or_die function only returns on success, see ope‐
40 nat(2) for more information. On failure, prints an explanation and
41 exits, it does not return.
42
43 The explain_openat_on_error function always returns the value return by
44 the wrapped openat(2) system call.
45
47 The explain_openat_or_die function is intended to be used in a fashion
48 similar to the following example:
49 int result = explain_openat_or_die(fildes, pathname, flags, mode);
50
52 openat(2)
53 open a file relative to a directory file descriptor
54
55 explain_openat(3)
56 explain openat(2) errors
57
58 exit(2) terminate the calling process
59
61 libexplain version 1.4
62 Copyright (C) 2013 Peter Miller
63
64
65
66 explain_openat_or_die(3)