summaryrefslogtreecommitdiffstats
path: root/lib/libc/sys/readlink.2
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2008-04-16 13:03:12 +0000
committerkib <kib@FreeBSD.org>2008-04-16 13:03:12 +0000
commit2e4b86adc7ebc6a6f218f0ad58bf2e06954acd0d (patch)
tree03acdbf3f7e88a48d315dac76d504fadeac388b0 /lib/libc/sys/readlink.2
parent52243403eb48561abd7b33995f5a4be6a56fa1f0 (diff)
downloadFreeBSD-src-2e4b86adc7ebc6a6f218f0ad58bf2e06954acd0d.zip
FreeBSD-src-2e4b86adc7ebc6a6f218f0ad58bf2e06954acd0d.tar.gz
Man pages for the openat(2), fexecve(2) and related syscalls.
Reviewed by: ru
Diffstat (limited to 'lib/libc/sys/readlink.2')
-rw-r--r--lib/libc/sys/readlink.262
1 files changed, 60 insertions, 2 deletions
diff --git a/lib/libc/sys/readlink.2 b/lib/libc/sys/readlink.2
index 1c2593a..4b24052 100644
--- a/lib/libc/sys/readlink.2
+++ b/lib/libc/sys/readlink.2
@@ -28,11 +28,12 @@
.\" @(#)readlink.2 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd February 26, 2008
+.Dd April 10, 2008
.Dt READLINK 2
.Os
.Sh NAME
-.Nm readlink
+.Nm readlink ,
+.Nm readlinkat
.Nd read value of a symbolic link
.Sh LIBRARY
.Lb libc
@@ -40,6 +41,10 @@
.In unistd.h
.Ft ssize_t
.Fn readlink "const char *restrict path" "char *restrict buf" "size_t bufsiz"
+.Ft ssize_t
+.Fo readlinkat
+.Fa "int fd" "const char *restrict path" "char *restrict buf" "size_t bufsize"
+.Fc
.Sh DESCRIPTION
The
.Fn readlink
@@ -56,6 +61,27 @@ system call does not append a
.Dv NUL
character to
.Fa buf .
+.Pp
+The
+.Fn readlinkat
+system call is equivalent to
+.Fn readlink
+except in the case where
+.Fa path
+specifies a relative path.
+In this case the symbolic link whose content is read relative to the
+directory associated with the file descriptor
+.Fa fd
+instead of the current working directory.
+If
+.Fn readlinkat
+is passed the special value
+.Dv AT_FDCWD
+in the
+.Fa fd
+parameter, the current working directory is used and the behavior is
+identical to a call to
+.Fn readlink .
.Sh RETURN VALUES
The call returns the count of characters placed in the buffer
if it succeeds, or a \-1 if an error occurs, placing the error
@@ -88,13 +114,45 @@ The
argument
extends outside the process's allocated address space.
.El
+.Pp
+In addition to the errors returned by the
+.Fn readlink ,
+the
+.Fn readlinkat
+may fail if:
+.Bl -tag -width Er
+.It Bq Er EBADF
+The
+.Fa path
+argument does not specify an absolute path and the
+.Fa fd
+argument is neither
+.Dv AT_FDCWD
+nor a valid file descriptor open for searching.
+.It Bq Er ENOTDIR
+The
+.Fa path
+argument is not an absolute path and
+.Fa fd
+is neither
+.Dv AT_FDCWD
+nor a file descriptor associated with a directory.
+.El
.Sh SEE ALSO
.Xr lstat 2 ,
.Xr stat 2 ,
.Xr symlink 2 ,
.Xr symlink 7
+.Sh STANDARDS
+The
+.Fn readlinkat
+system call follows The Open Group Extended API Set 2 specification.
.Sh HISTORY
The
.Fn readlink
system call appeared in
.Bx 4.2 .
+The
+.Fn readlinkat
+system call appeared in
+.Fx 8.0 .
OpenPOWER on IntegriCloud