getdents

Autres langues

Langue: pl

Autres versions - même langue

Version: 1995-07-22 (openSuse - 09/10/07)

Section: 2 (Appels système)

NAZWA

getdents - pobranie wpisów z katalogu

SK£ADNIA


#include <unistd.h>

#include <linux/types.h>

#include <linux/dirent.h>

#include <linux/unistd.h>



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



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

OPIS

getdents odczytuje kolejne struktury dirent z katalogu wskazywanego przez fd do obszaru pamiêci wskazywanego przez dirp. Parametr count jest rozmiarem obszaru pamiêci.

Struktura dirent jest zadeklarowana nastêpuj±co:


struct dirent

{

    long d_ino;                 /* numer i-wêz³a */

    off_t d_off;                /* offset do nastêpnego dirent */

    unsigned short d_reclen;    /* d³ugo¶æ tego dirent */

    char d_name [NAZWA_MAX+1];   /* nazwa pliku (zakoñczona NUL) */

}

d_ino jest numerem i-wêz³a. d_off jest odleg³o¶ci± od pocz±tku katalogu do pocz±tku nastêpnej struktury dirent. d_reclen jest wielko¶ci± tej ca³ej struktury dirent. d_name jest nazw± pliku zakoñczon± znakiem NUL.

Ta funkcja zastêpuje readdir(2).

WARTO¦Æ ZWRACANA

Po pomy¶lnym zakoñczeniu zwracana jest ilo¶æ odczytanych bajtów. Na koñcu katalogu zwracane jest 0. Przy b³êdzie zwracane jest -1 i odpowiednio ustawiane errno.

B£ÊDY

EBADF
Nieprawid³owy deskryptor pliku fd.
EFAULT
Argument wskazuje poza przestrzeñ adresow± wywo³uj±cego procesu.
EINVAL
Bufor wynikowy jest za ma³y.
ENOENT
Nie ma takiego katalogu.
ENOTDIR
Deskryptor pliku nie odnosi siê do katalogu.

ZGODNE Z

SVr4, SVID. SVr4 dokumentuje dodatkowe b³êdy ENOLINK, EIO.

ZOBACZ TAK¯E

readdir(2), readdir(3)