OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / LDP_man-pages / draft / man2 / readlink.2
1 .\" Copyright (c) 1983, 1991 The Regents of the University of California.
2 .\" All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\"    must display the following acknowledgement:
14 .\"     This product includes software developed by the University of
15 .\"     California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\"    may be used to endorse or promote products derived from this software
18 .\"    without specific prior written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .\"     @(#)readlink.2  6.8 (Berkeley) 3/10/91
33 .\"
34 .\" Modified Sat Jul 24 00:10:21 1993 by Rik Faith <faith@cs.unc.edu>
35 .\" Modified Tue Jul  9 23:55:17 1996 by aeb
36 .\" Modified Fri Jan 24 00:26:00 1997 by aeb
37 .\"
38 .\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
39 .\"         all rights reserved.
40 .\" Translated 1997-12-12, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
41 .\" Updated 2005-02-10, Yuichi SATO <ysato444@yahoo.co.jp>
42 .\" Updated 2006-07-19, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.36
43 .\" Updated 2008-08-06, Akihiro MOTOKI, LDP v3.05
44 .\"
45 .\"WORD:        symbolic link           ¥·¥ó¥Ü¥ê¥Ã¥¯¡¦¥ê¥ó¥¯
46 .\"WORD:        buffer                  ¥Ð¥Ã¥Õ¥¡¡¼
47 .\"WORD:        NUL                     ¥Ì¥ëʸ»ú
48 .\"WORD:        global variable         ¥°¥í¡¼¥Ð¥ëÊÑ¿ô
49 .\"WORD:        directory               ¥Ç¥£¥ì¥¯¥È¥ê
50 .\"
51 .TH READLINK 2 2007-07-26 "Linux" "Linux Programmer's Manual"
52 .\"O .SH NAME
53 .SH Ì¾Á°
54 .\"O readlink \- read value of a symbolic link
55 readlink \- ¥·¥ó¥Ü¥ê¥Ã¥¯¡¦¥ê¥ó¥¯¤ÎÃͤòÆɤà
56 .\"O .SH SYNOPSIS
57 .SH ½ñ¼°
58 .B #include <unistd.h>
59 .sp
60 .BI "ssize_t readlink(const char *" path ", char *" buf ", size_t " bufsiz );
61 .sp
62 .in -4n
63 .\"O Feature Test Macro Requirements for glibc (see
64 .\"O .BR feature_test_macros (7)):
65 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
66 .RB ( feature_test_macros (7)
67 »²¾È):
68 .in
69 .sp
70 .ad l
71 .BR readlink ():
72 _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 || _POSIX_C_SOURCE\ >=\ 200112L
73 .ad b
74 .\"O .SH DESCRIPTION
75 .SH ÀâÌÀ
76 .\"O .BR readlink ()
77 .\"O places the contents of the symbolic link
78 .\"O .I path
79 .\"O in the buffer
80 .\"O .IR buf ,
81 .\"O which has size
82 .\"O .IR bufsiz .
83 .BR readlink ()
84 ¤Ï
85 .I path
86 ¤ÇÍ¿¤¨¤é¤ì¤¿¥·¥ó¥Ü¥ê¥Ã¥¯¡¦¥ê¥ó¥¯¤ÎÆâÍƤò
87 .I buf
88 ¥Ð¥Ã¥Õ¥¡¡¼¤Ø³ÊǼ¤¹¤ë¡¢
89 .I buf
90 ¤Î¥µ¥¤¥º¤Ï
91 .I bufsiz
92 ¤Ç¤¢¤ë¡£
93 .\"O .BR readlink ()
94 .\"O does not append a null byte to
95 .\"O .IR buf .
96 .BR readlink ()
97 ¤Ï NULL ¥Ð¥¤¥È¤ò
98 .I buf
99 ¤ËÄɲ䷤ʤ¤¡£
100 .\"O It will truncate the contents (to a length of
101 .\"O .I bufsiz
102 .\"O characters), in case the buffer is too small to hold all of the contents.
103 ¤½¤ÎÆâÍÆÁ´¤Æ¤ò³ÊǼ¤¹¤ë¤Î¤Ë¥Ð¥Ã¥Õ¥¡¡¼¤¬¾®¤µ²á¤®¤ë¾ì¹ç¤Ï¡¢
104 .RI ( bufsiz
105 ¥Ð¥¤¥È¤ÎŤµ¤Ë) ÆâÍƤòÀÚ¤êµÍ¤á¤ë¡£
106 .\"O .SH "RETURN VALUE"
107 .SH ÊÖ¤êÃÍ
108 .\"O On success,
109 .\"O .BR readlink ()
110 .\"O returns the number of bytes placed in
111 .\"O .IR buf .
112 .\"O On error, \-1 is returned and
113 .\"O .I errno
114 .\"O is set to indicate the error.
115 À®¸ù¤¹¤ë¤È¡¢
116 .BR readlink ()
117 ¤Ï
118 .I buf
119 ¤Ë³ÊǼ¤µ¤ì¤¿¥Ð¥¤¥È¿ô¤òÊÖ¤¹¡£
120 ¥¨¥é¡¼¤Î¾ì¹ç¡¢\-1 ¤òÊÖ¤·¡¢
121 .I errno
122 ¤Ë¥¨¥é¡¼¤ò¼¨¤¹ÃͤòÀßÄꤹ¤ë¡£
123 .\"O .SH ERRORS
124 .SH ¥¨¥é¡¼
125 .TP
126 .B EACCES
127 .\"O Search permission is denied for a component of the path prefix.
128 .\"O (See also
129 .\"O .BR path_resolution (7).)
130 ¥Ñ¥¹¤Î¥Ç¥£¥ì¥¯¥È¥êÉôʬ¤Ë¸¡º÷µö²Ä¤¬Í¿¤¨¤é¤ì¤Æ¤¤¤Ê¤¤
131 .RB ( path_resolution (7)
132 ¤â»²¾È¤¹¤ë¤³¤È)¡£
133 .TP
134 .B EFAULT
135 .\"O .I buf
136 .\"O extends outside the process's allocated address space.
137 .I buf
138 ¤¬¥×¥í¥»¥¹¤Ë³ä¤êÅö¤Æ¤é¤ì¤¿¥¢¥É¥ì¥¹¶õ´Ö¤Î³°¤ò»Ø¤·¤Æ¤¤¤ë¡£
139 .TP
140 .B EINVAL
141 .\"O .I bufsiz
142 .\"O is not positive.
143 .I bufsiz
144 ¤¬Àµ¤Ç¤Ê¤¤¡£
145 .\" At the glibc level, bufsiz is unsigned, so this error can only occur
146 .\" if bufsiz==0.  However, the in the kernel syscall, bufsiz is signed,
147 .\" and this error can also occur if bufsiz < 0.
148 .\" See: http://thread.gmane.org/gmane.linux.man/380
149 .\" Subject: [patch 0/3] [RFC] kernel/glibc mismatch of "readlink" syscall?
150 .TP
151 .B EINVAL
152 .\"O The named file is not a symbolic link.
153 »ØÄꤷ¤¿¥Õ¥¡¥¤¥ë¤¬¥·¥ó¥Ü¥ê¥Ã¥¯¡¦¥ê¥ó¥¯¤Ç¤Ê¤¤¡£
154 .TP
155 .B EIO
156 .\"O An I/O error occurred while reading from the file system.
157 ¥Õ¥¡¥¤¥ë¡¦¥·¥¹¥Æ¥à¤ÎÆɤ߹þ¤ßÃæ¤Ë I/O ¥¨¥é¡¼¤¬µ¯¤³¤Ã¤¿¡£
158 .TP
159 .B ELOOP
160 .\"O Too many symbolic links were encountered in translating the pathname.
161 ¥Ñ¥¹Ì¾¤Ë¥·¥ó¥Ü¥ê¥Ã¥¯¡¦¥ê¥ó¥¯¤¬Â¿¤¹¤®¤ë¡£
162 .TP
163 .B ENAMETOOLONG
164 .\"O A pathname, or a component of a pathname, was too long.
165 ¥Ñ¥¹Ì¾¤«¥Ñ¥¹Ì¾¤Î°ìÉôʬ¤¬Ä¹²á¤®¤ë¡£
166 .TP
167 .B ENOENT
168 .\"O The named file does not exist.
169 ¤½¤Î̾Á°¤Î¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤·¤Ê¤¤¡£
170 .TP
171 .B ENOMEM
172 .\"O Insufficient kernel memory was available.
173 ¥«¡¼¥Í¥ë¤Ë½½Ê¬¤Ê¥á¥â¥ê¤¬¤Ê¤¤¡£
174 .TP
175 .B ENOTDIR
176 .\"O A component of the path prefix is not a directory.
177 ¥Ñ¥¹¤Î¥Ç¥£¥ì¥¯¥È¥êÉôʬ¤¬¥Ç¥£¥ì¥¯¥È¥ê¤Ç¤Ê¤¤¡£
178 .\"O .SH "CONFORMING TO"
179 .SH ½àµò
180 .\"O 4.4BSD (the
181 .\"O .BR readlink ()
182 .\"O function call appeared in 4.2BSD),
183 .\"O POSIX.1-2001.
184 4.4BSD
185 .RB ( readlink ()
186 ´Ø¿ô¥³¡¼¥ë¤Ï 4.2BSD ¤Ç¸½¤ï¤ì¤¿), POSIX.1-2001.
187 .\"O .SH NOTES
188 .SH Ãí°Õ
189 .\"O In versions of glibc up to and including glibc 2.4, the return type of
190 .\"O .BR readlink ()
191 .\"O was declared as
192 .\"O .IR int .
193 .\"O Nowadays, the return type is declared as
194 .\"O .IR ssize_t ,
195 .\"O as (newly) required in POSIX.1-2001.
196 ¥Ð¡¼¥¸¥ç¥ó 2.4 °ÊÁ°¤Î glibc (¥Ð¡¼¥¸¥ç¥ó 2.4 ¤ò´Þ¤à) ¤Ç¤Ï¡¢
197 .BR readlink ()
198 ¤ÎÊÖ¤êÃͤη¿¤Ï
199 .I int
200 ¤ÇÀë¸À¤µ¤ì¤Æ¤¤¤¿¡£¸½ºß¤Ç¤Ï¡¢ÊÖ¤êÃͤη¿¤Ï
201 .I ssize_t
202 ¤Ç¤¢¤ë (ÊÖ¤êÃÍ
203 .I ssize_t
204 ¤Ï POSIX.1-2001 ¤Ç (¿·¤¿¤Ë) É¬¿Ü¤È¤Ê¤Ã¤¿)¡£
205 .\"O .SH "SEE ALSO"
206 .SH ´ØÏ¢¹àÌÜ
207 .BR lstat (2),
208 .BR readlinkat (2),
209 .BR stat (2),
210 .BR symlink (2),
211 .BR path_resolution (7),
212 .BR symlink (7)