Commit | Line | Data |
---|---|---|
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 | |
10 | mkdir \- make a directory file | |
11 | .SH SYNOPSIS | |
12 | .nf | |
13 | .ft B | |
14 | mkdir(path, mode) | |
15 | char *path; | |
16 | int mode; | |
17 | .fi | |
18 | .ft R | |
19 | .SH DESCRIPTION | |
20 | .I Mkdir | |
21 | creates a new directory file with name | |
22 | .IR path . | |
23 | The mode of the new file | |
24 | is initialized from | |
25 | .IR mode . | |
26 | (The protection part of the mode | |
27 | is modified by the process's mode mask; see | |
28 | .IR umask (2)). | |
29 | .PP | |
30 | The directory's owner ID is set to the process's effective user ID. | |
31 | The directory's group ID is set to that of the parent directory in | |
32 | which it is created. | |
33 | .PP | |
34 | The low-order 9 bits of mode are modified by the process's | |
35 | file mode creation mask: all bits set in the process's file mode | |
36 | creation mask are cleared. See | |
37 | .IR umask (2). | |
38 | .SH "RETURN VALUE | |
39 | A 0 return value indicates success. A \-1 return value | |
40 | indicates an error, and an error code is stored in | |
41 | .I errno. | |
42 | .SH "ERRORS | |
43 | .I Mkdir | |
44 | will fail and no directory will be created if: | |
45 | .TP 15 | |
9c8e3df4 KM |
46 | [ENOTDIR] |
47 | A component of the path prefix is not a directory. | |
48 | .TP 15 | |
b5984ffe KM |
49 | [EINVAL] |
50 | The pathname contains a character with the high-order bit set. | |
51 | .TP 15 | |
52 | [ENAMETOOLONG] | |
53 | A component of a pathname exceeded 255 characters, | |
54 | or an entire path name exceeded 1023 characters. | |
55 | .TP 15 | |
9c8e3df4 KM |
56 | [ENOENT] |
57 | A component of the path prefix does not exist. | |
58 | .TP 15 | |
b5984ffe KM |
59 | [EACCES] |
60 | Search permission is denied for a component of the path prefix. | |
61 | .TP 15 | |
62 | [ELOOP] | |
63 | Too many symbolic links were encountered in translating the pathname. | |
64 | .TP 15 | |
65 | [EPERM] | |
b5984ffe KM |
66 | The \fIpath\fP argument contains a byte with the high-order bit set. |
67 | .TP 15 | |
9c8e3df4 KM |
68 | [EROFS] |
69 | The named file resides on a read-only file system. | |
70 | .TP 15 | |
71 | [EEXIST] | |
72 | The named file exists. | |
73 | .TP 15 | |
b5984ffe KM |
74 | [EIO] |
75 | An I/O error occurred while making the directory entry or allocating the inode. | |
76 | .TP 15 | |
9c8e3df4 KM |
77 | [EFAULT] |
78 | .I Path | |
79 | points outside the process's allocated address space. | |
80 | .TP 15 | |
9c8e3df4 KM |
81 | [EIO] |
82 | An I/O error occured while writing to the file system. | |
83 | .SH "SEE ALSO" | |
84 | chmod(2), stat(2), umask(2) |