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