diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2014-09-09 07:23:20 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2014-09-09 07:23:20 +0000 |
commit | 07ae09e9f86b07b76b0d1295fe82221aeaac1cc0 (patch) | |
tree | 9d6cf3a04b919fcb3f4d29e01117c7afa92f44b1 /lib/libc | |
parent | 1f0361878be3a8e61b684d80415297f4d7d2d0fd (diff) |
Various updates and corrections to SYNOPSIS, ERRORS, and STANDARDS
Mention that unlinkat() serves the role of rmdirat().
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/sys/rmdir.2 | 31 | ||||
-rw-r--r-- | lib/libc/sys/unlink.2 | 19 |
2 files changed, 33 insertions, 17 deletions
diff --git a/lib/libc/sys/rmdir.2 b/lib/libc/sys/rmdir.2 index 536a73d96e1..ff134af5ad1 100644 --- a/lib/libc/sys/rmdir.2 +++ b/lib/libc/sys/rmdir.2 @@ -1,4 +1,4 @@ -.\" $OpenBSD: rmdir.2,v 1.10 2008/10/24 14:34:39 jmc Exp $ +.\" $OpenBSD: rmdir.2,v 1.11 2014/09/09 07:23:19 guenther Exp $ .\" $NetBSD: rmdir.2,v 1.7 1995/02/27 12:36:30 cgd Exp $ .\" .\" Copyright (c) 1983, 1991, 1993 @@ -30,14 +30,14 @@ .\" .\" @(#)rmdir.2 8.1 (Berkeley) 6/4/93 .\" -.Dd $Mdocdate: October 24 2008 $ +.Dd $Mdocdate: September 9 2014 $ .Dt RMDIR 2 .Os .Sh NAME .Nm rmdir .Nd remove a directory file .Sh SYNOPSIS -.Fd #include <unistd.h> +.In unistd.h .Ft int .Fn rmdir "const char *path" .Sh DESCRIPTION @@ -50,10 +50,18 @@ than .Ql \&. and .Ql \&.. . +.Pp +There is no +.Fn rmdirat +function; +to remove a directory with a path relative to the directory associated +with a file descriptor use the +.Xr unlinkat 2 +function with the +.Dv AT_REMOVEDIR +flag. .Sh RETURN VALUES -A 0 is returned if the remove succeeds; otherwise a \-1 is -returned and an error code is stored in the global location -.Va errno . +.Rv -std rmdir .Sh ERRORS The named file is removed unless: .Bl -tag -width Er @@ -78,12 +86,16 @@ in it. .It Bq Er EACCES Search permission is denied for a component of the path prefix. .It Bq Er EACCES -Write permission is denied on the directory containing the link +Write permission is denied on the directory containing the directory to be removed. .It Bq Er EPERM The directory containing the directory to be removed is marked sticky, and neither the containing directory nor the directory to be removed are owned by the effective user ID. +.It Bq Er EPERM +The directory to be removed or the directory containing it has its +immutable or append-only flag set (see +.Xr chflags 2 ) . .It Bq Er EBUSY The directory to be removed is the mount point for a mounted file system or the current directory. @@ -98,8 +110,13 @@ points outside the process's allocated address space. .El .Sh SEE ALSO .Xr rmdir 1 , +.Xr chflags 2 , .Xr mkdir 2 , .Xr unlink 2 +.Sh STANDARDS +.Fn rmdir +function conforms to +.St -p1003.1-2008 . .Sh HISTORY The .Fn rmdir diff --git a/lib/libc/sys/unlink.2 b/lib/libc/sys/unlink.2 index 1cd393f2e6e..3e3bc8f10d8 100644 --- a/lib/libc/sys/unlink.2 +++ b/lib/libc/sys/unlink.2 @@ -1,4 +1,4 @@ -.\" $OpenBSD: unlink.2,v 1.23 2014/02/13 07:30:39 guenther Exp $ +.\" $OpenBSD: unlink.2,v 1.24 2014/09/09 07:23:19 guenther Exp $ .\" $NetBSD: unlink.2,v 1.7 1995/02/27 12:39:13 cgd Exp $ .\" .\" Copyright (c) 1980, 1991, 1993 @@ -30,7 +30,7 @@ .\" .\" @(#)unlink.2 8.1 (Berkeley) 6/4/93 .\" -.Dd $Mdocdate: February 13 2014 $ +.Dd $Mdocdate: September 9 2014 $ .Dt UNLINK 2 .Os .Sh NAME @@ -38,11 +38,11 @@ .Nm unlinkat .Nd remove directory entry .Sh SYNOPSIS -.Fd #include <unistd.h> +.In unistd.h .Ft int .Fn unlink "const char *path" -.Fd #include <fcntl.h> -.Fd #include <unistd.h> +.In fcntl.h +.In unistd.h .Ft int .Fn unlinkat "int fd" "const char *path" "int flag" .Sh DESCRIPTION @@ -105,10 +105,7 @@ Remove the directory entry specified by as a directory, not a normal file. .El .Sh RETURN VALUES -Upon successful completion, a value of 0 is returned. -Otherwise, a value of \-1 is returned and -.Va errno -is set to indicate the error. +.Rv -std unlink unlinkat .Sh ERRORS The .Fn unlink @@ -144,7 +141,8 @@ The directory containing the file is marked sticky, and neither the containing directory nor the file to be removed are owned by the effective user ID. .It Bq Er EPERM -The named file has its immutable or append-only flag set (see +The named file or the directory containing it has its immutable or +append-only flag set (see .Xr chflags 2 ) . .It Bq Er EBUSY The entry to be unlinked is the mount point for a @@ -206,6 +204,7 @@ file descriptor references. .El .Sh SEE ALSO .Xr rm 1 , +.Xr chflags 2 , .Xr close 2 , .Xr link 2 , .Xr rmdir 2 , |