Make fcntl(F_SETFL) work.
The stat_put() system call can be used to modify file descriptor attributes, such as flags, but also Capsicum permission bits. Support for changing Capsicum bits will be added as soon as its dependent changes have been pushed through code review. Obtained from: https://github.com/NuxiNL/freebsd
This commit is contained in:
parent
79b7e3e2c2
commit
36310bcd1d
@ -503,9 +503,26 @@ int
|
||||
cloudabi_sys_fd_stat_put(struct thread *td,
|
||||
struct cloudabi_sys_fd_stat_put_args *uap)
|
||||
{
|
||||
cloudabi_fdstat_t fsb;
|
||||
int error, oflags;
|
||||
|
||||
/* Not implemented. */
|
||||
return (ENOSYS);
|
||||
error = copyin(uap->buf, &fsb, sizeof(fsb));
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
if (uap->flags == CLOUDABI_FDSTAT_FLAGS) {
|
||||
/* Convert flags. */
|
||||
oflags = 0;
|
||||
if (fsb.fs_flags & CLOUDABI_FDFLAG_APPEND)
|
||||
oflags |= O_APPEND;
|
||||
if (fsb.fs_flags & CLOUDABI_FDFLAG_NONBLOCK)
|
||||
oflags |= O_NONBLOCK;
|
||||
if (fsb.fs_flags & (CLOUDABI_FDFLAG_SYNC |
|
||||
CLOUDABI_FDFLAG_DSYNC | CLOUDABI_FDFLAG_RSYNC))
|
||||
oflags |= O_SYNC;
|
||||
return (kern_fcntl(td, uap->fd, F_SETFL, oflags));
|
||||
}
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
int
|
||||
|
Loading…
Reference in New Issue
Block a user