summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2014-09-09 07:23:19 +0000
committerguenther <guenther@openbsd.org>2014-09-09 07:23:19 +0000
commit4a63600ae9ed81c9194f8dee9c8dfc4ec8a18429 (patch)
treece275def5f5c7865955e318b77e1ae7ff9fa97d0
parentMake the cleaner, syncer, pagedaemon, aiodone daemons all (diff)
downloadwireguard-openbsd-4a63600ae9ed81c9194f8dee9c8dfc4ec8a18429.tar.xz
wireguard-openbsd-4a63600ae9ed81c9194f8dee9c8dfc4ec8a18429.zip
Various updates and corrections to SYNOPSIS, ERRORS, and STANDARDS
Mention that unlinkat() serves the role of rmdirat().
-rw-r--r--lib/libc/sys/rmdir.231
-rw-r--r--lib/libc/sys/unlink.219
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 ,