| Rev | Author | # | Line |
|---|---|---|---|
| 1 | perry | 1 | !!NAME |
| 2 | |||
| 3 | |||
| 4 | getdents - get directory entries | ||
| 5 | !!SYNOPSIS | ||
| 2 | PerryLorier | 6 | __#include <unistd.h>__ |
| 7 | __#include <linux/types.h>__ | ||
| 8 | __#include <linux/dirent.h>__ | ||
| 9 | __#include <linux/unistd.h>__ | ||
| 1 | perry | 10 | |
| 2 | PerryLorier | 11 | __int getdents(unsigned int__ fd, __struct dirent *__ dirp, __unsigned int__ count __);__ |
| 1 | perry | 12 | |
| 13 | !!DESCRIPTION | ||
| 3 | PerryLorier | 14 | getdents(2) reads several ''dirent'' structures from the directory pointed at by ''fd'' into the memory area pointed to by ''dirp''. The parameter ''count'' is the size of the memory area. |
| 1 | perry | 15 | |
| 2 | PerryLorier | 16 | The ''dirent'' structure is declared as follows: |
| 17 | struct dirent | ||
| 18 | { | ||
| 19 | long d_ino; /* inode number */ | ||
| 20 | off_t d_off; /* offset to next ''dirent'' */ | ||
| 21 | unsigned short d_reclen; /* length of this ''dirent'' */ | ||
| 22 | char d_name [[NAME_MAX+1]; /* file name (null-terminated) */ | ||
| 23 | } | ||
| 1 | perry | 24 | |
| 2 | PerryLorier | 25 | ''d_ino'' is an inode number. ''d_off'' is the distance from the start of the directory to the start of the next ''dirent''. ''d_reclen'' is the size of this entire ''dirent. d_name'' is a null-terminated file name. |
| 1 | perry | 26 | |
| 2 | PerryLorier | 27 | This call supersedes readdir(2). |
| 1 | perry | 28 | |
| 29 | !!RETURN VALUE | ||
| 30 | |||
| 2 | PerryLorier | 31 | On success, the number of bytes read is returned. On end of directory, 0 is returned. On error, -1 is returned, and ''errno'' is set appropriately. |
| 1 | perry | 32 | |
| 33 | !!ERRORS | ||
| 2 | PerryLorier | 34 | ;[EBADF]: Invalid file descriptor ''fd''. |
| 35 | ;[EFAULT]: Argument points outside the calling process's address space. | ||
| 36 | ;[EINVAL]: Result buffer is too small. | ||
| 37 | ;[ENOENT]: No such directory. | ||
| 38 | ;[ENOTDIR]: File descriptor does not refer to a directory. | ||
| 1 | perry | 39 | |
| 40 | !!CONFORMING TO | ||
| 2 | PerryLorier | 41 | SVr4, SVID. SVr4 documents additional [ENOLINK], [EIO] error conditions. |
| 1 | perry | 42 | |
| 43 | !!SEE ALSO | ||
| 44 | readdir(2), readdir(3) |
lib/blame.php:177: Warning: Invalid argument supplied for foreach() (...repeated 8 times)