HomeFreeBSD

Make fstat() and friends work.

Description

Make fstat() and friends work.

Summary:
CloudABI provides access to two different stat structures:

  • fdstat, containing file descriptor level status: oflags, file descriptor type and Capsicum rights, used by cap_rights_get(), fcntl(F_GETFL), getsockopt(SO_TYPE).
  • filestat, containing your regular file status: timestamps, inode number, used by fstat().

Unlike FreeBSD's stat::st_mode, CloudABI file descriptor types don't
have overloaded meanings (e.g., returning S_ISCHR() for kqueues). Add a
utility function to extract the type of a file descriptor accurately.

CloudABI does not work with O_ACCMODEs. File descriptors have two sets
of Capsicum-style rights: rights that apply to the file descriptor
itself ('base') and rights that apply to any new file descriptors
yielded through openat() ('inheriting'). Though not perfect, we can
pretty safely decompose Capsicum rights to such a pair. This is done in
convert_capabilities().

Test Plan: Tests for these system calls are fairly extensive in cloudlibc.

Reviewers: jonathan, mjg, manpages

Reviewed By: mjg

Subscribers: imp

Differential Revision: https://reviews.freebsd.org/D3171

Details

Provenance
edAuthored on
Reviewer
mjg
Differential Revision
D3171: Make fstat() and friends work.
Parents
rS285929: make ctdladm(8) return 0 is everything was ok.
Branches
Unknown
Tags
Unknown