OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / LDP_man-pages / release / man3 / getcwd.3
1 .\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein.  The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\" License.
23 .\" Modified Wed Jul 21 22:35:42 1993 by Rik Faith (faith@cs.unc.edu)
24 .\" Modified 18 Mar 1996 by Martin Schulze (joey@infodrom.north.de):
25 .\"   Corrected description of getwd().
26 .\" Modified Sat Aug 21 12:32:12 MET 1999 by aeb - applied fix by aj
27 .\" Modified Mon Dec 11 13:32:51 MET 2000 by aeb
28 .\" Modified Thu Apr 22 03:49:15 CEST 2002 by Roger Luethi <rl@hellgate.ch>
29 .\"
30 .\" Japanese Version Copyright (c) 1997 IMAMURA Nobutaka
31 .\"         all rights reserved.
32 .\" Translated Fri Feb 14 12:40:22 JST 1997
33 .\"         by IMAMURA Nobutaka <imamura@spp.hpc.fujitsu.co.jp>
34 .\" Modified Thu Dec 8 05:08:44 JST 1999
35 .\"         by Kentaro Shirakata <argrath@yo.rim.or.jp>
36 .\" Modified Sun Mar 12 21:08:44 JST 2000
37 .\"         by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
38 .\" Updated 2001-01-29 by Kentaro Shirakata <argrath@ub32.org>
39 .\" Updated 2002-03-23 by Kentaro Shirakata <argrath@ub32.org>
40 .\" Updated 2002-10-17 by Kentaro Shirakata <argrath@ub32.org>
41 .\" Updated 2007-01-01 by Kentaro Shirakata <argrath@ub32.org>
42 .\" Updated 2008-08-21, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v3.07
43 .\"
44 .\" WORD: current working directory     ¥«¥ì¥ó¥È¥ï¡¼¥­¥ó¥°¥Ç¥£¥ì¥¯¥È¥ê
45 .\" WORD: LEGACY        ¡Ö²áµî¤Î̾»Ä(LEGACY)¡×
46 .\"
47 .TH GETCWD 3 2009-03-31 "GNU" "Linux Programmer's Manual"
48 .SH Ì¾Á°
49 getcwd, getwd, get_current_dir_name \- ¥«¥ì¥ó¥È¥ï¡¼¥­¥ó¥°¥Ç¥£¥ì¥¯¥È¥ê̾¤Î¼èÆÀ
50 .SH ½ñ¼°
51 .nf
52 .B #include <unistd.h>
53 .sp
54 .BI "char *getcwd(char *" buf ", size_t " size );
55 .sp
56 .BI "char *getwd(char *" buf );
57 .sp
58 .B "char *get_current_dir_name(void);"
59 .fi
60 .sp
61 .in -4n
62 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
63 .RB ( feature_test_macros (7)
64 »²¾È):
65 .in
66 .sp
67 .BR getcwd ():
68 _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500
69 .br
70 .BR get_current_dir_name ():
71 _GNU_SOURCE
72 .SH ÀâÌÀ
73 ¤³¤ì¤é¤Î´Ø¿ô¤Ï¡¢¸Æ¤Ó½Ð¤·¤¿¥×¥í¥»¥¹¤Î¥«¥ì¥ó¥È¥ï¡¼¥­¥ó¥°¥Ç¥£¥ì¥¯¥È¥ê¤Î
74 ÀäÂХѥ¹Ì¾ (absolute pathname) ¤¬Æþ¤Ã¤¿Ê¸»úÎó¤òÊÖ¤¹¡£
75 ÊÖ¤µ¤ì¤ëʸ»úÎó¤Ï NULL ¤Ç½ªÃ¼¤µ¤ì¤ë¡£
76 ¥Ñ¥¹Ì¾¤Ï´Ø¿ô¤Î·ë²Ì¤È¤·¤ÆÊÖ¤µ¤ì¡¢°ú¿ô
77 .I buf
78 ¤¬¤¢¤ë¾ì¹ç¤Ï
79 .I buf
80 ·Ðͳ¤Ç¤âÊÖ¤µ¤ì¤ë¡£
81
82 .BR getcwd ()
83 ´Ø¿ô¤Ï¥«¥ì¥ó¥È¥ï¡¼¥­¥ó¥°¥Ç¥£¥ì¥¯¥È¥ê¤ÎÀäÂХѥ¹Ì¾¤ò
84 .I buf
85 ¤Ç¼¨¤µ¤ì¤¿
86 .I size
87 ŤÎÇÛÎó¤Ë¥³¥Ô¡¼¤¹¤ë¡£
88 .PP
89 ½ªÃ¼¤Î NULL ¥Ð¥¤¥È¤â´Þ¤á¤¿¡¢¥«¥ì¥ó¥È¥ï¡¼¥­¥ó¥°¥Ç¥£¥ì¥¯¥È¥ê¤Î
90 ÀäÂХѥ¹Ì¾¤ÎŤµ¤¬
91 .I size
92 ¥Ð¥¤¥È¤òĶ¤¨¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢ÊÖ¤êÃͤȤ·¤Æ NULL ¤¬ÊÖ¤ê
93 .I errno
94 ¤Ë
95 .B ERANGE
96 ¤¬¥»¥Ã¥È¤µ¤ì¤ë¡£
97 ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ï¤³¤Î¥¨¥é¡¼¤ò¥Á¥§¥Ã¥¯¤·¡¢
98 ɬÍפ˱þ¤¸¤Æ¤è¤êŤ¤¥Ð¥Ã¥Õ¥¡¤òÍÑ°Õ¤¹¤Ù¤­¤Ç¤¢¤ë¡£
99 .PP
100 POSIX.1-2001 É¸½à¤Î³ÈÄ¥¤È¤·¤Æ¡¢
101 Linux (libc4, libc5, glibc) ¤Ç¤Ï
102 .I buf
103 ¤¬ NULL ¤Î¾ì¹ç¡¢
104 .BR getcwd ()
105 ¤ÏɬÍפʥХåե¡¤ò
106 .BR malloc (3)
107 ¤òÍѤ¤¤ÆưŪ¤Ë³ä¤êÅö¤Æ¤ë¡£
108 ¤³¤Î¾ì¹ç¡¢
109 .I size
110 ¤¬ 0 ¤Î¾ì¹ç¤ò½ü¤­¡¢¥Ð¥Ã¥Õ¥¡¤ÎŤµ¤Ï
111 .I size
112 ¤È¤Ê¤ë¡£
113 .I size
114 ¤¬ 0 ¤Î¾ì¹ç¤Ë¤ÏɬÍפÊÂ礭¤µ¤¬³ÎÊݤµ¤ì¤ë¡£
115 ¸Æ¤Ó½Ð¤·Â¦¤Ç¡¢ÊÖ¤µ¤ì¤¿¥Ð¥Ã¥Õ¥¡¤ò
116 .BR free (3)
117 ¤¹¤Ù¤­¤Ç¤¢¤ë¡£
118
119 .BR get_current_dir_name ()
120 ¤Ï¥«¥ì¥ó¥È¥ï¡¼¥­¥ó¥°¥Ç¥£¥ì¥¯¥È¥ê¤ÎÀäÂХѥ¹Ì¾¤ò¼ý¤á¤ë¤Î¤Ë
121 ½½Ê¬¤ÊÂ礭¤µ¤ÎÇÛÎó¤ò
122 .BR malloc (3)
123 ¤Ç³ÍÆÀ¤¹¤ë¡£´Ä¶­ÊÑ¿ô
124 .B PWD
125 ¤¬ÀßÄꤵ¤ì¤Æ¤ª¤ê¤½¤ÎÃͤ¬Àµ¤·¤±¤ì¤Ð¡¢¤½¤ÎÃͤ¬ÊÖ¤µ¤ì¤ë¡£
126 ¸Æ¤Ó½Ð¤·Â¦¤Ç¡¢ÊÖ¤µ¤ì¤¿¥Ð¥Ã¥Õ¥¡¤ò
127 .BR free (3)
128 ¤¹¤Ù¤­¤Ç¤¢¤ë¡£
129
130 .BR getwd ()
131 ¤Ï
132 .BR malloc (3)
133 ¤Ë¤è¤ë¥á¥â¥ê³ÍÆÀ¤ò°ìÀڹԤʤï¤Ê¤¤¡£
134 .I buf
135 °ú¿ô¤Ï¾¯¤Ê¤¯¤È¤â
136 .B PATH_MAX
137 ¥Ð¥¤¥È¤ÎŤµ¤ò»ý¤ÄÇÛÎó¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤¢¤ëɬÍפ¬¤¢¤ë¡£
138 ½ªÃ¼¤Î NULL ¥Ð¥¤¥È¤â´Þ¤á¤¿¡¢¥«¥ì¥ó¥È¥ï¡¼¥­¥ó¥°¥Ç¥£¥ì¥¯¥È¥ê¤Î
139 ÀäÂХѥ¹Ì¾¤ÎŤµ¤¬
140 .B PATH_MAX
141 ¥Ð¥¤¥È¤òĶ¤¨¤Æ¤¤¤ë¾ì¹ç¡¢
142 NULL ¤¬ÊÖ¤µ¤ì¡¢
143 .I errno
144 ¤Ë
145 .B ENAMETOOLONG
146 ¤¬ÀßÄꤵ¤ì¤ë¡£
147 (¥·¥¹¥Æ¥à¤Ë¤è¤Ã¤Æ¤Ï¡¢
148 .B PATH_MAX
149 ¤Ïɬ¤º¤·¤â¥³¥ó¥Ñ¥¤¥ë»þ¤Ë·è¤Þ¤ëÄê¿ô¤Ç¤Ï¤Ê¤¤ÅÀ¤ËÃí°Õ¤¹¤ë¤³¤È¡£
150 ¤Þ¤¿¡¢¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Ë°Í¸¤¹¤ë¾ì¹ç¤â¤¢¤ë¡£
151 .BR pathconf (3)
152 ¤ò»²¾È¡£)
153 °Ü¿¢À­¤È¥»¥­¥å¥ê¥Æ¥£¾å¤ÎÍýͳ¤«¤é¡¢
154 .BR getwd ()
155 ¤ÎÍøÍѤϿ侩¤µ¤ì¤Ê¤¤¡£
156 .SH ÊÖ¤êÃÍ
157 À®¸ù¤¹¤ë¤È¡¢¤³¤ì¤é¤Î´Ø¿ô¤Ï¥«¥ì¥ó¥È¥ï¡¼¥­¥ó¥°¥Ç¥£¥ì¥¯¥È¥ê¤ÎÀäÂХѥ¹Ì¾
158 ¤¬Æþ¤Ã¤¿Ê¸»úÎó¤Ø¤Î¥Ý¥¤¥ó¥¿¤òÊÖ¤¹¡£
159 .BR getcwd ()
160 ¤È
161 .BR getwd ()
162 ¤Î¾ì¹ç¡¢ÊÖ¤êÃͤÏ
163 .I buf
164 ¤ÈƱ¤¸Ãͤˤʤ롣
165
166 ¼ºÇÔ¤·¤¿¾ì¹ç¡¢¤³¤ì¤é¤Î´Ø¿ô¤Ï NULL ¤òÊÖ¤·¡¢
167 .I errno
168 ¤Ë¥¨¥é¡¼¤ò¼¨¤¹ÃͤòÀßÄꤹ¤ë¡£
169 .I buf
170 ¤¬»Ø¤¹ÇÛÎó¤ÎÆâÍƤÏ̤ÄêµÁ¤Ç¤¢¤ë¡£
171 .SH ¥¨¥é¡¼
172 .TP
173 .B EACCES
174 ¥Õ¥¡¥¤¥ë̾¤Î¹½À®Í×ÁǤËÂФ¹¤ëÆɤ߹þ¤ß¤¢¤ë¤¤¤Ï¸¡º÷¤Î¸¢¸Â¤¬¤Ê¤¤¡£
175 .TP
176 .B EFAULT
177 .I buf
178 ¤¬ÉÔÀµ¤Ê¥¢¥É¥ì¥¹¤ò»Ø¤·¤Æ¤¤¤ë¡£
179 .TP
180 .B EINVAL
181 .I size
182 °ú¿ô¤¬ 0 ¤«¤Ä¡¢
183 .I buf
184 °ú¿ô¤¬ NULL ¥Ý¥¤¥ó¥¿¤Ç¤Ê¤¤¡£
185 .TP
186 .B EINVAL
187 .BR getwd ():
188 .I buf
189 ¤¬ NULL ¤Ç¤¢¤ë¡£
190 .TP
191 .B ENAMETOOLONG
192 .BR getwd ():
193 ÀäÂХѥ¹Ì¾¤¬Æþ¤Ã¤¿ NULL ½ªÃ¼¤µ¤ì¤¿Ê¸»úÎó¤ÎŤµ¤¬
194 .B PATH_MAX
195 ¥Ð¥¤¥È¤òĶ¤¨¤Æ¤¤¤ë¡£
196 .TP
197 .B ENOENT
198 ¥«¥ì¥ó¥È¥ï¡¼¥­¥ó¥°¥Ç¥£¥ì¥¯¥È¥ê¤¬ºï½ü¤µ¤ì¤Æ¤¤¤ë¡£
199 .TP
200 .B ERANGE
201 .I size
202 °ú¿ô¤ÎÃͤ¬¥ï¡¼¥­¥ó¥°¥Ç¥£¥ì¥¯¥È¥ê¤ÎÀäÂХѥ¹Ì¾¤ÎŤµ¤è¤ê¾®¤µ¤¤¡£
203 Ťµ¤Ë¤Ïʸ»úÎó¤Î½ªÃ¼¥Ð¥¤¥È¤â´Þ¤Þ¤ì¤ë¡£
204 ¤è¤êÂ礭¤¤ÇÛÎó¤ò³ÎÊݤ·¤Æ¤â¤¦°ìÅټ¹Ԥ¹¤ëɬÍפ¬¤¢¤ë¡£
205 .SH ½àµò
206 .BR getcwd ()
207 ¤Ï POSIX.1-2001 ¤Ë½àµò¤·¤Æ¤¤¤ë¡£
208 POSIX.1-2001 ¤Ï¡¢
209 .I buf
210 ¤¬ NULL ¤Î¾ì¹ç¤Î
211 .BR getcwd ()
212 ¤ÎÆ°ºî¤òµ¬Äꤷ¤Ê¤¤¤Þ¤Þ¤È¤·¤Æ¤¤¤ë¡£
213
214 .BR getwd ()
215 ¤Ï POSIX.1-2001 ¤Ë¸ºß¤·¤Æ¤¤¤ë¤¬¡¢¡Ö²áµî¤Î̾»Ä(LEGACY)¡×¤È¤µ¤ì¤Æ¤¤¤ë¡£
216 POSIX.1-2008 ¤Ç¤Ï¡¢
217 .BR getwd ()
218 ¤Î»ÅÍͤ¬ºï½ü¤µ¤ì¤Æ¤¤¤ë¡£
219 Âå¤ï¤ê¤Ë
220 .BR getcwd ()
221 ¤ò»È¤¦¤³¤È¡£
222 POSIX.1-2001 ¤Ï
223 .BR getwd ()
224 ¤Ë´Ø¤¹¤ë¥¨¥é¡¼¤òÄêµÁ¤·¤Æ¤¤¤Ê¤¤¡£
225
226 .BR get_current_dir_name ()
227 ¤Ï GNU ³ÈÄ¥¤Ç¤¢¤ë¡£
228 .SH Ãí°Õ
229 Linux ¤Ç¤Ï (2.1.92 °Ê¹ß)¡¢
230 .BR getcwd ()
231 ¤Ï¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ç¤¢¤ë¡£
232 ¸Å¤¤¥·¥¹¥Æ¥à¤Ç¤Ï
233 .I /proc/self/cwd
234 ¤ò»²¾È¤¹¤ë¡£
235 ¥·¥¹¥Æ¥à¥³¡¼¥ë¤â proc ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤â¤Ê¤¤¾ì¹ç¡¢
236 °ìÈÌŪ¤Ê¼ÂÁõ¤¬¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
237 ¤³¤Î¾ì¹ç¤Ë¤ª¤¤¤Æ¤Î¤ß¡¢(Linux ¤Ç¤Ï) ¤³¤Î´Ø¿ô¤Ï
238 .B EACCES
239 ¤Ç¼ºÇÔ¤¹¤ë²ÄǽÀ­¤¬¤¢¤ë¡£
240 .LP
241 ¤³¤ì¤é¤Î´Ø¿ô¤Ï¤·¤Ð¤·¤Ð¥«¥ì¥ó¥È¥ï¡¼¥­¥ó¥°¥Ç¥£¥ì¥¯¥È¥ê¤Î°ÌÃÖ¤òÊݸ¤·¡¢
242 ¸å¤ÇÌá¤Ã¤Æ¤¯¤ë¤¿¤á¤ËÍøÍѤµ¤ì¤ë¡£
243 ̤»ÈÍѤΥե¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤¬½½Ê¬¤¢¤ë¾ì¹ç¤Ï¡¢
244 ¸½ºß¤Î¥Ç¥£¥ì¥¯¥È¥ê (".") ¤ò³«¤¤¤Æ
245 .BR fchdir (2)
246 ¤ò¸Æ¤Ó½Ð¤¹¤Û¤¦¤¬ÉáÄ̤Ϲ⮤ǿ®ÍêÀ­¤¬¤¢¤ë¡£
247 ÆäˠLinux °Ê³°¤Î¥×¥é¥Ã¥È¥Õ¥©¡¼¥à¤Î¾ì¹ç¤Ï¤½¤¦¤Ç¤¢¤ë¡£
248 .SH ´ØÏ¢¹àÌÜ
249 .BR chdir (2),
250 .BR fchdir (2),
251 .BR open (2),
252 .BR unlink (2),
253 .BR free (3),
254 .BR malloc (3)