Page MenuHomeFreeBSD

Add file_open(): the underlying system call of openat().
ClosedPublic

Authored by ed on Jul 29 2015, 1:33 PM.
Tags
None
Referenced Files
F150065389: D3235.id7699.diff
Sun, Mar 29, 2:52 AM
F150024161: D3235.id7699.diff
Sat, Mar 28, 8:02 PM
Unknown Object (File)
Thu, Mar 26, 7:27 AM
Unknown Object (File)
Wed, Mar 25, 11:47 PM
Unknown Object (File)
Wed, Mar 25, 1:41 AM
Unknown Object (File)
Mon, Mar 16, 4:39 PM
Unknown Object (File)
Fri, Mar 13, 4:46 AM
Unknown Object (File)
Fri, Mar 13, 4:38 AM
Subscribers

Details

Summary

CloudABI purely operates on file descriptor rights (CAP_*). File
descriptor access modes (O_ACCMODE) are emulated on top of rights.

Instead of accepting the traditional flags argument, file_open() copies
in an fdstat_t object that contains the initial rights the descriptor
should have, but also file descriptor flags that should persist after
opening (APPEND, NONBLOCK, *SYNC). Only flags that don't persist (EXCL,
TRUNC, CREAT, DIRECTORY) are passed in as an argument.

file_open() first converts the rights, the persistent flags and the
non-persistent flags to fflags. It then calls into vn_open(). If
successful, it installs the file descriptor with the requested
rights, trimming off rights that don't apply to the type of
the file that has been opened.

Unlike kern_openat(), this function does not support /dev/fd/*. I can't
think of a reason why we need to support this for CloudABI.

Test Plan

This implementation passes the cloudlibc test suite:
https://github.com/NuxiNL/cloudlibc/blob/master/src/libc/fcntl/openat_test.c

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

ed retitled this revision from to Add file_open(): the underlying system call of openat()..
ed updated this object.
ed edited the test plan for this revision. (Show Details)
ed added reviewers: mjg, pjd, jonathan.
This revision was automatically updated to reflect the committed changes.