1explain_readlink_or_die(3) Library Functions Manual explain_readlink_or_die(3)
2
3
4
6 explain_readlink_or_die - read value of a symbolic link and report
7 errors
8
10 #include <libexplain/readlink.h>
11 ssize_t explain_readlink_or_die(const char *pathname, char *data,
12 size_t data_size);
13 ssize_t explain_readlink_on_error(const char *pathname, char *data,
14 size_t data_size))
15
17 The explain_readlink_or_die function is used to call the readlink(2)
18 system call. On failure an explanation will be printed to stderr,
19 obtained from the explain_readlink(3) function, and then the process
20 terminates by calling exit(EXIT_FAILURE).
21
22 The explain_readlink_on_error function is used to call the readlink(2)
23 system call. On failure an explanation will be printed to stderr,
24 obtained from the explain_readlink(3) function, but still returns to
25 the caller.
26
27 pathname
28 The pathname, exactly as to be passed to the readlink(2) system
29 call.
30
31 data The data, exactly as to be passed to the readlink(2) system
32 call.
33
34 data_size
35 The data_size, exactly as to be passed to the readlink(2) sys‐
36 tem call.
37
39 The explain_readlink_or_die function only returns on success, see read‐
40 link(2) for more information. On failure, prints an explanation and
41 exits, it does not return.
42
43 The explain_readlink_on_error function always returns the value return
44 by the wrapped readlink(2) system call.
45
47 The explain_readlink_or_die function is intended to be used in a fash‐
48 ion similar to the following example:
49 ssize_t result = explain_readlink_or_die(pathname, data, data_size);
50
52 readlink(2)
53 read value of a symbolic link
54
55 explain_readlink(3)
56 explain readlink(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_readlink_or_die(3)