1READLINKAT(2) Linux Programmer's Manual READLINKAT(2)
2
3
4
6 readlinkat - read value of a symbolic link relative to a directory file
7 descriptor
8
10 #define _ATFILE_SOURCE
11 #include <unistd.h>
12
13 int readlinkat(int dirfd, const char *pathname, char *buf, size_t bufsiz);
14
16 The readlinkat() system call operates in exactly the same way as read‐
17 link(2), except for the differences described in this manual page.
18
19 If the pathname given in pathname is relative, then it is interpreted
20 relative to the directory referred to by the file descriptor dirfd
21 (rather than relative to the current working directory of the calling
22 process, as is done by readlink(2) for a relative pathname).
23
24 If pathname is relative and dirfd is the special value AT_FDCWD, then
25 pathname is interpreted relative to the current working directory of
26 the calling process (like readlink(2)).
27
28 If pathname is absolute, then dirfd is ignored.
29
31 On success, readlinkat() returns 0. On error, -1 is returned and errno
32 is set to indicate the error.
33
35 The same errors that occur for readlink(2) can also occur for read‐
36 linkat(). The following additional errors can occur for readlinkat():
37
38 EBADF dirfd is not a valid file descriptor.
39
40 ENOTDIR
41 pathname is relative and dirfd is a file descriptor referring to
42 a file other than a directory.
43
45 See openat(2) for an explanation of the need for readlinkat().
46
48 This system call is non-standard but is proposed for inclusion in a
49 future revision of POSIX.1.
50
52 readlinkat() was added to Linux in kernel 2.6.16.
53
55 openat(2), path_resolution(2), readlink(2)
56
57
58
59Linux 2.6.16 2006-07-21 READLINKAT(2)