summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2008-03-31 11:57:18 +0000
committerkib <kib@FreeBSD.org>2008-03-31 11:57:18 +0000
commitfb67926ebba3585578dba016e05aabe5090ea064 (patch)
tree2673d37c64e877a3608dc1ed567a616fad895af2
parent9ab7de877c11a4496f6475423a81212c2a412aba (diff)
downloadFreeBSD-src-fb67926ebba3585578dba016e05aabe5090ea064.zip
FreeBSD-src-fb67926ebba3585578dba016e05aabe5090ea064.tar.gz
Add the support for the O_EXEC open(2) mode, as specified by the
POSIX Extended API Set Part 2 extension specification. Reviewed by: rwatson, rdivacky Tested by: pho
-rw-r--r--sys/kern/vfs_syscalls.c14
-rw-r--r--sys/kern/vfs_vnops.c2
2 files changed, 14 insertions, 2 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 8829a9c..c20b6e6 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -1018,9 +1018,19 @@ kern_open(struct thread *td, char *path, enum uio_seg pathseg, int flags,
AUDIT_ARG(fflags, flags);
AUDIT_ARG(mode, mode);
- if ((flags & O_ACCMODE) == O_ACCMODE)
+ /* XXX: audit dirfd */
+ /*
+ * Only one of the O_EXEC, O_RDONLY, O_WRONLY and O_RDWR may
+ * be specified.
+ */
+ if (flags & O_EXEC) {
+ if (flags & O_ACCMODE)
+ return (EINVAL);
+ } else if ((flags & O_ACCMODE) == O_ACCMODE)
return (EINVAL);
- flags = FFLAGS(flags);
+ else
+ flags = FFLAGS(flags);
+
error = falloc(td, &nfp, &indx);
if (error)
return (error);
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index 1b08156..c00d66a 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -212,6 +212,8 @@ restart:
}
if (fmode & FREAD)
mode |= VREAD;
+ if (fmode & FEXEC)
+ mode |= VEXEC;
if (fmode & O_APPEND)
mode |= VAPPEND;
#ifdef MAC
OpenPOWER on IntegriCloud