freebsd-dev/sys/compat/cloudabi
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_clock.c Add a futex implementation for CloudABI. 2015-07-27 10:07:29 +00:00
cloudabi_errno.c Add a sysentvec for CloudABI on x86-64. 2015-07-16 18:24:06 +00:00
cloudabi_fd.c Make fstat() and friends work. 2015-07-28 06:36:49 +00:00
cloudabi_file.c Implement CloudABI's readdir(). 2015-07-29 06:31:44 +00:00
cloudabi_futex.c Add a futex implementation for CloudABI. 2015-07-27 10:07:29 +00:00
cloudabi_mem.c Implement CloudABI memory management system calls. 2015-07-17 09:00:38 +00:00
cloudabi_proc.c Make forking of CloudABI processes work. 2015-07-20 13:46:22 +00:00
cloudabi_proto.h
cloudabi_random.c Implement the CloudABI random_get() system call. 2015-07-14 18:45:15 +00:00
cloudabi_sock.c Implement the basic system calls that operate on pathnames. 2015-07-24 07:46:02 +00:00
cloudabi_syscalldefs.h Implement the basic system calls that operate on pathnames. 2015-07-24 07:46:02 +00:00
cloudabi_thread.c Add a futex implementation for CloudABI. 2015-07-27 10:07:29 +00:00
cloudabi_util.h Make fstat() and friends work. 2015-07-28 06:36:49 +00:00