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