]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/readlinkat.2
ldd.1, arch_prctl.2, faccessat.2, fchmodat.2, fchownat.2, flock.2, futimesat.2, getcp...
[thirdparty/man-pages.git] / man2 / readlinkat.2
CommitLineData
c07981e7
MK
1.\" This manpage is Copyright (C) 2006, Michael Kerrisk
2.\"
93015253 3.\" %%%LICENSE_START(VERBATIM)
c07981e7
MK
4.\" Permission is granted to make and distribute verbatim copies of this
5.\" manual provided the copyright notice and this permission notice are
6.\" preserved on all copies.
7.\"
8.\" Permission is granted to copy and distribute modified versions of this
9.\" manual under the conditions for verbatim copying, provided that the
10.\" entire resulting derived work is distributed under the terms of a
11.\" permission notice identical to this one.
c13182ef 12.\"
c07981e7
MK
13.\" Since the Linux kernel and libraries are constantly changing, this
14.\" manual page may be incorrect or out-of-date. The author(s) assume no
15.\" responsibility for errors or omissions, or for damages resulting from
16.\" the use of the information contained herein. The author(s) may not
17.\" have taken the same level of care in the production of this manual,
18.\" which is licensed free of charge, as they might when working
19.\" professionally.
c13182ef 20.\"
c07981e7
MK
21.\" Formatted or processed versions of this manual, if unaccompanied by
22.\" the source, must acknowledge the copyright and authors of this work.
4b72fb64 23.\" %%%LICENSE_END
c07981e7 24.\"
c95b6ae1 25.TH READLINKAT 2 2012-05-04 "Linux" "Linux Programmer's Manual"
c07981e7 26.SH NAME
c13182ef 27readlinkat \- read value of a symbolic link relative to
35478399 28a directory file descriptor
c07981e7
MK
29.SH SYNOPSIS
30.nf
b3f30a82 31.B #include <fcntl.h> /* Definition of AT_* constants */
c07981e7
MK
32.B #include <unistd.h>
33.sp
52b78335
MK
34.BI "int readlinkat(int " dirfd ", const char *" pathname ,
35.BI " char *" buf ", size_t " bufsiz );
c07981e7 36.fi
7cc796ee
MK
37.sp
38.in -4n
39Feature Test Macro Requirements for glibc (see
40.BR feature_test_macros (7)):
41.in
42.sp
43.BR readlinkat ():
37877088
MK
44.PD 0
45.ad l
46.RS 4
47.TP 4
48Since glibc 2.10:
49_XOPEN_SOURCE\ >=\ 700 || _POSIX_C_SOURCE\ >=\ 200809L
50.TP
7cc796ee
MK
51Before glibc 2.10:
52_ATFILE_SOURCE
37877088
MK
53.RE
54.ad
55.PD
c07981e7
MK
56.SH DESCRIPTION
57The
58.BR readlinkat ()
59system call operates in exactly the same way as
60.BR readlink (2),
61except for the differences described in this manual page.
62
c13182ef 63If the pathname given in
1343b604 64.I pathname
c07981e7
MK
65is relative, then it is interpreted relative to the directory
66referred to by the file descriptor
0daa9e92 67.I dirfd
c13182ef 68(rather than relative to the current working directory of
c07981e7
MK
69the calling process, as is done by
70.BR readlink (2)
71for a relative pathname).
72
1343b604
MK
73If
74.I pathname
c13182ef 75is relative and
c07981e7
MK
76.I dirfd
77is the special value
78.BR AT_FDCWD ,
79then
1343b604 80.I pathname
c13182ef 81is interpreted relative to the current working
c07981e7
MK
82directory of the calling process (like
83.BR readlink (2)).
84
1343b604 85If
0daa9e92 86.I pathname
c13182ef
MK
87is absolute, then
88.I dirfd
c07981e7 89is ignored.
47297adb 90.SH RETURN VALUE
c07981e7 91On success,
c13182ef 92.BR readlinkat ()
aae1ff18
MK
93returns the number of bytes placed in
94.IR buf .
c07981e7
MK
95On error, \-1 is returned and
96.I errno
97is set to indicate the error.
98.SH ERRORS
99The same errors that occur for
100.BR readlink (2)
101can also occur for
102.BR readlinkat ().
c13182ef 103The following additional errors can occur for
c07981e7
MK
104.BR readlinkat ():
105.TP
106.B EBADF
107.I dirfd
108is not a valid file descriptor.
109.TP
110.B ENOTDIR
1343b604 111.I pathname
b328773d 112is relative and
c07981e7
MK
113.I dirfd
114is a file descriptor referring to a file other than a directory.
a1d5f77c
MK
115.SH VERSIONS
116.BR readlinkat ()
c95b6ae1
MK
117was added to Linux in kernel 2.6.16;
118library support was added to glibc in version 2.4.
47297adb 119.SH CONFORMING TO
5144e45f 120POSIX.1-2008.
c07981e7
MK
121.SH NOTES
122See
123.BR openat (2)
124for an explanation of the need for
125.BR readlinkat ().
47297adb 126.SH SEE ALSO
c07981e7 127.BR openat (2),
ad7cc990
MK
128.BR readlink (2),
129.BR path_resolution (7)