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
This commit is contained in:
Konstantin Belousov 2008-03-31 11:57:18 +00:00
parent 81b02e6d57
commit e314f69fff
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=177784
2 changed files with 14 additions and 2 deletions

View File

@ -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);

View File

@ -212,6 +212,8 @@ vn_open_cred(ndp, flagp, cmode, cred, fp)
}
if (fmode & FREAD)
mode |= VREAD;
if (fmode & FEXEC)
mode |= VEXEC;
if (fmode & O_APPEND)
mode |= VAPPEND;
#ifdef MAC