File: realpath.3

package info (click to toggle)
manpages-ja 0.5.0.0.20080615-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 20,508 kB
  • ctags: 1
  • sloc: sh: 13,690; perl: 157; makefile: 114
file content (212 lines) | stat: -rw-r--r-- 5,736 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
.\" Copyright (C), 1994, Graeme W. Wilford. (Wilf.)
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date.  The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein.  The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\" Rewritten old page, 990824, aeb@cwi.nl
.\" 2004-12-14, mtk, added discussion of resolved_path == NULL
.\"
.\" Japanese Version Copyright (c) 1998 SHOJI Yasushi all rights reserved.
.\" Translated 1998-03-22, SHOJI Yasushi <yashi@yashi.com>
.\" Updated 1999-03-07, Shouichi Saito
.\" Updated 2003-01-17, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
.\" Updated 2005-02-27, Akihiro MOTOKI
.\" Updated 2005-09-06, Akihiro MOTOKI
.\"
.\"WORD: bounded	¤ʤ
.\"
.TH REALPATH 3  2007-07-26 "" "Linux Programmer's Manual"
.SH ̾
realpath \- 줿Хѥ֤̾
.SH 
.nf
.B #include <limits.h>
.B #include <stdlib.h>
.sp
.BI "char *realpath(const char *" path ", char *" resolved_path );
.fi
.sp
.in -4n
glibc εǽޥ׷
.RB ( feature_test_macros (7)
):
.in
.sp
.BR realpath ():
_BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500
.SH 
.BR realpath ()

.I path
ȤͿ줿 NULL ǽʸˤ
٤ƤΥܥå󥯤Ÿ
.IR '/./' ", " '/../'
ˤ뻲Ȥ;ʬ
.I '/'
褷ơ줿Хѥ̾
.I resolved_path
ȤХåե˳Ǽ롣
ΥХåեΥ
.B PATH_MAX
Ǥ롣
̤Ȥ֤ѥˤϡܥå󥯤
.IR '/./' ", " '/../'
ȤäǤϴޤޤʤ
.SH ֤
顼ʤä硢
.BR realpath ()

.I resolved_path
ؤΥݥ󥿡֤

ʳξϡ̥ (NULL) ݥ󥿡֤ꡢ
.I resolved_path
ƤǤ롣
Хѿ
.I errno
顼Ƥˤ碌ƥåȤ롣
.SH 顼
.TP
.B EACCES
ѥΥǥ쥯ȥʬˡɤ߽ФĤޤϸĤͿƤʤ
.TP
.B EINVAL
.I path

.I resolved_path
Τ줫 NULL Ǥ롣
(libc5 ǤϡΤ褦ʾ segfault 򵯤Ǥ)
âΡաפ򻲾ȤΤȡ
.TP
.B EIO
ե륷ƥɤȤˡI/O顼ä
.TP
.B ELOOP
ѥ̾Ѵˤꡢ褹٤ܥå󥯤ο¿᤮
.TP
.B ENAMETOOLONG
ѥ̾ΰǤʸ
.B NAME_MAX
ۤƤ롢ޤϥѥ̾Τʸ
.B PATH_MAX
ۤƤ롣
.TP
.B ENOENT
ꤵ줿ե뤬¸ߤʤ
.TP
.B ENOTDIR
ѥΥǥ쥯ȥǤǥ쥯ȥǤʤ
.SH С
δؿ Linux о줷Τ libc 4.5.21 Ǥ롣
.SH 
4.4BSD, POSIX.1-2001.

4.4BSD  Solaris Ǥϡѥ̾Ĺξ¤
(\fI<sys/param.h>\fP ˤ)
.B MAXPATHLEN
Ǥ롣SUSv2 Ǥ
.B PATH_MAX

.B NAME_MAX
ꤵƤꡢ
 \fI<limits.h>\fP Ƥ뤫
.BR pathconf (3)
ؿ롣ʲΤ褦ʥɤˤʤäƤ뤳Ȥ¿
.LP
.in +4n
.nf
#ifdef PATH_MAX
  path_max = PATH_MAX;
#else
  path_max = pathconf(path, _PC_PATH_MAX);
  if (path_max <= 0)
	 path_max = 4096;
#endif
.fi
.in
.LP
(ХξϤ⻲ȤΤȡ) 
.LP
4.4BSDLinuxSUSv2 Ǥϡ֤ͤϾХѥ̾Ǥ롣
Solaris Ǥϡ

.I path
Хѥξ硢֤ͤХѥˤʤ뤳Ȥ롣
.BR realpath ()
Υץȥϡ
libc4  libc5 Ǥ \fI<unistd.h>\fP ˤ뤬
ʳδĶǤϤ \fI<stdlib.h>\fP ˤ롣
.SH 
.BR realpath ()
 glibc μǤɸγĥʤƤ롣
.I resolved_path
 NULL ꤵȡ
.BR realpath ()

.BR malloc (3)
ȤäƲ褷ѥ̾ݻ뤿ΥХåե

.B PATH_MAX
ХȤޤdzơΥХåեؤΥݥ󥿤֤
ƤӽФϡ
.BR free (3)
ȤäƤΥХåե٤Ǥ롣
.\" resolved_path == NULL ꤷǤ⡢褷ѥ̾Ĺ
.\" PATH_MAX ХȤĶȤˤϡrealpath() Ʊ
.\" ENAMETOOLONG ֤-- MTK, Dec 04
.\" .SH 
.\" .BR realpath ()
.\" ؿ 4.4BSD ǽо줷 (Jan-Simon Pendry ˤ󶡤줿)
.SH Х
δؿλѤ򤱤뤳ȡ߷ʳ꤬뤫
.I "resolved_path\ ==\ NULL"
γĥǽȤʤ¤) ϥХåե
.I resolved_path
Ŭڤʥꤹ뤳ȤǤʤǤ롣
POSIX ǤϥХåեȤ
.B PATH_MAX
ϽʬȤƤ뤬
.B PATH_MAX
ѤǤɬפϤʤ
.BR pathconf (3)
ȤäͤǤäƤ褤ȤˤʤäƤ롣
.BR pathconf (3)
ХåեȤƤɬ⽽ʬǤϤʤ
ʤʤ顢
.BR pathconf (3)
֤ͤ礭᤮Ŭڤ˥ݤ뤳ȤǤʤ⤷ʤ
 POSIX ǤϷٹ𤵤Ƥ뤷
.BR pathconf (3)

.B PATH_MAX
¤ʤȤ򼨤 \-1 ֤⤷ʤǤ롣
.LP
libc4  libc5 μϥХåեСեβǽäƤ
(libc-5.4.13 ǽ줿)äơ
.BR mount (8)
Τ褦 set-user-ID ץǤϡ
δؿδؿǻɬפ롣
.SH Ϣ
.BR readlink (2),
.BR canonicalize_file_name (3),
.BR getcwd (3),
.BR pathconf (3),
.BR sysconf (3)