aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/sys/mkdir.2
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2008-04-16 13:03:12 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2008-04-16 13:03:12 +0000
commita141af6930ff64262ef4d0fd13f4edf8e266d5fe (patch)
tree03acdbf3f7e88a48d315dac76d504fadeac388b0 /lib/libc/sys/mkdir.2
parenteab626f110908f209587469de08f63bf8642aa68 (diff)
downloadsrc-a141af6930ff64262ef4d0fd13f4edf8e266d5fe.tar.gz
src-a141af6930ff64262ef4d0fd13f4edf8e266d5fe.zip
Man pages for the openat(2), fexecve(2) and related syscalls.
Reviewed by: ru
Notes
Notes: svn path=/head/; revision=178245
Diffstat (limited to 'lib/libc/sys/mkdir.2')
-rw-r--r--lib/libc/sys/mkdir.260
1 files changed, 58 insertions, 2 deletions
diff --git a/lib/libc/sys/mkdir.2 b/lib/libc/sys/mkdir.2
index 94317d6c3496..332cf4930104 100644
--- a/lib/libc/sys/mkdir.2
+++ b/lib/libc/sys/mkdir.2
@@ -28,11 +28,12 @@
.\" @(#)mkdir.2 8.2 (Berkeley) 12/11/93
.\" $FreeBSD$
.\"
-.Dd December 9, 2006
+.Dd April 10, 2008
.Dt MKDIR 2
.Os
.Sh NAME
-.Nm mkdir
+.Nm mkdir ,
+.Nm mkdirat
.Nd make a directory file
.Sh LIBRARY
.Lb libc
@@ -41,6 +42,8 @@
.In sys/stat.h
.Ft int
.Fn mkdir "const char *path" "mode_t mode"
+.Ft int
+.Fn mkdirat "int fd" "const char *path" "mode_t mode"
.Sh DESCRIPTION
The directory
.Fa path
@@ -53,6 +56,27 @@ of the calling process.
The directory's owner ID is set to the process's effective user ID.
The directory's group ID is set to that of the parent directory in
which it is created.
+.Pp
+The
+.Fn mkdirat
+system call is equivalent to
+.Fn mkdir
+except in the case where
+.Fa path
+specifies a relative path.
+In this case the newly created directory is created relative to the
+directory associated with the file descriptor
+.Fa fd
+instead of the current working directory.
+If
+.Fn mkdirat
+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 mkdir .
.Sh RETURN VALUES
.Rv -std mkdir
.Sh ERRORS
@@ -106,6 +130,30 @@ The
argument
points outside the process's allocated address space.
.El
+.Pp
+In addition to the errors returned by the
+.Fn mkdir ,
+the
+.Fn mkdirat
+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 chflags 2 ,
.Xr chmod 2 ,
@@ -116,3 +164,11 @@ The
.Fn mkdir
system call is expected to conform to
.St -p1003.1-90 .
+The
+.Fn mkdirat
+system call follows The Open Group Extended API Set 2 specification.
+.Sh HISTORY
+The
+.Fn mkdirat
+system call appeared in
+.Fx 8.0 .