1 .\" Hey Emacs! This file is -*- nroff -*- source.
3 .\" This manpage is Copyright (C) 1992 Drew Eckhardt;
4 .\" 1993 Michael Haardt
5 .\" 1993,1994 Ian Jackson.
6 .\" You may distribute it under the terms of the GNU General
7 .\" Public Licence. It comes with NO WARRANTY.
9 .TH MKDIR 2 2003-12-09 "Linux 2.4" "Linux Programmer's Manual"
11 mkdir \- create a directory
14 .B #include <sys/stat.h>
15 .B #include <sys/types.h>
16 .\" .B #include <unistd.h>
18 .BI "int mkdir(const char *" pathname ", mode_t " mode );
22 attempts to create a directory named
27 specifies the permissions to use. It is modified by the process's
29 in the usual way: the permissions of the created directory are
30 .RI ( mode " & ~" umask " & 0777)."
31 Other mode bits of the created directory depend on the operating system.
34 The newly created directory will be owned by the effective user ID of the
35 process. If the directory containing the file has the set-group-ID
36 bit set, or if the filesystem is mounted with BSD group semantics, the
37 new directory will inherit the group ownership from its parent;
38 otherwise it will be owned by the effective group ID of the process.
40 If the parent directory has the set-group-ID bit set then so will the
41 newly created directory.
44 returns zero on success, or \-1 if an error occurred (in which case,
46 is set appropriately).
50 The parent directory does not allow write permission to the process,
51 or one of the directories in
53 did not allow search permission.
55 .BR path_resolution (2).)
59 already exists (not necessarily as a directory).
60 This includes the case where
62 is a symbolic link, dangling or not.
65 .IR pathname " points outside your accessible address space."
68 Too many symbolic links were encountered in resolving
72 .IR pathname " was too long."
75 A directory component in
77 does not exist or is a dangling symbolic link.
80 Insufficient kernel memory was available.
85 has no room for the new directory.
88 The new directory cannot be created because the user's disk quota is
92 A component used as a directory in
94 is not, in fact, a directory.
97 The filesystem containing
99 does not support the creation of directories.
103 refers to a file on a read-only filesystem.
105 SVr4, BSD, POSIX.1-2001.
106 .\" SVr4 documents additional EIO, EMULTIHOP
108 Under Linux apart from the permission bits, only the S_ISVTX mode bit
109 is honored. That is, under Linux the created directory actually gets mode
110 .RI ( mode " & ~" umask " & 01777)."
114 There are many infelicities in the protocol underlying NFS. Some
123 .BR path_resolution (2),