163 lines
5.4 KiB
Groff
163 lines
5.4 KiB
Groff
.\" Copyright (c) 1983, 1991, 1993
|
||
.\" The Regents of the University of California. All rights reserved.
|
||
.\"
|
||
.\" Redistribution and use in source and binary forms, with or without
|
||
.\" modification, are permitted provided that the following conditions
|
||
.\" are met:
|
||
.\" 1. Redistributions of source code must retain the above copyright
|
||
.\" notice, this list of conditions and the following disclaimer.
|
||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||
.\" notice, this list of conditions and the following disclaimer in the
|
||
.\" documentation and/or other materials provided with the distribution.
|
||
.\" 3. All advertising materials mentioning features or use of this software
|
||
.\" must display the following acknowledgement:
|
||
.\" This product includes software developed by the University of
|
||
.\" California, Berkeley and its contributors.
|
||
.\" 4. Neither the name of the University nor the names of its contributors
|
||
.\" may be used to endorse or promote products derived from this software
|
||
.\" without specific prior written permission.
|
||
.\"
|
||
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||
.\" SUCH DAMAGE.
|
||
.\"
|
||
.\" @(#)dir.5 8.3 (Berkeley) 4/19/94
|
||
.\" %Id: dir.5,v 1.9 1998/02/24 02:39:00 bde Exp %
|
||
.\"
|
||
.\" jpman %Id: dir.5,v 1.3 1998/07/19 22:22:07 yohta Stab %
|
||
.\"
|
||
.\" WORD: graft Àܹç [mount.8]
|
||
.Dd April 19, 1994
|
||
.Dt DIR 5
|
||
.Os BSD 4.2
|
||
.Sh ̾¾Î
|
||
.Nm dir ,
|
||
.Nm dirent
|
||
.Nd ¥Ç¥£¥ì¥¯¥È¥ê¥Õ¥¡¥¤¥ë¥Õ¥©¡¼¥Þ¥Ã¥È
|
||
.Sh ½ñ¼°
|
||
.Fd #include <sys/types.h>
|
||
.Fd #include <dirent.h>
|
||
.Sh ²òÀâ
|
||
¥Ç¥£¥ì¥¯¥È¥ê¤Ï¡¢ÅÚÂæ¤È¤Ê¤ëµ²±ÇÞÂΤξܺ٤ò±£Êä·¡¢
|
||
¥Õ¥¡¥¤¥ë¤ò¥°¥ë¡¼¥×ʬ¤±¤¹¤ëÊØÍø¤Ê³¬ÁؼêÃʤòÄ󶡤·¤Þ¤¹¡£
|
||
¥Ç¥£¥ì¥¯¥È¥ê¥Õ¥¡¥¤¥ë¤Ï¡¢¤½¤Î
|
||
.Xr inode 5
|
||
¥¨¥ó¥È¥êÃæ¤Î¥Õ¥é¥°¤Ë¤è¤Ã¤Æ¡¢Ä̾ï¥Õ¥¡¥¤¥ë¤È¶èÊ̤µ¤ì¤Þ¤¹¡£
|
||
¥Ç¥£¥ì¥¯¥È¥ê¥Õ¥¡¥¤¥ë¤Ï¥ì¥³¡¼¥É (¥Ç¥£¥ì¥¯¥È¥ê¥¨¥ó¥È¥ê) ¤«¤é¹½À®¤µ¤ì¡¢
|
||
³Æ¥ì¥³¡¼¥É¤Ï¥Õ¥¡¥¤¥ë¤Ë´Ø¤¹¤ë¾ðÊó¤È¤½¤Î¥Õ¥¡¥¤¥ë¼«¿È¤Ø¤Î¥Ý¥¤¥ó¥¿¤ò
|
||
´Þ¤ó¤Ç¤¤¤Þ¤¹¡£
|
||
¥Ç¥£¥ì¥¯¥È¥ê¥¨¥ó¥È¥ê¤Ï¡¢Ä̾ï¥Õ¥¡¥¤¥ë¤ÈƱÍͤˡ¢
|
||
¾¤Î¥Ç¥£¥ì¥¯¥È¥ê¤ò´Þ¤à¤³¤È¤â¤¢¤ê¤Þ¤¹¡£
|
||
¤½¤Î¤è¤¦¤ÊÆþ¤ì»Ò¤Ë¤Ê¤Ã¤¿¥Ç¥£¥ì¥¯¥È¥ê¤Ï¥µ¥Ö¥Ç¥£¥ì¥¯¥È¥ê¤È¸Æ¤Ð¤ì¤Þ¤¹¡£
|
||
¤³¤Î¤è¤¦¤Ë¤·¤Æ¥Ç¥£¥ì¥¯¥È¥ê¤È¥Õ¥¡¥¤¥ë¤Î³¬Áع½Â¤¤¬·ÁÀ®¤µ¤ì¡¢
|
||
¤³¤Î¹½Â¤¤Ï¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤È¸Æ¤Ð¤ì¤Þ¤¹ (¤¢¤ë¤¤¤Ï¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¥Ä¥ê¡¼
|
||
¤È¸Æ¤Ð¤ì¤Þ¤¹)¡£
|
||
.\" °Ê²¼¤Î3¹Ô¤Ï±Ñ¸ìÈǤ˥³¥á¥ó¥È¤Î·Á¤Ç´Þ¤Þ¤ì¤Æ¤¤¤¿¤â¤Î
|
||
.\" An entry in this tree,
|
||
.\" nested or not nested,
|
||
.\" is a pathname.
|
||
.Pp
|
||
³Æ¥Ç¥£¥ì¥¯¥È¥ê¥Õ¥¡¥¤¥ë¤Ë¤ÏÆÃÊ̤ʥǥ£¥ì¥¯¥È¥ê¥¨¥ó¥È¥ê¤¬ 2 ¤Ä¤¢¤ê¤Þ¤¹¡£
|
||
1 ¤Ä¤Ï¤½¤Î¥Ç¥£¥ì¥¯¥È¥ê¼«¿È¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¡¢¥É¥Ã¥È
|
||
.Ql \&.
|
||
¤È¸Æ¤Ð¤ì¤Þ¤¹¡£
|
||
¤â¤¦ 1 ¤Ä¤Ï¼«Ê¬¤Î¿Æ¥Ç¥£¥ì¥¯¥È¥ê¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¡¢¥É¥Ã¥È¥É¥Ã¥È
|
||
.Ql \&..
|
||
¤È¸Æ¤Ð¤ì¤Þ¤¹¡£
|
||
¥É¥Ã¥È¤È¥É¥Ã¥È¥É¥Ã¥È¤Ï͸ú¤Ê¥Ñ¥¹Ì¾¤Ç¤¹¤¬¡¢
|
||
¥·¥¹¥Æ¥à¤Î¥ë¡¼¥È¥Ç¥£¥ì¥¯¥È¥ê
|
||
.Ql /
|
||
¤Ë¤Ï¿Æ¥Ç¥£¥ì¥¯¥È¥ê¤¬¤Ê¤¯¡¢¥É¥Ã¥È¥É¥Ã¥È¤Ï¥É¥Ã¥È¤ÈƱ¤¸¤¯¼«Ê¬¼«¿È¤ò»Ø¤·¤Þ¤¹¡£
|
||
.Pp
|
||
¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¥Î¡¼¥É¤ÏÉáÄ̤Υǥ£¥ì¥¯¥È¥ê¥Õ¥¡¥¤¥ë¤Ç¤¢¤ê¡¢
|
||
¤½¤Î¾å¤ËʪÍý¥Ç¥£¥¹¥¯¤ä¤½¤Î¥Ç¥£¥¹¥¯Ãæ¤Îʬ³ä¤µ¤ì¤¿Îΰè¤È¤¤¤Ã¤¿
|
||
¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¥ª¥Ö¥¸¥§¥¯¥È¤òÀܹ礷¤Þ¤¹
|
||
(
|
||
.Xr mount 2
|
||
¤ª¤è¤Ó
|
||
.Xr mount 8
|
||
»²¾È)¡£
|
||
.Pp
|
||
¥Ç¥£¥ì¥¯¥È¥ê¥¨¥ó¥È¥ê¤Î·Á¼°¤Ï¥Õ¥¡¥¤¥ë
|
||
.Aq sys/dirent.h
|
||
¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤¹
|
||
(¤³¤ì¤ÏľÀÜ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤«¤é¤Ï¥¤¥ó¥¯¥ë¡¼¥É¤µ¤ì¤Þ¤»¤ó):
|
||
.Bd -literal
|
||
#ifndef _SYS_DIRENT_H_
|
||
#define _SYS_DIRENT_H_
|
||
|
||
/*
|
||
* dirent ¹½Â¤ÂΤϡ¢getdirentries(2) ¥·¥¹¥Æ¥à¥³¡¼¥ë¤ÇÊÖ¤µ¤ì¤ë
|
||
* ¥Ç¥£¥ì¥¯¥È¥ê¥¨¥ó¥È¥ê¤Î¥Õ¥©¡¼¥Þ¥Ã¥È¤òÄêµÁ¤·¤Þ¤¹¡£
|
||
*
|
||
* ¥Ç¥£¥ì¥¯¥È¥ê¥¨¥ó¥È¥ê¤Ï¤½¤ÎÀèÆ¬¤Ë dirent ¹½Â¤ÂΤò»ý¤Á¤Þ¤¹¡£dirent
|
||
* ¹½Â¤ÂÎ¤Ï inode Èֹ桢¤½¤Î¥¨¥ó¥È¥ê¤ÎŤµ¡¢¤½¤Î¥¨¥ó¥È¥ê¤Ë´Þ¤Þ¤ì¤ë
|
||
* ̾Á°¤ÎŤµ¤òÊÝ»ý¤·¤Þ¤¹¡£¤½¤Î¸å¤Ë¡¢¥Ê¥ë¤Ç 4 ¥Ð¥¤¥È¶³¦¤Þ¤Ç¥Ñ¥Ç¥£¥ó¥°
|
||
* ¤·¤¿Ì¾Á°¤¬Â³¤¤Þ¤¹¡£Ì¾Á°¤ÏÁ´¤Æ¥Ê¥ë¤Ç½ªÃ¼¤·¤Æ¤¤¤ë¤³¤È¤¬Êݾڤµ¤ì¤Þ¤¹¡£
|
||
* ¥Ç¥£¥ì¥¯¥È¥êÃæ¤Î̾Á°¤ÎŤµ¤ÎºÇÂçÃÍ¤Ï MAXNAMLEN ¤Ç¤¹¡£
|
||
*/
|
||
|
||
struct dirent {
|
||
u_int32_t d_fileno; /* ¥¨¥ó¥È¥ê¤Î¥Õ¥¡¥¤¥ëÈÖ¹æ */
|
||
u_int16_t d_reclen; /* ¤³¤Î¥ì¥³¡¼¥É¤ÎŤµ */
|
||
u_int8_t d_type; /* ¥Õ¥¡¥¤¥ë¥¿¥¤¥×, °Ê²¼»²¾È */
|
||
u_int8_t d_namlen; /* d_name ¤Îʸ»úÎóĹ */
|
||
#ifdef _POSIX_SOURCE
|
||
char d_name[255 + 1]; /* ̾Á°¤Ï¤³¤ÎŤµ¤ò±Û¤¨¤Æ¤Ï¤Ê¤é¤Ê¤¤ */
|
||
#else
|
||
#define MAXNAMLEN 255
|
||
char d_name[MAXNAMLEN + 1]; /* ̾Á°¤Ï¤³¤ÎŤµ¤ò±Û¤¨¤Æ¤Ï¤Ê¤é¤Ê¤¤ */
|
||
#endif
|
||
|
||
};
|
||
|
||
/*
|
||
* ¥Õ¥¡¥¤¥ë¥¿¥¤¥×
|
||
*/
|
||
#define DT_UNKNOWN 0
|
||
#define DT_FIFO 1
|
||
#define DT_CHR 2
|
||
#define DT_DIR 4
|
||
#define DT_BLK 6
|
||
#define DT_REG 8
|
||
#define DT_LNK 10
|
||
#define DT_SOCK 12
|
||
#define DT_WHT 14
|
||
|
||
/*
|
||
* stat ¹½Â¤Âη¿¤È¥Ç¥£¥ì¥¯¥È¥ê·¿¤È¤ÎÊÑ´¹
|
||
*/
|
||
#define IFTODT(mode) (((mode) & 0170000) >> 12)
|
||
#define DTTOIF(dirtype) ((dirtype) << 12)
|
||
|
||
/*
|
||
* _GENERIC_DIRSIZ ¥Þ¥¯¥í¤Ï¥Ç¥£¥ì¥¯¥È¥ê¥¨¥ó¥È¥ê¤òÊÝ»ý¤¹¤ëºÇ¾®¥ì¥³¡¼¥ÉŤò
|
||
* Í¿¤¨¤Þ¤¹¡£¤³¤ì¤Ï d_name ¥Õ¥£¡¼¥ë¥É°Ê³°¤Î dirent ¹½Â¤ÂΤζõ´Ö¤Ë¡¢¥Ê¥ë
|
||
* ¥Ð¥¤¥È¤Ç½ªÃ¼¤µ¤ì¤ë̾Á°¤Î¤¿¤á¤Ë½½Ê¬¤Ê¶õ´Ö (dp->d_namlen+1) ¤ò²Ã¤¨¤¿¤â¤Î
|
||
* ¤ò¡¢4 ¥Ð¥¤¥Èñ°Ì¤Ç·«¤ê¾å¤²¤¿¤â¤Î¤Ç¤¹¡£
|
||
*/
|
||
#define _GENERIC_DIRSIZ(dp) \
|
||
((sizeof (struct dirent) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3))
|
||
|
||
#ifdef KERNEL
|
||
#define GENERIC_DIRSIZ(dp) _GENERIC_DIRSIZ(dp)
|
||
#endif
|
||
|
||
.Ed
|
||
.Sh ´ØÏ¢¹àÌÜ
|
||
.Xr fs 5 ,
|
||
.Xr inode 5
|
||
.Sh Îò»Ë
|
||
¥Õ¥¡¥¤¥ë·Á¼°
|
||
.Nm
|
||
¤Ï
|
||
.At v7
|
||
¤ÇÅо줷¤Þ¤·¤¿¡£
|