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 License. It comes with NO WARRANTY.
9 .\" Japanese Version Copyright (c) 1997 SUTO, Mitsuaki
10 .\" all rights reserved.
11 .\" Translated Thu Jun 26 20:47:26 JST 1997
12 .\" by SUTO, Mitsuaki <suto@av.crl.sony.co.jp>
13 .\" Updated & Modified Fri Jan 22 1999
14 .\" by NAKANO Takeo <nakano@apm.seikei.ac.jp>
15 .\" Updated Fri Sep 13 JST 2000 by Kentaro Shirakata <argrath@ub32.org>
16 .\" Updated Sun May 23 JST 2004 by Kentaro Shirakata <argrath@ub32.org>
17 .\" Updated Thu Mar 24 JST 2005 by Kentaro Shirakata <argrath@ub32.org>
18 .\" Updated Wed Jul 30 JST 2008 by Kentaro Shirakata <argrath@ub32.org>
20 .\"WORD: permission µö²Ä°À
21 .\"WORD: resolve (¥Ñ¥¹Ì¾¤ò) ²ò·è¤¹¤ë
23 .TH MKDIR 2 2008-05-13 "Linux" "Linux Programmer's Manual"
26 .\"O mkdir \- create a directory
27 mkdir \- ¥Ç¥£¥ì¥¯¥È¥ê¤òºîÀ®¤¹¤ë
31 .B #include <sys/stat.h>
32 .B #include <sys/types.h>
33 .\" .B #include <unistd.h>
35 .BI "int mkdir(const char *" pathname ", mode_t " mode );
40 .\"O attempts to create a directory named
45 ¤Ç¼¨¤µ¤ì¤ë̾Á°¤Î¥Ç¥£¥ì¥¯¥È¥ê¤òºîÀ®¤·¤è¤¦¤È¤¹¤ë¡£
49 .\"O specifies the permissions to use.
50 .\"O It is modified by the process's
52 .\"O in the usual way: the permissions of the created directory are
53 .\"O .RI ( mode " & ~" umask " & 0777)."
55 °ú¤¿ô¤Ï¡¢ºîÀ®¤µ¤ì¤¿¥Ç¥£¥ì¥¯¥È¥ê¤Îµö²Ä°À¤ò·èÄꤹ¤ë¤Î¤Ë»È¤ï¤ì¤ë¡£
56 ¤³¤ÎÃͤˡ¢Ä̾ïÄ̤ê¥×¥í¥»¥¹¤Î
58 ¤Ë¤è¤ë½¤Àµ¤¬²Ã¤¨¤é¤ì¤ë¡£
59 ¤·¤¿¤¬¤Ã¤Æ¡¢ºîÀ®¤µ¤ì¤¿¥Ç¥£¥ì¥¯¥È¥ê¤Îµö²Ä°À¤Ï
60 .RI ( mode " & ~" umask " & 0777)"
62 .\"O Other mode bits of the created directory depend on the operating system.
63 .\"O For Linux, see below.
64 ºîÀ®¤µ¤ì¤¿¥Ç¥£¥ì¥¯¥È¥ê¤Î¤½¤Î¾¤Î¥â¡¼¥É¥Ó¥Ã¥È¤Ï¥ª¥Ú¥ì¡¼¥Æ¥£¥ó¥°¥·¥¹¥Æ¥à¤Ë
65 °Í¸¤¹¤ë¡£Linux ¤Î¾ì¹ç¤Ï¡¢°Ê²¼¤ÎÄ̤ê¤Ç¤¢¤ë¡£
67 .\"O The newly created directory will be owned by the effective user ID of the
69 .\"O If the directory containing the file has the set-group-ID
70 .\"O bit set, or if the file system is mounted with BSD group semantics
71 .\"O .RI ( "mount -o bsdgroups"
73 .\"O .IR "mount -o grpid" ),
74 .\"O the new directory will inherit the group ownership from its parent;
75 .\"O otherwise it will be owned by the effective group ID of the process.
76 ¿·¤·¤¯ºîÀ®¤µ¤ì¤¿¥Ç¥£¥ì¥¯¥È¥ê¤Î½êÍ¼Ô¤Ï¥×¥í¥»¥¹¤Î¼Â¸ú¥æ¡¼¥¶ ID ¤ËÀßÄꤵ¤ì¤ë¡£
77 ¿·¤¿¤ËºîÀ®¤µ¤ì¤¿¥Ç¥£¥ì¥¯¥È¥ê¤¬´Þ¤Þ¤ì¤ë¿Æ¥Ç¥£¥ì¥¯¥È¥ê¤Ë
78 set group ID ¥Ó¥Ã¥È¤¬¥»¥Ã¥È¤µ¤ì¤Æ¤¤¤¿¤ê¡¢¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤¬ BSD ¤Î
79 ¥°¥ë¡¼¥×¥»¥Þ¥ó¥Æ¥£¥¯¥¹
80 .RI ( "mount -o bsdgroups"
82 .IR "mount -o grpid" )
83 ¤Ë½¾¤Ã¤Æ¥Þ¥¦¥ó¥È¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¡¢
84 ¿·¤¿¤ËºîÀ®¤µ¤ì¤¿¥Ç¥£¥ì¥¯¥È¥ê¤Î¥°¥ë¡¼¥×½ê͸¢¤Ï¿Æ¥Ç¥£¥ì¥¯¥È¥ê¤Î
85 ¤â¤Î¤¬·Ñ¾µ¤µ¤ì¤ë (¿Æ¥Ç¥£¥ì¥¯¥È¥ê¤ÈƱ¤¸¤Ë¤Ê¤ë)¡£
86 ¤½¤ì°Ê³°¤Î¾ì¹ç¤Ï¡¢¥°¥ë¡¼¥×½ê͸¢¤Ï¥×¥í¥»¥¹¤Î¼Â¸ú¥°¥ë¡¼¥× ID ¤È¤Ê¤ë¡£
88 .\"O If the parent directory has the set-group-ID bit set then so will the
89 .\"O newly created directory.
90 ¤â¤·¿Æ¥Ç¥£¥ì¥¯¥È¥ê¤Ë set group ID ¥Ó¥Ã¥È¤¬¥»¥Ã¥È¤µ¤ì¤Æ¤¤¤ì¤Ð¿·¤·¤¯ºîÀ®¤µ¤ì¤ë
91 ¥Ç¥£¥ì¥¯¥È¥ê¤Ë¤â set group ID ¥Ó¥Ã¥È¤¬¥»¥Ã¥È¤µ¤ì¤ë¡£
92 .\"O .SH "RETURN VALUE"
95 .\"O returns zero on success, or \-1 if an error occurred (in which case,
97 .\"O is set appropriately).
99 ¤ÏÀ®¸ù¤·¤¿¾ì¹ç 0 ¤ò¡¢¼ºÇÔ¤·¤¿¾ì¹ç \-1 ¤òÊÖ¤¹ (¤Þ¤¿¡¢
101 ¤¬¥¨¥é¡¼¤ÎÆâÍƤˤ·¤¿¤¬¤Ã¤ÆŬÀÚ¤ËÀßÄꤵ¤ì¤ë)¡£
106 .\"O The parent directory does not allow write permission to the process,
107 .\"O or one of the directories in
109 .\"O did not allow search permission.
111 .\"O .BR path_resolution (7).)
112 ¥×¥í¥»¥¹¤¬¿Æ¥Ç¥£¥ì¥¯¥È¥ê¤Ø¤Î½ñ¤¹þ¤ßµö²Ä¤ò»ý¤¿¤Ê¤¤¡¢¤â¤·¤¯¤Ï
114 Ãæ¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Î¤É¤ì¤«¤Ë¸¡º÷µö²Ä°À¤¬Ìµ¤¤
115 .RB ( path_resolution (7)
120 .\"O already exists (not necessarily as a directory).
122 ¤¬´û¤Ë¸ºß¤·¤Æ¤¤¤ë(¤¿¤À¤·¤½¤ì¤¬¥Ç¥£¥ì¥¯¥È¥ê¤Ç¤¢¤ë¤È¤Ï¸Â¤é¤Ê¤¤)¡£
123 .\"O This includes the case where
125 .\"O is a symbolic link, dangling or not.
127 ¤¬¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤Î¾ì¹ç¤â
128 (¤½¤Î»ØÄêÀ褬¸ºß¤¹¤ë¤«¤É¤¦¤«¤Ë´Ø¤é¤º)¥¨¥é¡¼¤Ë¤Ê¤ë¡£
131 .\"O .IR pathname " points outside your accessible address space."
133 ¤¬¤½¤Î¥×¥í¥»¥¹¤Î¥¢¥¯¥»¥¹²Äǽ¤Ê¥¢¥É¥ì¥¹¶õ´Ö¤Î³°¤ò»Ø¤·¤Æ¤¤¤ë¡£
136 .\"O Too many symbolic links were encountered in resolving
140 ¤ò²ò·è¤¹¤ë¤È¤¤Ë¡¢²ò·è¤¹¤Ù¤¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤¬Â¿¤¹¤®¤¿¡£
143 .\"O .IR pathname " was too long."
148 .\"O A directory component in
150 .\"O does not exist or is a dangling symbolic link.
152 ¤Î¹½À®Í×ÁǤΥǥ£¥ì¥¯¥È¥ê¤Î¤¤¤º¤ì¤«¤¬Â¸ºß¤·¤Ê¤¤¤«¡¢
153 ¤Þ¤¿¤Ï¥ê¥ó¥¯À褬¸ºß¤·¤Ê¤¤¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤Ç¤¢¤ë¡£
156 .\"O Insufficient kernel memory was available.
157 ¥«¡¼¥Í¥ë¤Ë¡¢ÍøÍѤǤ¤ë¥á¥â¥ê¤¬ÉÔ¤·¤Æ¤¤¤ë¡£
160 .\"O The device containing
162 .\"O has no room for the new directory.
164 ¤ò´Þ¤à¥Ç¥Ð¥¤¥¹¤Ë¿·¤¿¤Ë¥Ç¥£¥ì¥¯¥È¥ê¤òºîÀ®¤¹¤ë¶õ¤¤¬Ìµ¤¤¡£
167 .\"?? ENOSPC ¤¬¥À¥Ö¤Ã¤Æ¤¤¤ë¤±¤É...
168 .\"O The new directory cannot be created because the user's disk quota is
170 ¤â¤·¤¯¤Ï¥æ¡¼¥¶¡¼¤Î¥Ç¥£¥¹¥¯ quota ¤¬»È¤¤ÀÚ¤é¤ì¤Æ¤¤¤ë¤¿¤á¡¢
171 ¿·¤¿¤Ë¥Ç¥£¥ì¥¯¥È¥ê¤òºîÀ®¤¹¤ë¤³¤È¤¬¤Ç¤¤Ê¤¤¡£
174 .\"O A component used as a directory in
176 .\"O is not, in fact, a directory.
178 Ãæ¤Î¥Ç¥£¥ì¥¯¥È¥êÉôʬ¤¬¼ÂºÝ¤Ë¤Ï¥Ç¥£¥ì¥¯¥È¥ê¤Ç¤Ê¤¤¡£
181 .\"O The file system containing
183 .\"O does not support the creation of directories.
185 ¤ò´Þ¤à¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤¬¥Ç¥£¥ì¥¯¥È¥ê¤ÎºîÀ®¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤¤¡£
189 .\"O refers to a file on a read-only file system.
191 ¤¬Æɤ߽Ф·ÀìÍÑ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¾å¤Î¥Õ¥¡¥¤¥ë¤ò»Ø¤·¤Æ¤¤¤ë¡£
192 .\"O .SH "CONFORMING TO"
194 .\"O SVr4, BSD, POSIX.1-2001.
195 .\"O .\" SVr4 documents additional EIO, EMULTIHOP
196 SVr4, BSD, POSIX.1-2001.
197 .\" SVr4 ¤Ë¤Ï¤µ¤é¤Ë¥¨¥é¡¼¥³¡¼¥É EIO, EMULTIHOP ¤Ë¤Ä¤¤¤Æ¤Îµ½Ò¤¬¤¢¤ë¡£
200 .\"O Under Linux apart from the permission bits, only the
202 .\"O mode bit is honored.
203 .\"O That is, under Linux the created directory actually gets mode
204 .\"O .RI ( mode " & ~" umask " & 01777)."
207 Linux ¤Ç¤Ï¡¢µö²Ä¥Ó¥Ã¥È°Ê³°¤Ç°ÕÌ£¤ò»ý¤Ä¤Î¤Ï¡¢
209 ¥â¡¼¥É¥Ó¥Ã¥È¤À¤±¤Ç¤¢¤ë¡£
210 ¤Ä¤Þ¤ê¡¢Linux ¤Ç¤ÏºîÀ®¤µ¤ì¤¿¥Ç¥£¥ì¥¯¥È¥ê¤Ï¼ÂºÝ¤Ë¤Ï
211 .RI ( mode " & ~" umask " & 01777)"
212 ¤Î¥â¡¼¥É¤ò»ý¤Ä¤³¤È¤Ë¤Ê¤ë¡£
216 .\"O There are many infelicities in the protocol underlying NFS.
217 .\"O Some of these affect
219 NFS ¤ò¼Â¸½¤·¤Æ¤¤¤ë¥×¥í¥È¥³¥ë¤Ë¤Ï¿¤¯¤ÎÉÔÈ÷¤¬Â¸ºß¤·¡¢
222 ¤Ë±Æ¶Á¤òÍ¿¤¨¤ë¤â¤Î¤â¤¢¤ë¡£
235 .BR path_resolution (7)