Author: ed Date: Wed Aug 5 16:15:43 2015 New Revision: 286323 URL: https://svnweb.freebsd.org/changeset/base/286323
Log: 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 Modified: head/sys/compat/cloudabi/cloudabi_fd.c Modified: head/sys/compat/cloudabi/cloudabi_fd.c ============================================================================== --- head/sys/compat/cloudabi/cloudabi_fd.c Wed Aug 5 15:57:08 2015 (r286322) +++ head/sys/compat/cloudabi/cloudabi_fd.c Wed Aug 5 16:15:43 2015 (r286323) @@ -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 _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"