1 .\" Copyright (C) 2002 Andries Brouwer (aeb@cwi.nl)
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.
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>
31 .TH DIRFD 3 2008-08-21 "Linux" "Linux Programmer's Manual"
34 .\"O dirfd \- get directory stream file descriptor
35 dirfd \- ¥Ç¥£¥ì¥¯¥È¥ê¡¦¥¹¥È¥ê¡¼¥à¤Î¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¤ò¼èÆÀ¤¹¤ë
38 .B #include <sys/types.h>
40 .B #include <dirent.h>
42 .BI "int dirfd(DIR *" dirp );
45 .\"O Feature Test Macro Requirements for glibc (see
46 .\"O .BR feature_test_macros (7)):
47 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
48 .RB ( feature_test_macros (7)
53 _BSD_SOURCE || _SVID_SOURCE
58 .\"O returns the file descriptor associated with the directory stream
62 ¤Ï¥Ç¥£¥ì¥¯¥È¥ê¡¦¥¹¥È¥ê¡¼¥à
64 ¤Ë´ØÏ¢¤Å¤±¤é¤ì¤¿¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¤òÊÖ¤¹¡£
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
73 ¤è¤Ã¤Æ¡¢¥Õ¥¡¥¤¥ë¤Î°ÌÃ֤˰͸¤»¤º¡¢¤«¤Ä¤½¤Î°ÌÃÖ¤òÊѹ¹¤·¤Ê¤¤´Ø¿ô
77 ¤Ê¤É¤Ç¤·¤«Ìò¤ËΩ¤¿¤Ê¤¤¡£
78 .\"O It will be automatically closed when
83 ¤¬¸Æ¤Ð¤ì¤¿¤È¤¤Ë¼«Æ°Åª¤Ë¥¯¥í¡¼¥º¤µ¤ì¤ë¡£
86 .\"O On success, a nonnegative file descriptor is returned.
87 .\"O On error, \-1 is returned.
88 À®¸ù¤¹¤ë¤È¡¢Éé¤Ç¤Ê¤¤ÃͤΥե¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤¬ÊÖ¤µ¤ì¤ë¡£
89 ¥¨¥é¡¼¤Î¾ì¹ç¤Ï \-1 ¤¬ÊÖ¤µ¤ì¤ë¡£
92 .\"O POSIX.1-2008 specifies two errors,
93 .\"O neither of which is returned by the current
96 POSIX.1-2008 ¤Ç¤Ï 2 ¤Ä¤Î¥¨¥é¡¼¤¬µ¬Äꤵ¤ì¤Æ¤¤¤ë¡£
97 ¸½ºß¤Î¼ÂÁõ¤Ç¤Ï¤É¤Á¤é¤Î¥¨¥é¡¼¤âÊÖ¤µ¤ì¤Ê¤¤¡£
102 .\"O does not refer to a valid directory stream.
104 ¤¬Í¸ú¤Ê¥Ç¥£¥ì¥¯¥È¥ê¡¦¥¹¥È¥ê¡¼¥à¤ò»²¾È¤·¤Æ¤¤¤Ê¤¤¡£
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"
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 ¤Ë¸ºß¤¹¤ë¡£
121 .\"O The prototype for
123 .\"O is only available if
129 ¤Î¥×¥í¥È¥¿¥¤¥×¤¬»ÈÍѲÄǽ¤Ê¤Î¤Ï¡¢
133 ¤¬ÄêµÁ¤µ¤ì¤¿¤È¤¤Î¤ß¤Ç¤¢¤ë¡£