date and time created 91/03/06 18:09:53 by bostic
[unix-history] / usr / src / lib / libc / sys / mknod.2
CommitLineData
ef3c3516
KM
1.\" Copyright (c) 1980 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
3e664f4b 5.\" @(#)mknod.2 6.4 (Berkeley) %G%
ef3c3516 6.\"
ea5a97a6 7.TH MKNOD 2 ""
ef3c3516
KM
8.UC 4
9.SH NAME
caa37210 10mknod \- make a special file
ef3c3516
KM
11.SH SYNOPSIS
12.nf
caa37210
KM
13.ft B
14mknod(path, mode, dev)
15char *path;
16int mode, dev;
17.fi
18.ft R
ef3c3516
KM
19.SH DESCRIPTION
20.I Mknod
21creates a new file
caa37210
KM
22whose name is
23.I path.
ef3c3516 24The mode of the new file
caa37210 25(including special file bits)
ef3c3516
KM
26is initialized from
27.IR mode .
28(The protection part of the mode
3e664f4b
KD
29is modified by the process's mode mask (see
30.IR umask (2))).
ef3c3516
KM
31The first block pointer of the i-node
32is initialized from
caa37210
KM
33.I dev
34and is used to specify which device the special file
35refers to.
36.PP
37If mode indicates a block or character special file,
38.I dev
39is a configuration dependent specification of a character or block
40I/O device. If
41.I mode
42does not indicate a block special or character special device,
43.I dev
44is ignored.
ef3c3516
KM
45.PP
46.I Mknod
47may be invoked only by the super-user.
caa37210
KM
48.SH "RETURN VALUE
49Upon successful completion a value of 0 is returned.
50Otherwise, a value of \-1 is returned and \fIerrno\fP
51is set to indicate the error.
52.SH ERRORS
53.I Mknod
54will fail and the file mode will be unchanged if:
55.TP 15
b5984ffe
KM
56[ENOTDIR]
57A component of the path prefix is not a directory.
caa37210 58.TP 15
b5984ffe 59[EINVAL]
caa37210
KM
60The pathname contains a character with the high-order bit set.
61.TP 15
b5984ffe
KM
62[ENAMETOOLONG]
63A component of a pathname exceeded 255 characters,
64or an entire path name exceeded 1023 characters.
caa37210
KM
65.TP 15
66[ENOENT]
67A component of the path prefix does not exist.
68.TP 15
b5984ffe
KM
69[EACCES]
70Search permission is denied for a component of the path prefix.
71.TP 15
72[ELOOP]
73Too many symbolic links were encountered in translating the pathname.
74.TP 15
75[EPERM]
76The process's effective user ID is not super-user.
77.TP 15
78[EPERM]
79The pathname contains a character with the high-order bit set.
80.TP 15
81[EIO]
82An I/O error occurred while making the directory entry or allocating the inode.
83.TP 15
fd690c8b
KM
84[ENOSPC]
85The directory in which the entry for the new node is being placed
86cannot be extended because there is no space left on the file
87system containing the directory.
88.TP 15
89[ENOSPC]
90There are no free inodes on the file system on which the
91node is being created.
92.TP 15
93[EDQUOT]
94The directory in which the entry for the new node
95is being placed cannot be extended because the
96user's quota of disk blocks on the file system
97containing the directory has been exhausted.
98.TP 15
99[EDQUOT]
100The user's quota of inodes on the file system on
101which the node is being created has been exhausted.
102.TP 15
caa37210
KM
103[EROFS]
104The named file resides on a read-only file system.
105.TP 15
106[EEXIST]
107The named file exists.
108.TP 15
109[EFAULT]
110.I Path
111points outside the process's allocated address space.
ef3c3516 112.SH "SEE ALSO"
caa37210 113chmod(2), stat(2), umask(2)