-
Notifications
You must be signed in to change notification settings - Fork 112
Open
Description
We currently implement the following non-standardized Linux interface for getting directory entries, getdents(2):
ssize_t getdents64(int fd, void dirp[.count], size_t count);
struct linux_dirent64 {
ino64_t d_ino; /* 64-bit inode number */
off64_t d_off; /* Not an offset; see getdents() */
unsigned short d_reclen; /* Size of this dirent */
unsigned char d_type; /* File type */
char d_name[]; /* Filename (null-terminated) */
};d_off is a filesystem-specific value with no specific meaning to user space, though on older filesystems it used to be the distance from the start of the directory to the start of the next linux_dirent; see readdir(3).
We could gradually adopt the following standardized interface, posix_getdents, <dirent.h>:
ssize_t posix_getdents(int fildes, void *buf, size_t nbyte, int flags);
struct posix_dent {
ino_t d_ino File serial number.
reclen_t d_reclen Length of this entry, including trailing
padding if necessary. See posix_getdents().
unsigned char d_type File type or unknown-file-type indication.
char d_name[] Filename string of this entry.
};This would mainly benefit from being standardized and something we can commit to. Additionally, it is nice to get rid of the very unusual d_off.
Metadata
Metadata
Assignees
Labels
No labels