freebsd-dev/sys/compat
Ed Schouten 3720b82fa8 Implement CloudABI's readdir().
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
2015-07-29 06:31:44 +00:00
..
cloudabi Implement CloudABI's readdir(). 2015-07-29 06:31:44 +00:00
cloudabi64 Regenerate system call table. 2015-07-27 10:04:28 +00:00
freebsd32 Regenerate syscalls. 2015-07-11 15:22:11 +00:00
ia32 In preparation for switching linuxulator to the use the native 1:1 2015-05-24 14:51:29 +00:00
linprocfs Add support to the jail framework to be able to mount linsysfs(5) and 2015-07-19 08:52:35 +00:00
linsysfs Add support to the jail framework to be able to mount linsysfs(5) and 2015-07-19 08:52:35 +00:00
linux The si_status field of the siginfo_t, provided by the waitid(2) and 2015-07-18 09:02:50 +00:00
ndis Create a dedicated function for ensuring that cdir and rdir are populated. 2015-07-11 16:22:48 +00:00
netbsd Remove some more NetBSD compat shims and other unused bits from these 2012-09-10 18:49:49 +00:00
svr4 The si_status field of the siginfo_t, provided by the waitid(2) and 2015-07-18 09:02:50 +00:00
x86bios Pull in r267961 and r267973 again. Fix for issues reported will follow. 2014-06-28 03:56:17 +00:00