diff options
author | kib <kib@FreeBSD.org> | 2008-04-16 13:03:12 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2008-04-16 13:03:12 +0000 |
commit | 2e4b86adc7ebc6a6f218f0ad58bf2e06954acd0d (patch) | |
tree | 03acdbf3f7e88a48d315dac76d504fadeac388b0 /lib/libc/sys/rename.2 | |
parent | 52243403eb48561abd7b33995f5a4be6a56fa1f0 (diff) | |
download | FreeBSD-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/rename.2')
-rw-r--r-- | lib/libc/sys/rename.2 | 79 |
1 files changed, 78 insertions, 1 deletions
diff --git a/lib/libc/sys/rename.2 b/lib/libc/sys/rename.2 index 3c3001c..52f9588 100644 --- a/lib/libc/sys/rename.2 +++ b/lib/libc/sys/rename.2 @@ -28,7 +28,7 @@ .\" @(#)rename.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd December 9, 2006 +.Dd April 10, 2008 .Dt RENAME 2 .Os .Sh NAME @@ -40,6 +40,8 @@ .In stdio.h .Ft int .Fn rename "const char *from" "const char *to" +.Ft int +.Fn renameat "int fromfd" "const char *from" "int tofd" "const char *to" .Sh DESCRIPTION The .Fn rename @@ -73,6 +75,37 @@ If the final component of is a symbolic link, the symbolic link is renamed, not the file or directory to which it points. +.Pp +The +.Fn renameat +system call is equivalent to +.Fn rename +except in the case where either +.Fa from +or +.Fa to +specifies a relative path. +If +.Fa from +is a relative path, the file to be renamed is located +relative to the directory associated with the file descriptor +.Fa fromfd +instead of the current working directory. +If the +.Fa to +is a relative path, the same happens only relative to the directory associated +with +.Fa tofd . +If the +.Fn renameat +is passed the special value +.Dv AT_FDCWD +in the +.Fa fromfd +or +.Fa tofd +parameter, the current working directory is used in the determination +of the file for the respective path parameter. .\".Sh CAVEAT .\"The system can deadlock if a loop in the file system graph is present. .\"This loop takes the form of an entry in directory @@ -215,6 +248,42 @@ The argument is a directory and is not empty. .El +.Pp +In addition to the errors returned by the +.Fn rename , +the +.Fn renameat +may fail if: +.Bl -tag -width Er +.It Bq Er EBADF +The +.Fa from +argument does not specify an absolute path and the +.Fa fromfd +argument is neither +.Dv AT_FDCWD +nor a valid file descriptor open for searching, or the +.Fa to +argument does not specify an absolute path and the +.Fa tofd +argument is neither +.Dv AT_FDCWD +nor a valid file descriptor open for searching. +.It Bq Er ENOTDIR +The +.Fa from +argument is not an absolute path and +.Fa fromfd +is neither +.Dv AT_FDCWD +nor a file descriptor associated with a directory, or the +.Fa to +argument is not an absolute path and +.Fa tofd +is neither +.Dv AT_FDCWD +nor a file descriptor associated with a directory. +.El .Sh SEE ALSO .Xr chflags 2 , .Xr open 2 , @@ -224,3 +293,11 @@ The .Fn rename system call is expected to conform to .St -p1003.1-96 . +The +.Fn renameat +system call follows The Open Group Extended API Set 2 specification. +.Sh HISTORY +The +.Fn renameat +system call appeared in +.Fx 8.0 . |