3720b82fa8
Summary: CloudABI's readdir() system call could be thought of as a mixture between FreeBSD's getdents(2) and pread(). Instead of using the file descriptor offset, userspace provides a 64-bit cloudabi_dircookie_t continue reading at a given point. CLOUDABI_DIRCOOKIE_START, having value 0, can be used to return entries at the start of the directory. The file descriptor offset is not used to store the cookie for the reason that in a file descriptor centric environment, it would make sense to allow concurrent use of a single file descriptor. The remaining space returned by the system call should be filled with a partially truncated copy of the next entry. The advantage of doing this is that it gracefully deals with long filenames. If the C library provides a buffer that is too small to hold a single entry, it can still extract the directory entry header, meaning that it can retry the read with a larger buffer or skip it using the cookie. Test Plan: This implementation passes the cloudlibc unit tests at: https://github.com/NuxiNL/cloudlibc/tree/master/src/libc/dirent Reviewers: marcel, kib Reviewed By: kib Subscribers: imp Differential Revision: https://reviews.freebsd.org/D3226 |
||
---|---|---|
.. | ||
cloudabi | ||
cloudabi64 | ||
freebsd32 | ||
ia32 | ||
linprocfs | ||
linsysfs | ||
linux | ||
ndis | ||
netbsd | ||
svr4 | ||
x86bios |