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/compat/linux | |
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/compat/linux')
-rw-r--r-- | sys/compat/linux/linux_file.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c index 1e5e37a..489dc1e 100644 --- a/sys/compat/linux/linux_file.c +++ b/sys/compat/linux/linux_file.c @@ -1582,7 +1582,7 @@ linux_pipe(struct thread *td, struct linux_pipe_args *args) printf(ARGS(pipe, "*")); #endif - error = kern_pipe2(td, fildes, 0); + error = kern_pipe(td, fildes, 0, NULL, NULL); if (error) return (error); @@ -1609,7 +1609,7 @@ linux_pipe2(struct thread *td, struct linux_pipe2_args *args) flags |= O_NONBLOCK; if ((args->flags & LINUX_O_CLOEXEC) != 0) flags |= O_CLOEXEC; - error = kern_pipe2(td, fildes, flags); + error = kern_pipe(td, fildes, flags, NULL, NULL); if (error) return (error); |