READDIR

Section: ¸®´ª½º ÇÁ·Î±×·¡¸Ó ¸Å´º¾ó (2)
Updated: 1995³â 6¿ù 22ÀÏ
Index
Return to Main Contents
 

À̸§

readdir - µð·ºÅ丮 ¿£Æ®¸®¸¦ Àд´Ù.  

»ç¿ë¹ý

#include <unistd.h>
#include <linux/dirent.h>
#include <linux/unistd.h>

_syscall3(int, readdir, uint, fd, struct dirent *, dirp, uint, count);

int readdir(unsigned int fd, struct dirent *dirp, unsigned int count);
 

¼³¸í

ÀÌ°ÍÀº ¿©·¯ºÐÀÌ Èï¹Ì·Î¿ö ÇÒ ÇÔ¼ö°¡ ¾Æ´Ï´Ù. C ¶óÀ̺귯¸® ÀÎÅÍÆäÀ̽º¿¡ ±¸ÇöµÈ POSIX ¸¦ À§ÇÑ readdir(3)¸¦ ÂüÁ¶Çضó. ÀÌ ÆäÀÌÁö´Â ÀÌ¹Ì ¹Ù²ï ¿¹Àü Ä¿³Î ½Ã½ºÅÛ ÄÝ ÀÎÅÍÆäÀ̽º¸¦ À§ÇÑ ¹®¼­À̸ç ÀÌ ÇÔ¼ö´Â getdents(2)°¡ ´ë½ÅÇÏ°í ÀÖ´Ù.

readdir ´Â fd ¿¡ ÀÇÇØ Æ÷ÀÎÆ®µÈ µð·ºÅ丮¿¡¼­ dirp¿¡ ÀÇÇØ Æ÷ÀÎÆ®µÈ ¸Þ¸ð¸® Áö¿ª¿¡ dirent ±¸Á¶Ã¼¸¦ Àд´Ù. count ÀÎÀÚ´Â ¹«½ÃµÈ´Ù;

dirent ±¸Á¶Ã¼¿¡ ´ÙÀ½°ú °°ÀÌ ¼±¾ðµÈ´Ù:

struct dirent
{
    long d_ino;                 /* ¾ÆÀ̳ëµå ¼ö */
    off_t d_off;                /* dirent ÀÇ ¿ÀÇÁ¼Â */
    unsigned short d_reclen;    /* d_name ÀÇ ±æÀÌ */
    char d_name [NAME_MAX+1];   /* ÆÄÀÏ À̸§(³Î·Î Á¾·á) */
}

d_ino ´Â inode ¼ýÀÚÀÌ´Ù. d_off ´Â µð·ºÅ丮ÀÇ ½ÃÀÛ¿¡¼­ dirent±îÁöÀÇ °Å¸®ÀÌ´Ù. d_reclen ´Â ³Î Á¾°áÀÚ¸¦ ¼¼Áö ¾ÊÀº d_nameÀÇ Å©±âÀÌ´Ù. d_name ´Â ³Î·Î ³¡³­ ÆÄÀÏ À̸§ÀÌ´Ù.

 

¹Ýȯ°ª

¼º°ø½Ã, 1ÀÌ ¸®ÅϵȴÙ. µð·ºÅ丮 ³¡¿¡¼­ 0ÀÌ ¸®ÅϵȴÙ. ¿¡·¯½Ã, -1ÀÌ ¸®ÅϵǸç errno ´Â Àû´çÇÑ °ªÀ¸·Î ¼³Á¤µÈ´Ù.  

¿¡·¯

EBADF
À¯È¿ ÇÏÁö ¾ÊÀº ÆÄÀÏ ±â¼úÀÚ fd.
EFAULT
ÀÎÀÚ°¡ È£Ãâ ÇÁ·Î¼¼½ºÀÇ ÁÖ¼Ò °ø°£¿Ü¸¦ °¡¸®Å°°í ÀÖ´Ù.
EINVAL
°á°ú ¹öÆÛ°¡ ³Ê¹« ÀÛ´Ù.
ENOENT
ÇØ´ç µð·ºÅ丮°¡ ¾ø´Ù.
ENOTDIR
ÆÄÀÏ ±â¼úÀÚ°¡ µð·ºÅ丮¸¦ °¡¸®Å°Áö ¾Ê´Â´Ù.
 

ȣȯ

ÀÌ ½Ã½ºÅÛ ÄÝÀº ¸®´ª½º¿¡ ÀÇÁ¸ÇÑ´Ù.  

°ü·Ã Ç׸ñ

getdents(2), readdir(3)  

¿ªÀÚ

Á¤°­ÈÆ <skyeyes@soback.kornet.net>, 2000³â 8¿ù 7ÀÏ


 

Index

À̸§
»ç¿ë¹ý
¼³¸í
¹Ýȯ°ª
¿¡·¯
ȣȯ
°ü·Ã Ç׸ñ
¿ªÀÚ

This document was created by man2html, using the manual pages.
Time: 08:07:01 GMT, March 25, 2004