diff options
author | ed <ed@FreeBSD.org> | 2015-07-29 17:18:27 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2015-07-29 17:18:27 +0000 |
commit | 2aaddce9ba5b701871b391a1ee7bdd31917766a0 (patch) | |
tree | b3859e39cb480af3103e9c6bf3bf05ce156893d7 /sys/sys/syscallsubr.h | |
parent | 4072f1cf769d51d0ca066d83b0e921cf3ec74bb6 (diff) | |
download | FreeBSD-src-2aaddce9ba5b701871b391a1ee7bdd31917766a0.zip FreeBSD-src-2aaddce9ba5b701871b391a1ee7bdd31917766a0.tar.gz |
Make pipes in CloudABI work.
Summary:
Pipes in CloudABI are unidirectional. The reason for this is that
CloudABI attempts to provide a uniform runtime environment across
different flavours of UNIX.
Instead of implementing a custom pipe that is unidirectional, we can
simply reuse Capsicum permission bits to support this. This is nice,
because CloudABI already attempts to restrict permission bits to
correspond with the operations that apply to a certain file descriptor.
Replace kern_pipe() and kern_pipe2() by a single kern_pipe() that takes
a pair of filecaps. These filecaps are passed to the newly introduced
falloc_caps() function that creates the descriptors with rights in
place.
Test Plan:
CloudABI pipes seem to be created with proper rights in place:
https://github.com/NuxiNL/cloudlibc/blob/master/src/libc/unistd/pipe_test.c#L44
Reviewers: jilles, mjg
Reviewed By: mjg
Subscribers: imp
Differential Revision: https://reviews.freebsd.org/D3236
Diffstat (limited to 'sys/sys/syscallsubr.h')
-rw-r--r-- | sys/sys/syscallsubr.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/sys/syscallsubr.h b/sys/sys/syscallsubr.h index d22c349..f6f851b 100644 --- a/sys/sys/syscallsubr.h +++ b/sys/sys/syscallsubr.h @@ -35,6 +35,7 @@ #include <sys/mount.h> struct file; +struct filecaps; enum idtype; struct itimerval; struct image_args; @@ -150,8 +151,8 @@ int kern_openat(struct thread *td, int fd, char *path, enum uio_seg pathseg, int flags, int mode); int kern_pathconf(struct thread *td, char *path, enum uio_seg pathseg, int name, u_long flags); -int kern_pipe(struct thread *td, int fildes[2]); -int kern_pipe2(struct thread *td, int fildes[2], int flags); +int kern_pipe(struct thread *td, int fildes[2], int flags, + struct filecaps *fcaps1, struct filecaps *fcaps2); int kern_poll(struct thread *td, struct pollfd *fds, u_int nfds, struct timespec *tsp, sigset_t *uset); int kern_posix_fadvise(struct thread *td, int fd, off_t offset, off_t len, |