Bug #2357 » 0001-kernel-remove-O_ROOTCRED.patch
sys/kern/kern_fp.c | ||
---|---|---|
*
|
||
* Open a file as specified. Use O_* flags for flags.
|
||
*
|
||
* NOTE! O_ROOTCRED not quite working yet, vn_open() asserts that the
|
||
* cred must match the process's cred. XXX
|
||
* vn_open() asserts that the cred must match the process's cred.
|
||
*
|
||
* NOTE! when fp_open() is called from a pure thread, root creds are
|
||
* used.
|
||
... | ... | |
return (error);
|
||
fp = *fpp;
|
||
td = curthread;
|
||
if (td->td_proc) {
|
||
if ((flags & O_ROOTCRED) == 0)
|
||
fsetcred(fp, td->td_proc->p_ucred);
|
||
}
|
||
if (td->td_proc)
|
||
fsetcred(fp, td->td_proc->p_ucred);
|
||
error = nlookup_init(&nd, path, UIO_SYSSPACE, NLC_LOCKVP);
|
||
flags = FFLAGS(flags);
|
||
if (error == 0)
|
||
... | ... | |
if ((error = falloc(NULL, fpp, NULL)) != 0)
|
||
goto bad2;
|
||
fp = *fpp;
|
||
if ((flags & O_ROOTCRED) == 0 && td->td_proc)
|
||
if (td->td_proc)
|
||
fsetcred(fp, td->td_proc->p_ucred);
|
||
error = VOP_OPEN(vp, flags, td->td_proc->p_ucred, fp);
|
sys/sys/fcntl.h | ||
---|---|---|
/* Attempt to bypass the buffer cache */
|
||
#define O_DIRECT 0x00010000
|
||
#if defined(_KERNEL) || defined(_KERNEL_STRUCTURES)
|
||
#define O_ROOTCRED 0x00020000 /* fp_open */
|
||
#endif
|
||
#define O_FBLOCKING 0x00040000 /* force blocking I/O */
|
||
#define O_FNONBLOCKING 0x00080000 /* force non-blocking I/O */
|
||
#define O_FAPPEND 0x00100000 /* force append mode for write */
|