Rev | Author | # | Line |
---|---|---|---|
1 | perry | 1 | !!NAME |
2 | PerryLorier | 2 | readdir - read directory entry |
1 | perry | 3 | |
4 | !!SYNOPSIS | ||
2 | PerryLorier | 5 | __#include <unistd.h>__ |
6 | __#include <linux/dirent.h>__ | ||
7 | __#include <linux/unistd.h>__ | ||
1 | perry | 8 | |
2 | PerryLorier | 9 | __int readdir(unsigned int__ ''fd''__, struct dirent *__''dirp''__, unsigned int__ ''count''__);__ |
1 | perry | 10 | |
11 | !!DESCRIPTION | ||
2 | PerryLorier | 12 | This is not the function you are interested in. Look at readdir(3) for the [POSIX] conforming C library interface. This page documents the bare kernel system call interface, which can change, and which is superseded by getdents(2). |
1 | perry | 13 | |
2 | PerryLorier | 14 | __readdir__ reads one ''dirent'' structure from the directory pointed at by ''fd'' into the memory area pointed to by ''dirp''. The parameter ''count'' is ignored; at most one dirent structure is read. |
1 | perry | 15 | |
2 | PerryLorier | 16 | The ''dirent'' structure is declared as follows: |
1 | perry | 17 | |
2 | PerryLorier | 18 | struct dirent |
19 | { | ||
20 | long d_ino; /* inode number */ | ||
21 | off_t d_off; /* offset to this ''dirent'' */ | ||
22 | unsigned short d_reclen; /* length of this ''d_name'' */ | ||
23 | char d_name [[NAME_MAX+1]; /* file name (null-terminated) */ | ||
24 | } | ||
1 | perry | 25 | |
2 | PerryLorier | 26 | ''d_ino'' is an inode number. ''d_off'' is the distance from the start of the directory to this ''dirent''. ''d_reclen'' is the size of ''d_name,'' not counting the null terminator. ''d_name'' is a null-terminated file name. |
1 | perry | 27 | |
28 | !!RETURN VALUE | ||
2 | PerryLorier | 29 | On success, 1 is returned. On end of directory, 0 is returned. On error, -1 is returned, and ''errno'' is set appropriately. |
1 | perry | 30 | |
31 | !!ERRORS | ||
2 | PerryLorier | 32 | ;[EBADF]: Invalid file descriptor ''fd''. |
33 | ;[EFAULT]: Argument points outside the calling process's address space. | ||
34 | ;[EINVAL]: Result buffer is too small. | ||
35 | ;[ENOENT]: No such directory. | ||
36 | ;[ENOTDIR]: File descriptor does not refer to a directory. | ||
1 | perry | 37 | |
38 | !!CONFORMING TO | ||
2 | PerryLorier | 39 | This system call is Linux specific. |
1 | perry | 40 | |
41 | !!SEE ALSO | ||
42 | getdents(2), readdir(3) |
lib/blame.php:177: Warning: Invalid argument supplied for foreach() (...repeated 9 times)