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 <fcntl.h> /* Definition of AT_* constants */
12 #include <unistd.h>
13
14 int readlinkat(int dirfd, const char *pathname,
15 char *buf, size_t bufsiz);
16
18 The readlinkat() system call operates in exactly the same way as read‐
19 link(2), except for the differences described in this manual page.
20
21 If the pathname given in pathname is relative, then it is interpreted
22 relative to the directory referred to by the file descriptor dirfd
23 (rather than relative to the current working directory of the calling
24 process, as is done by readlink(2) for a relative pathname).
25
26 If pathname is relative and dirfd is the special value AT_FDCWD, then
27 pathname is interpreted relative to the current working directory of
28 the calling process (like readlink(2)).
29
30 If pathname is absolute, then dirfd is ignored.
31
33 On success, readlinkat() returns the number of bytes placed in buf. On
34 error, -1 is returned and errno is set to indicate the error.
35
37 The same errors that occur for readlink(2) can also occur for read‐
38 linkat(). The following additional errors can occur for readlinkat():
39
40 EBADF dirfd is not a valid file descriptor.
41
42 ENOTDIR
43 pathname is relative and dirfd is a file descriptor referring to
44 a file other than a directory.
45
47 readlinkat() was added to Linux in kernel 2.6.16.
48
50 POSIX.1-2008.
51
53 See openat(2) for an explanation of the need for readlinkat().
54
56 openat(2), readlink(2), path_resolution(7)
57
59 This page is part of release 3.22 of the Linux man-pages project. A
60 description of the project, and information about reporting bugs, can
61 be found at http://www.kernel.org/doc/man-pages/.
62
63
64
65Linux 2008-08-21 READLINKAT(2)