xref: /csrg-svn/lib/libc/sys/mknod.2 (revision 61183)
1*61183Sbostic.\" Copyright (c) 1980, 1991, 1993
2*61183Sbostic.\"	The Regents of the University of California.  All rights reserved.
320080Smckusick.\"
447208Scael.\" %sccs.include.redist.man%
520080Smckusick.\"
6*61183Sbostic.\"     @(#)mknod.2	8.1 (Berkeley) 06/04/93
747208Scael.\"
847208Scael.Dd
947208Scael.Dt MKNOD 2
1047208Scael.Os BSD 4
1147208Scael.Sh NAME
1247208Scael.Nm mknod
1347208Scael.Nd make a special file node
1447208Scael.Sh SYNOPSIS
1547208Scael.Fd #include <unistd.h>
1647208Scael.Ft int
1747208Scael.Fn mknod "const char *path" "mode_t mode" "dev_t dev"
1847208Scael.Sh DESCRIPTION
1947208ScaelThe device special file
2047208Scael.Fa path
2147208Scaelis created with the major and minor
2247208Scaeldevice numbers extracted from
2347208Scael.Fa mode.
2447208ScaelThe access permissions of
2547208Scael.Fa path
2647208Scaelare descendant from the
2747208Scael.Xr umask 2
2847208Scaelof the parent process.
2947208Scael.Pp
3047208ScaelIf
3147208Scael.Fa mode
3247208Scaelindicates a block or character special file,
3347208Scael.Fa dev
3420081Smckusickis a configuration dependent specification of a character or block
3547208ScaelI/O device and the superblock of the device.  If
3647208Scael.Fa mode
3720081Smckusickdoes not indicate a block special or character special device,
3847208Scael.Fa dev
3920081Smckusickis ignored.
4047208Scael.Pp
4147208Scael.Fn Mknod
4247208Scaelrequires super-user privileges.
4347208Scael.Sh RETURN VALUES
4420081SmckusickUpon successful completion a value of 0 is returned.
4547208ScaelOtherwise, a value of -1 is returned and
4647208Scael.Va errno
4720081Smckusickis set to indicate the error.
4847208Scael.Sh ERRORS
4947208Scael.Fn Mknod
5047208Scaelwill fail and the file will be not created if:
5147208Scael.Bl -tag -width Er
5247208Scael.It Bq Er ENOTDIR
5321003SmckusickA component of the path prefix is not a directory.
5447208Scael.It Bq Er EINVAL
5521003SmckusickThe pathname contains a character with the high-order bit set.
5647208Scael.It Bq Er ENAMETOOLONG
5721003SmckusickA component of a pathname exceeded 255 characters,
5821003Smckusickor an entire path name exceeded 1023 characters.
5947208Scael.It Bq Er ENOENT
6021003SmckusickA component of the path prefix does not exist.
6147208Scael.It Bq Er EACCES
6221003SmckusickSearch permission is denied for a component of the path prefix.
6347208Scael.It Bq Er ELOOP
6421003SmckusickToo many symbolic links were encountered in translating the pathname.
6547208Scael.It Bq Er EPERM
6620081SmckusickThe process's effective user ID is not super-user.
6747208Scael.It Bq Er EPERM
6820081SmckusickThe pathname contains a character with the high-order bit set.
6947208Scael.It Bq Er EIO
7021003SmckusickAn I/O error occurred while making the directory entry or allocating the inode.
7147208Scael.It Bq Er ENOSPC
7224439SmckusickThe directory in which the entry for the new node is being placed
7324439Smckusickcannot be extended because there is no space left on the file
7424439Smckusicksystem containing the directory.
7547208Scael.It Bq Er ENOSPC
7624439SmckusickThere are no free inodes on the file system on which the
7724439Smckusicknode is being created.
7847208Scael.It Bq Er EDQUOT
7924439SmckusickThe directory in which the entry for the new node
8024439Smckusickis being placed cannot be extended because the
8124439Smckusickuser's quota of disk blocks on the file system
8224439Smckusickcontaining the directory has been exhausted.
8347208Scael.It Bq Er EDQUOT
8424439SmckusickThe user's quota of inodes on the file system on
8524439Smckusickwhich the node is being created has been exhausted.
8647208Scael.It Bq Er EROFS
8720081SmckusickThe named file resides on a read-only file system.
8847208Scael.It Bq Er EEXIST
8920081SmckusickThe named file exists.
9047208Scael.It Bq Er EFAULT
9147208Scael.Fa Path
9220081Smckusickpoints outside the process's allocated address space.
9347208Scael.El
9447208Scael.Sh SEE ALSO
9547208Scael.Xr chmod 2 ,
9647208Scael.Xr stat 2 ,
9747208Scael.Xr umask 2
9847208Scael.Sh HISTORY
9947208ScaelA
10047208Scael.Nm
10147208Scaelfunction call appeared in Version 6 AT&T UNIX.
102