one too many levels of indirection (from ks@purdue)
[unix-history] / usr / src / lib / libc / sys / 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.\"
37c8db36 5.\" @(#)mkdir.2 6.3 (Berkeley) %G%
9c8e3df4 6.\"
f5db7458 7.TH MKDIR 2 ""
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
b5984ffe
KM
74[EIO]
75An I/O error occurred while making the directory entry or allocating the inode.
76.TP 15
9c8e3df4
KM
77[EFAULT]
78.I Path
79points outside the process's allocated address space.
80.TP 15
9c8e3df4
KM
81[EIO]
82An I/O error occured while writing to the file system.
83.SH "SEE ALSO"
84chmod(2), stat(2), umask(2)