1 .\" Copyright (C), 1994, Graeme W. Wilford. (Wilf.)
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.
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.
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
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" Rewritten old page, 990824, aeb@cwi.nl
24 .\" 2004-12-14, mtk, added discussion of resolved_path == NULL
26 .\" Japanese Version Copyright (c) 1998 SHOJI Yasushi all rights reserved.
27 .\" Translated 1998-03-22, SHOJI Yasushi <yashi@yashi.com>
28 .\" Updated 1999-03-07, Shouichi Saito
29 .\" Updated 2003-01-17, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
30 .\" Updated 2005-02-27, Akihiro MOTOKI
31 .\" Updated 2005-09-06, Akihiro MOTOKI
32 .\" Updated 2009-04-24, Akihiro MOTOKI, LDP v3.20
34 .\"WORD: bounded À©¸Â¤¬¤Ê¤¤
36 .TH REALPATH 3 2009-02-23 "" "Linux Programmer's Manual"
38 realpath \- Àµµ¬²½¤µ¤ì¤¿ÀäÂХѥ¹Ì¾¤òÊÖ¤¹
41 .B #include <limits.h>
42 .B #include <stdlib.h>
44 .BI "char *realpath(const char *" path ", char *" resolved_path );
48 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
49 .RB ( feature_test_macros (7)
54 _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500
59 ¤È¤·¤ÆÍ¿¤¨¤é¤ì¤¿ NULL ½ªÃ¼¤µ¤ì¤¿Ê¸»úÎóÃæ¤Î
60 ¤¹¤Ù¤Æ¤Î¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤òŸ³«¤·¡¢
62 ¤Ë¤è¤ë»²¾È¤ä;ʬ¤Ê \(aq/\(aq
63 ¤ò²ò·è¤·¤Æ¡¢Àµµ¬²½¤µ¤ì¤¿ÀäÂХѥ¹Ì¾¤òÀ¸À®¤¹¤ë¡£
64 ÆÀ¤é¤ì¤¿ÀäÂХѥ¹Ì¾¤Ï¡¢ºÇÂç¤Ç
66 ¥Ð¥¤¥È¤Î NULL ½ªÃ¼¤µ¤ì¤¿Ê¸»úÎó¤È¤·¤Æ¡¢
68 ¤Ë¤è¤ê»²¾È¤µ¤ì¤ë¥Ð¥Ã¥Õ¥¡¤Ë³ÊǼ¤µ¤ì¤ë¡£
69 ·ë²Ì¤È¤·¤ÆÊÖ¤ë¥Ñ¥¹¤ÎÃæ¤Ë¤Ï¡¢¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤ä
71 ¤È¤¤¤Ã¤¿Í×ÁǤϴޤޤì¤Ê¤¤¡£
73 ¤Ë NULL ¤¬»ØÄꤵ¤ì¤ë¤È¡¢
77 ¤ò»È¤Ã¤Æ²ò·è¤·¤¿¥Ñ¥¹Ì¾¤òÊÝ»ý¤¹¤ë¤¿¤á¤Î¥Ð¥Ã¥Õ¥¡¤ò
80 ¥Ð¥¤¥È¤Þ¤Ç³ä¤êÅö¤Æ¡¢¤³¤Î¥Ð¥Ã¥Õ¥¡¤Ø¤Î¥Ý¥¤¥ó¥¿¤òÊÖ¤¹¡£
83 ¤ò»È¤Ã¤Æ¤³¤Î¥Ð¥Ã¥Õ¥¡¤ò²òÊü¤¹¤Ù¤¤Ç¤¢¤ë¡£
84 .\" resolved_path == NULL ¤ò»ØÄꤷ¤¿¾ì¹ç¤Ç¤â¡¢²ò·è¤·¤¿¥Ñ¥¹Ì¾¤ÎŤµ¤¬
85 .\" PATH_MAX ¥Ð¥¤¥È¤òĶ¤¨¤¿¤È¤¤Ë¤Ï¡¢realpath() ¤ÏÁ°¤ÈƱ¤¸¤¯
86 .\" ENAMETOOLONG ¤òÊÖ¤¹¡£-- MTK, Dec 04
89 .\" ´Ø¿ô¤Ï 4.4BSD ¤Ç½é¤á¤ÆÅо줷¤¿ (Jan-Simon Pendry ¤Ë¤è¤êÄ󶡤µ¤ì¤¿)¡£
91 ¥¨¥é¡¼¤¬¤Ê¤«¤Ã¤¿¾ì¹ç¡¢
95 ¤Ø¤Î¥Ý¥¤¥ó¥¿¡¼¤òÊÖ¤¹¡£
97 ¤½¤ì°Ê³°¤Î¾ì¹ç¤Ï¡¢¥Ì¥ë (NULL) ¥Ý¥¤¥ó¥¿¡¼¤¬Ê֤ꡢÇÛÎó
101 ¤Ë¥¨¥é¡¼¤ÎÆâÍƤò¼¨¤¹Ãͤ¬¥»¥Ã¥È¤µ¤ì¤ë¡£
105 ¥Ñ¥¹¤Î¥Ç¥£¥ì¥¯¥È¥êÉôʬ¤Ë¡¢Æɤ߽Ф·µö²Ä¤Þ¤¿¤Ï¸¡º÷µö²Ä¤¬Í¿¤¨¤é¤ì¤Æ¤¤¤Ê¤¤¡£
111 ¤Î¤¤¤º¤ì¤«¤¬ NULL ¤Ç¤¢¤ë¡£
112 (libc5 ¤Ç¤Ï¡¢¤³¤Î¤è¤¦¤Ê¾ì¹ç segfault ¤òµ¯¤³¤¹¤À¤±¤Ç¤¢¤í¤¦)
113 ⤷¡¢²¼µ¤Î¡ÖÃí°Õ¡×¤ÎÀá¤ò»²¾È¤Î¤³¤È¡£
116 ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤òÆɤà¤È¤¤Ë¡¢I/O¥¨¥é¡¼¤¬µ¯¤³¤Ã¤¿¡£
119 ¥Ñ¥¹Ì¾¤ÎÊÑ´¹¤Ë¤¢¤¿¤ê¡¢²ò·è¤¹¤Ù¤¥·¥ó¥Ü¥ê¥Ã¥¯¡¦¥ê¥ó¥¯¤Î¿ô¤¬Â¿²á¤®¤¿¡£
122 ¥Ñ¥¹Ì¾¤Î°ìÍ×ÁǤÎʸ»ú¿ô¤¬
124 ¤ò±Û¤¨¤Æ¤¤¤ë¡¢¤Þ¤¿¤Ï¥Ñ¥¹Ì¾Á´ÂΤÎʸ»ú¿ô¤¬
129 »ØÄꤵ¤ì¤¿¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤·¤Ê¤¤¡£
132 ¥Ñ¥¹¤Î¥Ç¥£¥ì¥¯¥È¥êÍ×ÁǤ¬¡¢¥Ç¥£¥ì¥¯¥È¥ê¤Ç¤Ê¤¤¡£
134 ¤³¤Î´Ø¿ô¤¬ Linux ¤ËÅо줷¤¿¤Î¤Ï libc 4.5.21 ¤Ç¤¢¤ë¡£
136 4.4BSD, POSIX.1-2001.
140 ¤¬ NULL ¤Î¾ì¹ç¤ÎÆ°ºî¤Ï¼ÂÁõ¤Ë°Í¸¤¹¤ë¤È¤·¤Æ¤¤¤ë¡£
141 POSIX.1-2008 ¤Ç¤Ï¡¢¤³¤Î¥Þ¥Ë¥å¥¢¥ë¥Ú¡¼¥¸¤Ë½ñ¤«¤ì¤Æ¤¤¤ëÆ°ºî¤¬µ¬Äꤵ¤ì¤Æ¤¤¤ë¡£
143 4.4BSD ¤È Solaris ¤Ç¤Ï¡¢¥Ñ¥¹Ì¾¤ÎŤµ¤Î¾å¸Â¤Ï
144 (\fI<sys/param.h>\fP ¤ÎÃæ¤Ë¤¢¤ë)
151 ¤³¤ì¤é¤Ï \fI<limits.h>\fP ¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤ë¤«¡¢
153 ´Ø¿ô¤«¤éÆÀ¤é¤ì¤ë¡£°Ê²¼¤Î¤è¤¦¤Ê¥½¡¼¥¹¥³¡¼¥É¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤³¤È¤¬Â¿¤¤¡£
160 path_max = pathconf(path, _PC_PATH_MAX);
167 (¥Ð¥°¤Î¾Ï¤â»²¾È¤Î¤³¤È¡£)
169 4.4BSD¡¢Linux¡¢SUSv2 ¤Ç¤Ï¡¢ÊÖ¤êÃͤϾï¤ËÀäÂХѥ¹Ì¾¤Ç¤¢¤ë¡£
173 ¤¬ÁêÂХѥ¹¤Î¾ì¹ç¡¢ÊÖ¤êÃͤ¬ÁêÂХѥ¹¤Ë¤Ê¤ë¤³¤È¤¬¤¢¤ë¡£
175 ¤Î¥×¥í¥È¥¿¥¤¥×Àë¸À¤Ï¡¢
176 libc4 ¤È libc5 ¤Ç¤Ï \fI<unistd.h>\fP ¤Ë¤¢¤ë¤¬¡¢
177 ¤½¤ì°Ê³°¤Î´Ä¶¤Ç¤Ï¤¤¤º¤ì¤â \fI<stdlib.h>\fP ¤Ë¤¢¤ë¡£
179 ¤³¤Î´Ø¿ô¤Î POSIX.1-2001 ÈǤϡ¢Àß·×Ãʳ¬¤«¤éÌäÂ꤬¤¢¤ë¡£
182 ¤ÎŬÀڤʥµ¥¤¥º¤ò·èÄꤹ¤ë¤³¤È¤¬¤Ç¤¤Ê¤¤¤«¤é¤Ç¤¢¤ë¡£
183 POSIX.1-2001 ¤Ç¤Ï¥Ð¥Ã¥Õ¥¡¡¦¥µ¥¤¥º¤È¤·¤Æ
185 ¤Ï½½Ê¬¤À¤È¤µ¤ì¤Æ¤¤¤ë¤¬¡¢
187 ¤ÏÄêµÁºÑ¤ÎÄê¿ô¤Ç¤¢¤ëɬÍפϤʤ¯¡¢
189 ¤ò»È¤Ã¤ÆÆÀ¤é¤ì¤ëÃͤǤ¢¤Ã¤Æ¤â¤è¤¤¤³¤È¤Ë¤Ê¤Ã¤Æ¤¤¤ë¡£
191 ¤«¤é¥Ð¥Ã¥Õ¥¡¡¦¥µ¥¤¥º¤ò¼èÆÀ¤·¤¿¤È¤·¤Æ¤âɬ¤º¤·¤â½½Ê¬¤Ç¤Ï¤Ê¤¤¡£
192 ¤Ê¤¼¤Ê¤é¡¢POSIX ¤Ç·Ù¹ð¤µ¤ì¤Æ¤¤¤ë¤è¤¦¤Ë¡¢
194 ¤ÎÊÖ¤êÃͤ¬Â礲᤮¤ÆŬÀڤ˥á¥â¥ê¤ò³ÎÊݤ¹¤ë¤³¤È¤¬¤Ç¤¤Ê¤¤
199 ¤ËÀ©¸Â¤¬¤Ê¤¤¤³¤È¤ò¼¨¤¹ \-1 ¤òÊÖ¤¹¤«¤â¤·¤ì¤Ê¤¤¤«¤é¤Ç¤¢¤ë¡£
200 .I "resolved_path\ ==\ NULL"
201 ¤Îµ¡Ç½¤ò»È¤¦¤È¡¢¤³¤ÎÀß·×¾å¤ÎÌäÂê¤ò²óÈò¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£
202 ¤³¤Îµ¡Ç½¤Ï POSIX.1-2001 ¤Ç¤Ïɸ½à²½¤µ¤ì¤Æ¤¤¤Ê¤¤¤¬¡¢
203 POSIX.1-2008 ¤Ç¤Ïɸ½à²½¤µ¤ì¤Æ¤¤¤ë¡£
205 libc4 ¤È libc5 ¤Î¼ÂÁõ¤Ï¥Ð¥Ã¥Õ¥¡¡¦¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¤Î²ÄǽÀ¤ò»ý¤Ã¤Æ¤¤¤ë
206 (libc-5.4.13 ¤Ç½¤Àµ¤µ¤ì¤¿¤¬)¡£¤·¤¿¤¬¤Ã¤Æ¡¢
208 ¤Î¤è¤¦¤Ê set-user-ID ¤µ¤ì¤ë¥×¥í¥°¥é¥à¤Ç¤Ï¡¢
209 ¤³¤Î´Ø¿ôÁêÅö¤Î´Ø¿ô¤ò¼«Á°¤Ç»ý¤ÄɬÍפ¬¤¢¤ë¡£
212 .BR canonicalize_file_name (3),