OSDN Git Service

ea1b24cfb98cfe798223c0bd5066b14831bf25d2
[linuxjm/LDP_man-pages.git] / draft / man3 / dirfd.3
1 .\" Copyright (C) 2002 Andries Brouwer (aeb@cwi.nl)
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 .\"
23 .\"
24 .\" Japanese Version Copyright (c) 2002-2003 Yuichi SATO
25 .\"         all rights reserved.
26 .\" Translated Mon May  6 21:32:36 JST 2002
27 .\"         by Yuichi SATO <ysato@h4.dion.ne.jp>
28 .\" Updated & Modified Sun Sep  7 01:23:08 JST 2003
29 .\"         by Yuichi SATO <ysato444@yahoo.co.jp>
30 .\"
31 .TH DIRFD 3 2008-08-21 "Linux" "Linux Programmer's Manual"
32 .\"O .SH NAME
33 .SH Ì¾Á°
34 .\"O dirfd \- get directory stream file descriptor
35 dirfd \- ¥Ç¥£¥ì¥¯¥È¥ê¡¦¥¹¥È¥ê¡¼¥à¤Î¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¤ò¼èÆÀ¤¹¤ë
36 .\"O .SH SYNOPSIS
37 .SH ½ñ¼°
38 .B #include <sys/types.h>
39 .br
40 .B #include <dirent.h>
41 .sp
42 .BI "int dirfd(DIR *" dirp );
43 .sp
44 .in -4n
45 .\"O Feature Test Macro Requirements for glibc (see
46 .\"O .BR feature_test_macros (7)):
47 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
48 .RB ( feature_test_macros (7)
49 »²¾È):
50 .in
51 .sp
52 .BR dirfd ():
53 _BSD_SOURCE || _SVID_SOURCE
54 .\"O .SH DESCRIPTION
55 .SH ÀâÌÀ
56 .\"O The function
57 .\"O .BR dirfd ()
58 .\"O returns the file descriptor associated with the directory stream
59 .\"O .IR dirp .
60 ´Ø¿ô
61 .BR dirfd ()
62 ¤Ï¥Ç¥£¥ì¥¯¥È¥ê¡¦¥¹¥È¥ê¡¼¥à
63 .I dirp
64 ¤Ë´ØÏ¢¤Å¤±¤é¤ì¤¿¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¤òÊÖ¤¹¡£
65 .LP
66 .\"O This descriptor is the one used internally by the directory stream.
67 ¤³¤Î¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Ï¥Ç¥£¥ì¥¯¥È¥ê¡¦¥¹¥È¥ê¡¼¥à¤¬ÆâÉô¤Ç»ÈÍѤ¹¤ë¤â¤Î¤Ç¤¢¤ë¡£
68 .\"O As a result, it is only useful for functions which do not depend on
69 .\"O or alter the file position, such as
70 .\"O .BR fstat (2)
71 .\"O and
72 .\"O .BR fchdir (2).
73 ¤è¤Ã¤Æ¡¢¥Õ¥¡¥¤¥ë¤Î°ÌÃ֤˰͸¤»¤º¡¢¤«¤Ä¤½¤Î°ÌÃÖ¤òÊѹ¹¤·¤Ê¤¤´Ø¿ô
74 .BR fstat (2)
75 ¤ä
76 .BR fchdir (2)
77 ¤Ê¤É¤Ç¤·¤«Ìò¤ËΩ¤¿¤Ê¤¤¡£
78 .\"O It will be automatically closed when
79 .\"O .BR closedir (3)
80 .\"O is called.
81 ¤³¤Î¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Ï
82 .BR closedir (3)
83 ¤¬¸Æ¤Ð¤ì¤¿¤È¤­¤Ë¼«Æ°Åª¤Ë¥¯¥í¡¼¥º¤µ¤ì¤ë¡£
84 .\"O .SH RETURN VALUE
85 .SH ÊÖ¤êÃÍ
86 .\"O On success, a nonnegative file descriptor is returned.
87 .\"O On error, \-1 is returned.
88 À®¸ù¤¹¤ë¤È¡¢Éé¤Ç¤Ê¤¤ÃͤΥե¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤¬ÊÖ¤µ¤ì¤ë¡£
89 ¥¨¥é¡¼¤Î¾ì¹ç¤Ï \-1 ¤¬ÊÖ¤µ¤ì¤ë¡£
90 .\"O .SH ERRORS
91 .SH ¥¨¥é¡¼
92 .\"O POSIX.1-2008 specifies two errors,
93 .\"O neither of which is returned by the current
94 .\"O .\" glibc 2.8
95 .\"O implementation.
96 POSIX.1-2008 ¤Ç¤Ï 2 ¤Ä¤Î¥¨¥é¡¼¤¬µ¬Äꤵ¤ì¤Æ¤¤¤ë¡£
97 ¸½ºß¤Î¼ÂÁõ¤Ç¤Ï¤É¤Á¤é¤Î¥¨¥é¡¼¤âÊÖ¤µ¤ì¤Ê¤¤¡£
98 .\" glibc 2.8
99 .TP
100 .B EINVAL
101 .\"O .I dirp
102 .\"O does not refer to a valid directory stream.
103 .I dirp
104 ¤¬Í­¸ú¤Ê¥Ç¥£¥ì¥¯¥È¥ê¡¦¥¹¥È¥ê¡¼¥à¤ò»²¾È¤·¤Æ¤¤¤Ê¤¤¡£
105 .TP
106 .B ENOTSUP
107 .\"O The implementation does not support the association of a file
108 .\"O descriptor with a directory.
109 ¤³¤Î¼ÂÁõ¤Ç¤Ï¡¢¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Î¥Ç¥£¥ì¥¯¥È¥ê¤È¤Î´ØÏ¢ÉÕ¤±¤¬
110 ¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
111 .\"O .SH "CONFORMING TO"
112 .SH ½àµò
113 POSIX.1-2008.
114 .\"O This function was a BSD extension, present in 4.3BSD-Reno, not in 4.2BSD.
115 .\"O .\" It is present in libc5 (since 5.1.2) and in glibc2.
116 ¤³¤Î´Ø¿ô¤Ï BSD ³ÈÄ¥¤Ç¤¢¤Ã¤¿¡£
117 4.3BSD-Reno ¤Ë¤Ï¸ºß¤¹¤ë¤¬¡¢4.2BSD ¤Ë¤Ï¸ºß¤·¤Ê¤¤¡£
118 .\" libc5 (5.1.2 °Ê¹ß) ¤È glibc2 ¤Ë¸ºß¤¹¤ë¡£
119 .\"O .SH NOTES
120 .SH Ãí°Õ
121 .\"O The prototype for
122 .\"O .BR dirfd ()
123 .\"O is only available if
124 .\"O .B _BSD_SOURCE
125 .\"O or
126 .\"O .B _SVID_SOURCE
127 .\"O is defined.
128 .BR dirfd ()
129 ¤Î¥×¥í¥È¥¿¥¤¥×¤¬»ÈÍѲÄǽ¤Ê¤Î¤Ï¡¢
130 .B _BSD_SOURCE
131 ¤Þ¤¿¤Ï
132 .B _SVID_SOURCE
133 ¤¬ÄêµÁ¤µ¤ì¤¿¤È¤­¤Î¤ß¤Ç¤¢¤ë¡£
134 .\"O .SH "SEE ALSO"
135 .SH ´ØÏ¢¹àÌÜ
136 .BR open (2),
137 .BR closedir (3),
138 .BR opendir (3),
139 .BR readdir (3),
140 .BR rewinddir (3),
141 .BR scandir (3),
142 .BR seekdir (3),
143 .BR telldir (3)