BSD 4_3_Tahoe release
[unix-history] / usr / src / man / man2 / mkdir.2
CommitLineData
9c8e3df4
KM
1.\" Copyright (c) 1983 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
95f51977 5.\" @(#)mkdir.2 6.4 (Berkeley) 8/26/85
9c8e3df4 6.\"
95f51977 7.TH MKDIR 2 "August 26, 1985"
9c8e3df4
KM
8.UC 5
9.SH NAME
10mkdir \- make a directory file
11.SH SYNOPSIS
12.nf
13.ft B
14mkdir(path, mode)
15char *path;
16int mode;
17.fi
18.ft R
19.SH DESCRIPTION
20.I Mkdir
21creates a new directory file with name
22.IR path .
23The mode of the new file
24is initialized from
25.IR mode .
26(The protection part of the mode
27is modified by the process's mode mask; see
28.IR umask (2)).
29.PP
30The directory's owner ID is set to the process's effective user ID.
31The directory's group ID is set to that of the parent directory in
32which it is created.
33.PP
34The low-order 9 bits of mode are modified by the process's
35file mode creation mask: all bits set in the process's file mode
36creation mask are cleared. See
37.IR umask (2).
38.SH "RETURN VALUE
39A 0 return value indicates success. A \-1 return value
40indicates an error, and an error code is stored in
41.I errno.
42.SH "ERRORS
43.I Mkdir
44will fail and no directory will be created if:
45.TP 15
9c8e3df4
KM
46[ENOTDIR]
47A component of the path prefix is not a directory.
48.TP 15
b5984ffe
KM
49[EINVAL]
50The pathname contains a character with the high-order bit set.
51.TP 15
52[ENAMETOOLONG]
53A component of a pathname exceeded 255 characters,
54or an entire path name exceeded 1023 characters.
55.TP 15
9c8e3df4
KM
56[ENOENT]
57A component of the path prefix does not exist.
58.TP 15
b5984ffe
KM
59[EACCES]
60Search permission is denied for a component of the path prefix.
61.TP 15
62[ELOOP]
63Too many symbolic links were encountered in translating the pathname.
64.TP 15
65[EPERM]
b5984ffe
KM
66The \fIpath\fP argument contains a byte with the high-order bit set.
67.TP 15
9c8e3df4
KM
68[EROFS]
69The named file resides on a read-only file system.
70.TP 15
71[EEXIST]
72The named file exists.
73.TP 15
fd690c8b
KM
74[ENOSPC]
75The directory in which the entry for the new directory is being placed
76cannot be extended because there is no space left on the file
77system containing the directory.
78.TP 15
79[ENOSPC]
80The new directory cannot be created because there
81there is no space left on the file
82system that will contain the directory.
83.TP 15
84[ENOSPC]
85There are no free inodes on the file system on which the
86directory is being created.
87.TP 15
88[EDQUOT]
89The directory in which the entry for the new directory
90is being placed cannot be extended because the
91user's quota of disk blocks on the file system
92containing the directory has been exhausted.
93.TP 15
94[EDQUOT]
95The new directory cannot be created because the user's
96quota of disk blocks on the file system that will
97contain the directory has been exhausted.
98.TP 15
99[EDQUOT]
100The user's quota of inodes on the file system on
101which the directory is being created has been exhausted.
102.TP 15
b5984ffe
KM
103[EIO]
104An I/O error occurred while making the directory entry or allocating the inode.
105.TP 15
fd690c8b
KM
106[EIO]
107An I/O error occurred while reading from or writing to the file system.
108.TP 15
9c8e3df4
KM
109[EFAULT]
110.I Path
111points outside the process's allocated address space.
9c8e3df4
KM
112.SH "SEE ALSO"
113chmod(2), stat(2), umask(2)