summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2014-10-26 05:45:44 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2014-10-26 05:45:44 +0000
commitd95344351ce80c265db0ecfbbce569ed70af2842 (patch)
treeab81fc6e3c9c03cc329f189dbe1eb8db347f8a44 /lib/libc
parentaa31ffd5ab53b2904ebfe8c6b696b8e71782d234 (diff)
mknod(2) now supports creating FIFOs too. Fix description of device file
creation while here. ok jmc@ schwarze@ millert@
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/sys/mknod.262
1 files changed, 37 insertions, 25 deletions
diff --git a/lib/libc/sys/mknod.2 b/lib/libc/sys/mknod.2
index 55805e99f82..b6501674e7e 100644
--- a/lib/libc/sys/mknod.2
+++ b/lib/libc/sys/mknod.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: mknod.2,v 1.18 2013/07/17 05:42:11 schwarze Exp $
+.\" $OpenBSD: mknod.2,v 1.19 2014/10/26 05:45:43 guenther Exp $
.\" $NetBSD: mknod.2,v 1.6 1995/02/27 12:34:33 cgd Exp $
.\"
.\" Copyright (c) 1980, 1991, 1993
@@ -30,7 +30,7 @@
.\"
.\" @(#)mknod.2 8.1 (Berkeley) 6/4/93
.\"
-.Dd $Mdocdate: July 17 2013 $
+.Dd $Mdocdate: October 26 2014 $
.Dt MKNOD 2
.Os
.Sh NAME
@@ -46,31 +46,33 @@
.Ft int
.Fn mknodat "int fd" "const char *path" "mode_t mode" "dev_t dev"
.Sh DESCRIPTION
-The device special file
-.Fa path
-is created with the major and minor
-device numbers extracted from
-.Fa mode .
-The access permissions of
+The
+.Fn mknod
+function creates
.Fa path
-are descendant from the
-.Xr umask 2
-of the parent process.
+with a file type and mode of
+.Fa mode ,
+as modified by
+.Xr umask 2 .
+Only FIFO and device special files are supported by this implementation.
.Pp
If
.Fa mode
-indicates a block or character special file,
+is the bitwise OR of
+.Dv S_IFIFO
+and zero or more file permissions, and
.Fa dev
-is a configuration dependent specification of a character or block
-I/O device and the superblock of the device.
+is zero, then a FIFO is created.
If
.Fa mode
-does not indicate a block special or character special device,
-.Fa dev
-is ignored.
-.Pp
-.Fn mknod
-requires superuser privileges.
+is the bitwise OR of
+.Dv S_IFCHR
+or
+.Dv S_IFBLK
+and zero or more file permissions, then a character or block device
+special (respectively) is created with major and minor device numbers
+extracted from
+.Fa dev .
.Pp
The
.Fn mknodat
@@ -95,17 +97,25 @@ in the
parameter, the current working directory is used
and the behavior is identical to a call to
.Fn mknod .
+.Pp
+Creating a device special file with
+.Fn mknod
+or
+.Fn mknodat
+requires superuser privileges.
.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
.Sh ERRORS
.Fn mknod
and
.Fn mknodat
will fail and the file will be not created if:
.Bl -tag -width Er
+.It Bq Er EINVAL
+.Fa mode
+is an invalid file type or
+.Fa dev
+is an invalid value for that file type.
.It Bq Er ENOTDIR
A component of the path prefix is not a directory.
.It Bq Er ENAMETOOLONG
@@ -121,7 +131,8 @@ Search permission is denied for a component of the path prefix.
.It Bq Er ELOOP
Too many symbolic links were encountered in translating the pathname.
.It Bq Er EPERM
-The process's effective user ID is not superuser.
+.Fa mode
+is a device special and the process's effective user ID is not superuser.
.It Bq Er EIO
An I/O error occurred while making the directory entry or allocating the inode.
.It Bq Er ENOSPC
@@ -181,6 +192,7 @@ file descriptor references.
.Sh SEE ALSO
.Xr chmod 2 ,
.Xr chroot 2 ,
+.Xr mkfifo 2 ,
.Xr stat 2 ,
.Xr umask 2
.Sh STANDARDS