1MKDIR(2) System Calls Manual MKDIR(2)
2
3
4
6 mkdir - make a directory file
7
9 mkdir(path, mode)
10 char *path;
11 int mode;
12
14 Mkdir creates a new directory file with name path. The mode of the new
15 file is initialized from mode. (The protection part of the mode is
16 modified by the process's mode mask; see umask(2)).
17
18 The directory's owner ID is set to the process's effective user ID.
19 The directory's group ID is set to that of the parent directory in
20 which it is created.
21
22 The low-order 9 bits of mode are modified by the process's file mode
23 creation mask: all bits set in the process's file mode creation mask
24 are cleared. See umask(2).
25
27 A 0 return value indicates success. A -1 return value indicates an
28 error, and an error code is stored in errno.
29
31 Mkdir will fail and no directory will be created if:
32
33 [ENOTDIR] A component of the path prefix is not a directory.
34
35 [EINVAL] The pathname contains a character with the high-order
36 bit set.
37
38 [ENAMETOOLONG] A component of a pathname exceeded 255 characters, or an
39 entire path name exceeded 1023 characters.
40
41 [ENOENT] A component of the path prefix does not exist.
42
43 [EACCES] Search permission is denied for a component of the path
44 prefix.
45
46 [ELOOP] Too many symbolic links were encountered in translating
47 the pathname.
48
49 [EPERM] The path argument contains a byte with the high-order
50 bit set.
51
52 [EROFS] The named file resides on a read-only file system.
53
54 [EEXIST] The named file exists.
55
56 [ENOSPC] The directory in which the entry for the new directory
57 is being placed cannot be extended because there is no
58 space left on the file system containing the directory.
59
60 [ENOSPC] The new directory cannot be created because there there
61 is no space left on the file system that will contain
62 the directory.
63
64 [ENOSPC] There are no free inodes on the file system on which the
65 directory is being created.
66
67 [EDQUOT] The directory in which the entry for the new directory
68 is being placed cannot be extended because the user's
69 quota of disk blocks on the file system containing the
70 directory has been exhausted.
71
72 [EDQUOT] The new directory cannot be created because the user's
73 quota of disk blocks on the file system that will con‐
74 tain the directory has been exhausted.
75
76 [EDQUOT] The user's quota of inodes on the file system on which
77 the directory is being created has been exhausted.
78
79 [EIO] An I/O error occurred while making the directory entry
80 or allocating the inode.
81
82 [EIO] An I/O error occurred while reading from or writing to
83 the file system.
84
85 [EFAULT] Path points outside the process's allocated address
86 space.
87
89 chmod(2), stat(2), umask(2)
90
91
92
934.2 Berkeley Distribution August 26, 1985 MKDIR(2)