Commit | Line | Data |
---|---|---|
931b8415 | 1 | .\" Copyright (c) 1983, 1991 The Regents of the University of California. |
88b3ccf2 | 2 | .\" All rights reserved. |
9c8e3df4 | 3 | .\" |
91cff1e1 | 4 | .\" %sccs.include.redist.man% |
88b3ccf2 | 5 | .\" |
931b8415 | 6 | .\" @(#)mkdir.2 6.7 (Berkeley) %G% |
9c8e3df4 | 7 | .\" |
931b8415 CL |
8 | .Dd |
9 | .Dt MKDIR 2 | |
10 | .Os BSD 4.2 | |
11 | .Sh NAME | |
12 | .Nm mkdir | |
13 | .Nd make a directory file | |
14 | .Sh SYNOPSIS | |
15 | .Fd #include <sys/stat.h> | |
16 | .Ft int | |
17 | .Fn mkdir "const char *path" "mode_t mode" | |
18 | .Sh DESCRIPTION | |
19 | The directory | |
20 | .Fa path | |
21 | is created with the access permissions specified by | |
22 | .Fa mode | |
23 | and restricted by the the | |
24 | .Xr umask 2 | |
25 | of the calling process. | |
26 | .Pp | |
9c8e3df4 KM |
27 | The directory's owner ID is set to the process's effective user ID. |
28 | The directory's group ID is set to that of the parent directory in | |
29 | which it is created. | |
931b8415 CL |
30 | .Sh RETURN VALUES |
31 | A 0 return value indicates success. A -1 return value | |
9c8e3df4 | 32 | indicates an error, and an error code is stored in |
931b8415 CL |
33 | .Va errno . |
34 | .Sh ERRORS | |
35 | .Fn Mkdir | |
9c8e3df4 | 36 | will fail and no directory will be created if: |
931b8415 CL |
37 | .Bl -tag -width ENAMETOOLO |
38 | .It Bq Er ENOTDIR | |
9c8e3df4 | 39 | A component of the path prefix is not a directory. |
931b8415 | 40 | .It Bq Er EINVAL |
b5984ffe | 41 | The pathname contains a character with the high-order bit set. |
931b8415 | 42 | .It Bq Er ENAMETOOLONG |
b5984ffe KM |
43 | A component of a pathname exceeded 255 characters, |
44 | or an entire path name exceeded 1023 characters. | |
931b8415 | 45 | .It Bq Er ENOENT |
9c8e3df4 | 46 | A component of the path prefix does not exist. |
931b8415 | 47 | .It Bq Er EACCES |
b5984ffe | 48 | Search permission is denied for a component of the path prefix. |
931b8415 | 49 | .It Bq Er ELOOP |
b5984ffe | 50 | Too many symbolic links were encountered in translating the pathname. |
931b8415 CL |
51 | .It Bq Er EPERM |
52 | The | |
53 | .Fa path | |
54 | argument contains a byte with the high-order bit set. | |
55 | .It Bq Er EROFS | |
9c8e3df4 | 56 | The named file resides on a read-only file system. |
931b8415 | 57 | .It Bq Er EEXIST |
9c8e3df4 | 58 | The named file exists. |
931b8415 | 59 | .It Bq Er ENOSPC |
fd690c8b KM |
60 | The directory in which the entry for the new directory is being placed |
61 | cannot be extended because there is no space left on the file | |
62 | system containing the directory. | |
931b8415 | 63 | .It Bq Er ENOSPC |
fd690c8b KM |
64 | The new directory cannot be created because there |
65 | there is no space left on the file | |
66 | system that will contain the directory. | |
931b8415 | 67 | .It Bq Er ENOSPC |
fd690c8b KM |
68 | There are no free inodes on the file system on which the |
69 | directory is being created. | |
931b8415 | 70 | .It Bq Er EDQUOT |
fd690c8b KM |
71 | The directory in which the entry for the new directory |
72 | is being placed cannot be extended because the | |
73 | user's quota of disk blocks on the file system | |
74 | containing the directory has been exhausted. | |
931b8415 | 75 | .It Bq Er EDQUOT |
fd690c8b KM |
76 | The new directory cannot be created because the user's |
77 | quota of disk blocks on the file system that will | |
78 | contain the directory has been exhausted. | |
931b8415 | 79 | .It Bq Er EDQUOT |
fd690c8b KM |
80 | The user's quota of inodes on the file system on |
81 | which the directory is being created has been exhausted. | |
931b8415 | 82 | .It Bq Er EIO |
b5984ffe | 83 | An I/O error occurred while making the directory entry or allocating the inode. |
931b8415 | 84 | .It Bq Er EIO |
fd690c8b | 85 | An I/O error occurred while reading from or writing to the file system. |
931b8415 CL |
86 | .It Bq Er EFAULT |
87 | .Fa Path | |
9c8e3df4 | 88 | points outside the process's allocated address space. |
931b8415 CL |
89 | .El |
90 | .Sh SEE ALSO | |
91 | .Xr chmod 2 , | |
92 | .Xr stat 2 , | |
93 | .Xr umask 2 | |
94 | .Sh STANDARDS | |
95 | .Fn Mkdir | |
96 | conforms to IEEE Std 1003.1-1988 | |
97 | .Pq Dq Tn POSIX . |