summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/imgact_aout.c2
-rw-r--r--sys/kern/imgact_elf.c2
-rw-r--r--sys/kern/kern_acct.c8
-rw-r--r--sys/kern/kern_acl.c16
-rw-r--r--sys/kern/kern_descrip.c4
-rw-r--r--sys/kern/kern_exec.c16
-rw-r--r--sys/kern/kern_ktrace.c14
-rw-r--r--sys/kern/kern_linker.c11
-rw-r--r--sys/kern/kern_mib.c4
-rw-r--r--sys/kern/kern_sysctl.c2
-rw-r--r--sys/kern/link_aout.c7
-rw-r--r--sys/kern/link_elf.c13
-rw-r--r--sys/kern/link_elf_obj.c13
-rw-r--r--sys/kern/subr_acl_posix1e.c16
-rw-r--r--sys/kern/sysv_ipc.c2
-rw-r--r--sys/kern/sysv_sem.c2
-rw-r--r--sys/kern/sysv_shm.c2
-rw-r--r--sys/kern/tty_cons.c6
-rw-r--r--sys/kern/tty_pty.c8
-rw-r--r--sys/kern/tty_tty.c2
-rw-r--r--sys/kern/uipc_socket.c2
-rw-r--r--sys/kern/uipc_syscalls.c8
-rw-r--r--sys/kern/uipc_usrreq.c18
-rw-r--r--sys/kern/vfs_acl.c16
-rw-r--r--sys/kern/vfs_extattr.c120
-rw-r--r--sys/kern/vfs_subr.c4
-rw-r--r--sys/kern/vfs_syscalls.c120
-rw-r--r--sys/kern/vfs_vnops.c12
28 files changed, 218 insertions, 232 deletions
diff --git a/sys/kern/imgact_aout.c b/sys/kern/imgact_aout.c
index bd6ff7b..8184d0d 100644
--- a/sys/kern/imgact_aout.c
+++ b/sys/kern/imgact_aout.c
@@ -256,7 +256,7 @@ aout_coredump(td, vp, limit)
off_t limit;
{
struct proc *p = td->td_proc;
- register struct ucred *cred = p->p_ucred;
+ register struct ucred *cred = td->td_ucred;
register struct vmspace *vm = p->p_vmspace;
int error;
diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c
index da4c210..d7038f0 100644
--- a/sys/kern/imgact_elf.c
+++ b/sys/kern/imgact_elf.c
@@ -754,7 +754,7 @@ elf_coredump(td, vp, limit)
off_t limit;
{
register struct proc *p = td->td_proc;
- register struct ucred *cred = p->p_ucred;
+ register struct ucred *cred = td->td_ucred;
int error = 0;
struct sseg_closure seginfo;
void *hdr;
diff --git a/sys/kern/kern_acct.c b/sys/kern/kern_acct.c
index e859057..df46af2 100644
--- a/sys/kern/kern_acct.c
+++ b/sys/kern/kern_acct.c
@@ -141,7 +141,7 @@ acct(td, uap)
NDFREE(&nd, NDF_ONLY_PNBUF);
VOP_UNLOCK(nd.ni_vp, 0, td);
if (nd.ni_vp->v_type != VREG) {
- vn_close(nd.ni_vp, FWRITE, td->td_proc->p_ucred, td);
+ vn_close(nd.ni_vp, FWRITE, td->td_ucred, td);
error = EACCES;
goto done2;
}
@@ -154,7 +154,7 @@ acct(td, uap)
if (acctp != NULLVP || savacctp != NULLVP) {
callout_stop(&acctwatch_callout);
error = vn_close((acctp != NULLVP ? acctp : savacctp), FWRITE,
- td->td_proc->p_ucred, td);
+ td->td_ucred, td);
acctp = savacctp = NULLVP;
}
if (SCARG(uap, path) == NULL)
@@ -258,9 +258,9 @@ acct_process(td)
/*
* Write the accounting information to the file.
*/
- VOP_LEASE(vp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
return (vn_rdwr(UIO_WRITE, vp, (caddr_t)&acct, sizeof (acct),
- (off_t)0, UIO_SYSSPACE, IO_APPEND|IO_UNIT, td->td_proc->p_ucred,
+ (off_t)0, UIO_SYSSPACE, IO_APPEND|IO_UNIT, td->td_ucred,
(int *)0, td));
}
diff --git a/sys/kern/kern_acl.c b/sys/kern/kern_acl.c
index e7937bb..5f5502a 100644
--- a/sys/kern/kern_acl.c
+++ b/sys/kern/kern_acl.c
@@ -579,9 +579,9 @@ vacl_set_acl(struct thread *td, struct vnode *vp, acl_type_t type,
error = vn_start_write(vp, &mp, V_WAIT | PCATCH);
if (error != 0)
return (error);
- VOP_LEASE(vp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
- error = VOP_SETACL(vp, type, &inkernacl, td->td_proc->p_ucred, td);
+ error = VOP_SETACL(vp, type, &inkernacl, td->td_ucred, td);
VOP_UNLOCK(vp, 0, td);
vn_finished_write(mp);
return(error);
@@ -597,9 +597,9 @@ vacl_get_acl(struct thread *td, struct vnode *vp, acl_type_t type,
struct acl inkernelacl;
int error;
- VOP_LEASE(vp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
- error = VOP_GETACL(vp, type, &inkernelacl, td->td_proc->p_ucred, td);
+ error = VOP_GETACL(vp, type, &inkernelacl, td->td_ucred, td);
VOP_UNLOCK(vp, 0, td);
if (error == 0)
error = copyout(&inkernelacl, aclp, sizeof(struct acl));
@@ -618,10 +618,9 @@ vacl_delete(struct thread *td, struct vnode *vp, acl_type_t type)
error = vn_start_write(vp, &mp, V_WAIT | PCATCH);
if (error)
return (error);
- VOP_LEASE(vp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
- error = VOP_SETACL(vp, ACL_TYPE_DEFAULT, 0, td->td_proc->p_ucred,
- td);
+ error = VOP_SETACL(vp, ACL_TYPE_DEFAULT, 0, td->td_ucred, td);
VOP_UNLOCK(vp, 0, td);
vn_finished_write(mp);
return (error);
@@ -640,8 +639,7 @@ vacl_aclcheck(struct thread *td, struct vnode *vp, acl_type_t type,
error = copyin(aclp, &inkernelacl, sizeof(struct acl));
if (error)
return(error);
- error = VOP_ACLCHECK(vp, type, &inkernelacl, td->td_proc->p_ucred,
- td);
+ error = VOP_ACLCHECK(vp, type, &inkernelacl, td->td_ucred, td);
return (error);
}
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index 8e4726e..5fed676 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -635,7 +635,7 @@ fsetown(pgid, sigiop)
/* Allocate and fill in the new sigio out of locks. */
MALLOC(sigio, struct sigio *, sizeof(struct sigio), M_SIGIO, M_WAITOK);
sigio->sio_pgid = pgid;
- sigio->sio_ucred = crhold(curthread->td_proc->p_ucred);
+ sigio->sio_ucred = crhold(curthread->td_ucred);
sigio->sio_myref = sigiop;
PGRPSESS_SLOCK();
@@ -1114,7 +1114,7 @@ falloc(td, resultfp, resultfd)
fp->f_mtxp = mtx_pool_alloc();
fp->f_gcflag = 0;
fp->f_count = 1;
- fp->f_cred = crhold(p->p_ucred);
+ fp->f_cred = crhold(td->td_ucred);
fp->f_ops = &badfileops;
fp->f_seqcount = 1;
FILEDESC_UNLOCK(p->p_fd);
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index 3a1b56c..6905adf 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -837,10 +837,12 @@ exec_check_permissions(imgp)
struct proc *p = imgp->proc;
struct vnode *vp = imgp->vp;
struct vattr *attr = imgp->attr;
+ struct thread *td;
int error;
+ td = curthread; /* XXXKSE */
/* Get file attributes */
- error = VOP_GETATTR(vp, attr, p->p_ucred, curthread); /* XXXKSE */
+ error = VOP_GETATTR(vp, attr, td->td_ucred, td);
if (error)
return (error);
@@ -854,9 +856,8 @@ exec_check_permissions(imgp)
*/
if ((vp->v_mount->mnt_flag & MNT_NOEXEC) ||
((attr->va_mode & 0111) == 0) ||
- (attr->va_type != VREG)) {
+ (attr->va_type != VREG))
return (EACCES);
- }
/*
* Zero length files can't be exec'd
@@ -867,7 +868,7 @@ exec_check_permissions(imgp)
/*
* Check for execute permission to file based on current credentials.
*/
- error = VOP_ACCESS(vp, VEXEC, p->p_ucred, curthread); /* XXXKSE */
+ error = VOP_ACCESS(vp, VEXEC, td->td_ucred, td);
if (error)
return (error);
@@ -882,11 +883,8 @@ exec_check_permissions(imgp)
* Call filesystem specific open routine (which does nothing in the
* general case).
*/
- error = VOP_OPEN(vp, FREAD, p->p_ucred, curthread); /* XXXKSE */
- if (error)
- return (error);
-
- return (0);
+ error = VOP_OPEN(vp, FREAD, td->td_ucred, td);
+ return (error);
}
/*
diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c
index 6fc46d6..836311e 100644
--- a/sys/kern/kern_ktrace.c
+++ b/sys/kern/kern_ktrace.c
@@ -311,7 +311,7 @@ ktrace(td, uap)
vp = nd.ni_vp;
VOP_UNLOCK(vp, 0, td);
if (vp->v_type != VREG) {
- (void) vn_close(vp, FREAD|FWRITE, curp->p_ucred, td);
+ (void) vn_close(vp, FREAD|FWRITE, td->td_ucred, td);
curp->p_traceflag &= ~KTRFAC_ACTIVE;
return (EACCES);
}
@@ -327,7 +327,7 @@ ktrace(td, uap)
p->p_tracep = NULL;
p->p_traceflag = 0;
(void) vn_close(vp, FREAD|FWRITE,
- p->p_ucred, td);
+ td->td_ucred, td);
} else {
error = EPERM;
}
@@ -387,7 +387,7 @@ ktrace(td, uap)
error = EPERM;
done:
if (vp != NULL)
- (void) vn_close(vp, FWRITE, curp->p_ucred, td);
+ (void) vn_close(vp, FWRITE, td->td_ucred, td);
curp->p_traceflag &= ~KTRFAC_ACTIVE;
return (error);
#else
@@ -550,11 +550,11 @@ ktrwrite(vp, kth, uio)
}
vn_start_write(vp, &mp, V_WAIT);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
- (void)VOP_LEASE(vp, td, p->p_ucred, LEASE_WRITE);
- error = VOP_WRITE(vp, &auio, IO_UNIT | IO_APPEND, p->p_ucred);
+ (void)VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
+ error = VOP_WRITE(vp, &auio, IO_UNIT | IO_APPEND, td->td_ucred);
if (error == 0 && uio != NULL) {
- (void)VOP_LEASE(vp, td, p->p_ucred, LEASE_WRITE);
- error = VOP_WRITE(vp, uio, IO_UNIT | IO_APPEND, p->p_ucred);
+ (void)VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
+ error = VOP_WRITE(vp, uio, IO_UNIT | IO_APPEND, td->td_ucred);
}
VOP_UNLOCK(vp, 0, td);
vn_finished_write(mp);
diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c
index 5baccd6..338c3f3 100644
--- a/sys/kern/kern_linker.c
+++ b/sys/kern/kern_linker.c
@@ -708,7 +708,7 @@ kldload(struct thread *td, struct kldload_args *uap)
mtx_lock(&Giant);
- if ((error = suser_xxx(td->td_proc->p_ucred, NULL, 0)) != 0)
+ if ((error = suser_xxx(td->td_ucred, NULL, 0)) != 0)
goto out;
pathname = malloc(MAXPATHLEN, M_TEMP, M_WAITOK);
@@ -755,7 +755,7 @@ kldunload(struct thread *td, struct kldunload_args *uap)
mtx_lock(&Giant);
- if ((error = suser_xxx(td->td_proc->p_ucred, NULL, 0)) != 0)
+ if ((error = suser_xxx(td->td_ucred, NULL, 0)) != 0)
goto out;
lf = linker_find_file_by_id(SCARG(uap, fileid));
@@ -1371,10 +1371,9 @@ linker_lookup_file(const char *path, int pathlen, const char *name,
NDFREE(&nd, NDF_ONLY_PNBUF);
type = nd.ni_vp->v_type;
if (vap)
- VOP_GETATTR(nd.ni_vp, vap,
- td->td_proc->p_ucred, td);
+ VOP_GETATTR(nd.ni_vp, vap, td->td_ucred, td);
VOP_UNLOCK(nd.ni_vp, 0, td);
- vn_close(nd.ni_vp, FREAD, td->td_proc->p_ucred, td);
+ vn_close(nd.ni_vp, FREAD, td->td_ucred, td);
if (type == VREG)
return (result);
}
@@ -1399,7 +1398,7 @@ linker_hints_lookup(const char *path, int pathlen, const char *modname,
int modnamelen, struct mod_depend *verinfo)
{
struct thread *td = curthread; /* XXX */
- struct ucred *cred = td ? td->td_proc->p_ucred : NULL;
+ struct ucred *cred = td ? td->td_ucred : NULL;
struct nameidata nd;
struct vattr vattr, mattr;
u_char *hints = NULL;
diff --git a/sys/kern/kern_mib.c b/sys/kern/kern_mib.c
index c5ac747..662fd1b 100644
--- a/sys/kern/kern_mib.c
+++ b/sys/kern/kern_mib.c
@@ -161,7 +161,7 @@ sysctl_hostname(SYSCTL_HANDLER_ARGS)
char tmphostname[MAXHOSTNAMELEN];
int error;
- pr = req->td->td_proc->p_ucred->cr_prison;
+ pr = req->td->td_ucred->cr_prison;
if (pr != NULL) {
if (!jail_set_hostname_allowed && req->newptr)
return (EPERM);
@@ -211,7 +211,7 @@ sysctl_kern_securelvl(SYSCTL_HANDLER_ARGS)
struct prison *pr;
int error, level;
- pr = req->td->td_proc->p_ucred->cr_prison;
+ pr = req->td->td_ucred->cr_prison;
/*
* If the process is in jail, return the maximum of the global and
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index 39decc7..2b725ee 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -1074,7 +1074,7 @@ sysctl_root(SYSCTL_HANDLER_ARGS)
if (error)
return (error);
} else {
- error = securelevel_gt(req->td->td_proc->p_ucred, 0);
+ error = securelevel_gt(req->td->td_ucred, 0);
if (error)
return (error);
}
diff --git a/sys/kern/link_aout.c b/sys/kern/link_aout.c
index 07c79f9..5a863bd 100644
--- a/sys/kern/link_aout.c
+++ b/sys/kern/link_aout.c
@@ -194,7 +194,6 @@ link_aout_load_file(linker_class_t lc, const char* filename, linker_file_t* resu
{
struct nameidata nd;
struct thread *td = curthread; /* XXX */
- struct proc *p = td->td_proc;
int error = 0;
int resid, flags;
struct exec header;
@@ -212,7 +211,7 @@ link_aout_load_file(linker_class_t lc, const char* filename, linker_file_t* resu
* Read the a.out header from the file.
*/
error = vn_rdwr(UIO_READ, nd.ni_vp, (void*) &header, sizeof header, 0,
- UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid, td);
+ UIO_SYSSPACE, IO_NODELOCKED, td->td_ucred, &resid, td);
if (error)
goto out;
@@ -237,7 +236,7 @@ link_aout_load_file(linker_class_t lc, const char* filename, linker_file_t* resu
*/
error = vn_rdwr(UIO_READ, nd.ni_vp, (void*) af->address,
header.a_text + header.a_data, 0,
- UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid, td);
+ UIO_SYSSPACE, IO_NODELOCKED, td->td_ucred, &resid, td);
if (error)
goto out;
bzero(af->address + header.a_text + header.a_data, header.a_bss);
@@ -269,7 +268,7 @@ out:
if (error && lf)
linker_file_unload(lf);
VOP_UNLOCK(nd.ni_vp, 0, td);
- vn_close(nd.ni_vp, FREAD, p->p_ucred, td);
+ vn_close(nd.ni_vp, FREAD, td->td_ucred, td);
return error;
}
diff --git a/sys/kern/link_elf.c b/sys/kern/link_elf.c
index 5044ceb..fe4aba3 100644
--- a/sys/kern/link_elf.c
+++ b/sys/kern/link_elf.c
@@ -517,7 +517,6 @@ link_elf_load_file(linker_class_t cls, const char* filename, linker_file_t* resu
{
struct nameidata nd;
struct thread* td = curthread; /* XXX */
- struct proc* p = td->td_proc; /* XXX */
Elf_Ehdr *hdr;
caddr_t firstpage;
int nbytes, i;
@@ -567,7 +566,7 @@ link_elf_load_file(linker_class_t cls, const char* filename, linker_file_t* resu
}
hdr = (Elf_Ehdr *)firstpage;
error = vn_rdwr(UIO_READ, nd.ni_vp, firstpage, PAGE_SIZE, 0,
- UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid, td);
+ UIO_SYSSPACE, IO_NODELOCKED, td->td_ucred, &resid, td);
nbytes = PAGE_SIZE - resid;
if (error)
goto out;
@@ -706,7 +705,7 @@ link_elf_load_file(linker_class_t cls, const char* filename, linker_file_t* resu
caddr_t segbase = mapbase + segs[i]->p_vaddr - base_vaddr;
error = vn_rdwr(UIO_READ, nd.ni_vp,
segbase, segs[i]->p_filesz, segs[i]->p_offset,
- UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid, td);
+ UIO_SYSSPACE, IO_NODELOCKED, td->td_ucred, &resid, td);
if (error) {
goto out;
}
@@ -766,7 +765,7 @@ link_elf_load_file(linker_class_t cls, const char* filename, linker_file_t* resu
}
error = vn_rdwr(UIO_READ, nd.ni_vp,
(caddr_t)shdr, nbytes, hdr->e_shoff,
- UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid, td);
+ UIO_SYSSPACE, IO_NODELOCKED, td->td_ucred, &resid, td);
if (error)
goto out;
symtabindex = -1;
@@ -791,12 +790,12 @@ link_elf_load_file(linker_class_t cls, const char* filename, linker_file_t* resu
}
error = vn_rdwr(UIO_READ, nd.ni_vp,
ef->symbase, symcnt, shdr[symtabindex].sh_offset,
- UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid, td);
+ UIO_SYSSPACE, IO_NODELOCKED, td->td_ucred, &resid, td);
if (error)
goto out;
error = vn_rdwr(UIO_READ, nd.ni_vp,
ef->strbase, strcnt, shdr[symstrindex].sh_offset,
- UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid, td);
+ UIO_SYSSPACE, IO_NODELOCKED, td->td_ucred, &resid, td);
if (error)
goto out;
@@ -828,7 +827,7 @@ out:
if (firstpage)
free(firstpage, M_LINKER);
VOP_UNLOCK(nd.ni_vp, 0, td);
- vn_close(nd.ni_vp, FREAD, p->p_ucred, td);
+ vn_close(nd.ni_vp, FREAD, td->td_ucred, td);
return error;
}
diff --git a/sys/kern/link_elf_obj.c b/sys/kern/link_elf_obj.c
index 5044ceb..fe4aba3 100644
--- a/sys/kern/link_elf_obj.c
+++ b/sys/kern/link_elf_obj.c
@@ -517,7 +517,6 @@ link_elf_load_file(linker_class_t cls, const char* filename, linker_file_t* resu
{
struct nameidata nd;
struct thread* td = curthread; /* XXX */
- struct proc* p = td->td_proc; /* XXX */
Elf_Ehdr *hdr;
caddr_t firstpage;
int nbytes, i;
@@ -567,7 +566,7 @@ link_elf_load_file(linker_class_t cls, const char* filename, linker_file_t* resu
}
hdr = (Elf_Ehdr *)firstpage;
error = vn_rdwr(UIO_READ, nd.ni_vp, firstpage, PAGE_SIZE, 0,
- UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid, td);
+ UIO_SYSSPACE, IO_NODELOCKED, td->td_ucred, &resid, td);
nbytes = PAGE_SIZE - resid;
if (error)
goto out;
@@ -706,7 +705,7 @@ link_elf_load_file(linker_class_t cls, const char* filename, linker_file_t* resu
caddr_t segbase = mapbase + segs[i]->p_vaddr - base_vaddr;
error = vn_rdwr(UIO_READ, nd.ni_vp,
segbase, segs[i]->p_filesz, segs[i]->p_offset,
- UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid, td);
+ UIO_SYSSPACE, IO_NODELOCKED, td->td_ucred, &resid, td);
if (error) {
goto out;
}
@@ -766,7 +765,7 @@ link_elf_load_file(linker_class_t cls, const char* filename, linker_file_t* resu
}
error = vn_rdwr(UIO_READ, nd.ni_vp,
(caddr_t)shdr, nbytes, hdr->e_shoff,
- UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid, td);
+ UIO_SYSSPACE, IO_NODELOCKED, td->td_ucred, &resid, td);
if (error)
goto out;
symtabindex = -1;
@@ -791,12 +790,12 @@ link_elf_load_file(linker_class_t cls, const char* filename, linker_file_t* resu
}
error = vn_rdwr(UIO_READ, nd.ni_vp,
ef->symbase, symcnt, shdr[symtabindex].sh_offset,
- UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid, td);
+ UIO_SYSSPACE, IO_NODELOCKED, td->td_ucred, &resid, td);
if (error)
goto out;
error = vn_rdwr(UIO_READ, nd.ni_vp,
ef->strbase, strcnt, shdr[symstrindex].sh_offset,
- UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid, td);
+ UIO_SYSSPACE, IO_NODELOCKED, td->td_ucred, &resid, td);
if (error)
goto out;
@@ -828,7 +827,7 @@ out:
if (firstpage)
free(firstpage, M_LINKER);
VOP_UNLOCK(nd.ni_vp, 0, td);
- vn_close(nd.ni_vp, FREAD, p->p_ucred, td);
+ vn_close(nd.ni_vp, FREAD, td->td_ucred, td);
return error;
}
diff --git a/sys/kern/subr_acl_posix1e.c b/sys/kern/subr_acl_posix1e.c
index e7937bb..5f5502a 100644
--- a/sys/kern/subr_acl_posix1e.c
+++ b/sys/kern/subr_acl_posix1e.c
@@ -579,9 +579,9 @@ vacl_set_acl(struct thread *td, struct vnode *vp, acl_type_t type,
error = vn_start_write(vp, &mp, V_WAIT | PCATCH);
if (error != 0)
return (error);
- VOP_LEASE(vp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
- error = VOP_SETACL(vp, type, &inkernacl, td->td_proc->p_ucred, td);
+ error = VOP_SETACL(vp, type, &inkernacl, td->td_ucred, td);
VOP_UNLOCK(vp, 0, td);
vn_finished_write(mp);
return(error);
@@ -597,9 +597,9 @@ vacl_get_acl(struct thread *td, struct vnode *vp, acl_type_t type,
struct acl inkernelacl;
int error;
- VOP_LEASE(vp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
- error = VOP_GETACL(vp, type, &inkernelacl, td->td_proc->p_ucred, td);
+ error = VOP_GETACL(vp, type, &inkernelacl, td->td_ucred, td);
VOP_UNLOCK(vp, 0, td);
if (error == 0)
error = copyout(&inkernelacl, aclp, sizeof(struct acl));
@@ -618,10 +618,9 @@ vacl_delete(struct thread *td, struct vnode *vp, acl_type_t type)
error = vn_start_write(vp, &mp, V_WAIT | PCATCH);
if (error)
return (error);
- VOP_LEASE(vp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
- error = VOP_SETACL(vp, ACL_TYPE_DEFAULT, 0, td->td_proc->p_ucred,
- td);
+ error = VOP_SETACL(vp, ACL_TYPE_DEFAULT, 0, td->td_ucred, td);
VOP_UNLOCK(vp, 0, td);
vn_finished_write(mp);
return (error);
@@ -640,8 +639,7 @@ vacl_aclcheck(struct thread *td, struct vnode *vp, acl_type_t type,
error = copyin(aclp, &inkernelacl, sizeof(struct acl));
if (error)
return(error);
- error = VOP_ACLCHECK(vp, type, &inkernelacl, td->td_proc->p_ucred,
- td);
+ error = VOP_ACLCHECK(vp, type, &inkernelacl, td->td_ucred, td);
return (error);
}
diff --git a/sys/kern/sysv_ipc.c b/sys/kern/sysv_ipc.c
index cfd29be..42a1465 100644
--- a/sys/kern/sysv_ipc.c
+++ b/sys/kern/sysv_ipc.c
@@ -76,7 +76,7 @@ ipcperm(td, perm, mode)
struct ipc_perm *perm;
int mode;
{
- struct ucred *cred = td->td_proc->p_ucred;
+ struct ucred *cred = td->td_ucred;
/* Check for user match. */
if (cred->cr_uid != perm->cuid && cred->cr_uid != perm->uid) {
diff --git a/sys/kern/sysv_sem.c b/sys/kern/sysv_sem.c
index 780eb40..152ce0b 100644
--- a/sys/kern/sysv_sem.c
+++ b/sys/kern/sysv_sem.c
@@ -476,7 +476,7 @@ __semctl(td, uap)
int cmd = uap->cmd;
union semun *arg = uap->arg;
union semun real_arg;
- struct ucred *cred = td->td_proc->p_ucred;
+ struct ucred *cred = td->td_ucred;
int i, rval, error;
struct semid_ds sbuf;
register struct semid_ds *semaptr;
diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c
index 0ec9ad4..fbcca94 100644
--- a/sys/kern/sysv_shm.c
+++ b/sys/kern/sysv_shm.c
@@ -620,7 +620,7 @@ shmget_allocate_segment(td, uap, mode)
int mode;
{
int i, segnum, shmid, size;
- struct ucred *cred = td->td_proc->p_ucred;
+ struct ucred *cred = td->td_ucred;
struct shmid_ds *shmseg;
struct shm_handle *shm_handle;
diff --git a/sys/kern/tty_cons.c b/sys/kern/tty_cons.c
index f0114f5..d6f805c 100644
--- a/sys/kern/tty_cons.c
+++ b/sys/kern/tty_cons.c
@@ -360,7 +360,7 @@ cn_devopen(struct cn_device *cnd, struct thread *td, int forceopen)
return ((*devsw(dev)->d_open)(dev, openflag, 0, td));
}
cnd->cnd_vp = NULL;
- vn_close(vp, openflag, td->td_proc->p_ucred, td);
+ vn_close(vp, openflag, td->td_ucred, td);
}
if (cnd->cnd_name[0] == '\0')
strncpy(cnd->cnd_name, devtoname(cnd->cnd_cn->cn_dev),
@@ -374,7 +374,7 @@ cn_devopen(struct cn_device *cnd, struct thread *td, int forceopen)
if (nd.ni_vp->v_type == VCHR)
cnd->cnd_vp = nd.ni_vp;
else
- vn_close(nd.ni_vp, openflag, td->td_proc->p_ucred, td);
+ vn_close(nd.ni_vp, openflag, td->td_ucred, td);
}
return (cnd->cnd_vp != NULL);
}
@@ -403,7 +403,7 @@ cnclose(dev_t dev, int flag, int mode, struct thread *td)
if ((vp = cnd->cnd_vp) == NULL)
continue;
cnd->cnd_vp = NULL;
- vn_close(vp, openflag, td->td_proc->p_ucred, td);
+ vn_close(vp, openflag, td->td_ucred, td);
}
cn_is_open = 0;
return (0);
diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c
index b3fcc8d..1ab60bd 100644
--- a/sys/kern/tty_pty.c
+++ b/sys/kern/tty_pty.c
@@ -172,7 +172,6 @@ ptsopen(dev, flag, devtype, td)
int flag, devtype;
struct thread *td;
{
- struct proc *p = td->td_proc;
register struct tty *tp;
int error;
struct pt_ioctl *pti;
@@ -188,9 +187,9 @@ ptsopen(dev, flag, devtype, td)
tp->t_lflag = TTYDEF_LFLAG;
tp->t_cflag = TTYDEF_CFLAG;
tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
- } else if (tp->t_state & TS_XCLUDE && suser_xxx(p->p_ucred, NULL, 0)) {
+ } else if (tp->t_state & TS_XCLUDE && suser_xxx(td->td_ucred, NULL, 0)) {
return (EBUSY);
- } else if (pti->pt_prison != p->p_ucred->cr_prison) {
+ } else if (pti->pt_prison != td->td_ucred->cr_prison) {
return (EBUSY);
}
if (tp->t_oproc) /* Ctrlr still around. */
@@ -344,7 +343,6 @@ ptcopen(dev, flag, devtype, td)
int flag, devtype;
struct thread *td;
{
- struct proc *p = td->td_proc;
register struct tty *tp;
struct pt_ioctl *pti;
@@ -361,7 +359,7 @@ ptcopen(dev, flag, devtype, td)
(void)(*linesw[tp->t_line].l_modem)(tp, 1);
tp->t_lflag &= ~EXTPROC;
pti = dev->si_drv1;
- pti->pt_prison = p->p_ucred->cr_prison;
+ pti->pt_prison = td->td_ucred->cr_prison;
pti->pt_flags = 0;
pti->pt_send = 0;
pti->pt_ucntl = 0;
diff --git a/sys/kern/tty_tty.c b/sys/kern/tty_tty.c
index 931da01..ebb91a4 100644
--- a/sys/kern/tty_tty.c
+++ b/sys/kern/tty_tty.c
@@ -210,7 +210,7 @@ cttypoll(dev, events, td)
if (ttyvp == NULL)
/* try operation to get EOF/failure */
return (seltrue(dev, events, td));
- return (VOP_POLL(ttyvp, events, td->td_proc->p_ucred, td));
+ return (VOP_POLL(ttyvp, events, td->td_ucred, td));
}
static void ctty_clone __P((void *arg, char *name, int namelen, dev_t *dev));
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 68e15f7..5572127 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -157,7 +157,7 @@ socreate(dom, aso, type, proto, cred, td)
if (prp == 0 || prp->pr_usrreqs->pru_attach == 0)
return (EPROTONOSUPPORT);
- if (jailed(td->td_proc->p_ucred) && jail_socket_unixiproute_only &&
+ if (jailed(td->td_ucred) && jail_socket_unixiproute_only &&
prp->pr_domain->dom_family != PF_LOCAL &&
prp->pr_domain->dom_family != PF_INET &&
prp->pr_domain->dom_family != PF_ROUTE) {
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c
index 71aca29..41fa08a 100644
--- a/sys/kern/uipc_syscalls.c
+++ b/sys/kern/uipc_syscalls.c
@@ -133,7 +133,7 @@ socket(td, uap)
goto done2;
fhold(fp);
error = socreate(uap->domain, &so, uap->type, uap->protocol,
- td->td_proc->p_ucred, td);
+ td->td_ucred, td);
FILEDESC_LOCK(fdp);
if (error) {
if (fdp->fd_ofiles[fd] == fp) {
@@ -490,11 +490,11 @@ socketpair(td, uap)
mtx_lock(&Giant);
error = socreate(uap->domain, &so1, uap->type, uap->protocol,
- td->td_proc->p_ucred, td);
+ td->td_ucred, td);
if (error)
goto done2;
error = socreate(uap->domain, &so2, uap->type, uap->protocol,
- td->td_proc->p_ucred, td);
+ td->td_ucred, td);
if (error)
goto free1;
error = falloc(td, &fp1, &fd);
@@ -1804,7 +1804,7 @@ retry_lookup:
auio.uio_td = td;
vn_lock(vp, LK_SHARED | LK_NOPAUSE | LK_RETRY, td);
error = VOP_READ(vp, &auio, IO_VMIO | ((MAXBSIZE / bsize) << 16),
- td->td_proc->p_ucred);
+ td->td_ucred);
VOP_UNLOCK(vp, 0, td);
vm_page_flag_clear(pg, PG_ZERO);
vm_page_io_finish(pg);
diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c
index a6522607..ee2829e 100644
--- a/sys/kern/uipc_usrreq.c
+++ b/sys/kern/uipc_usrreq.c
@@ -636,7 +636,7 @@ restart:
FILEDESC_LOCK(td->td_proc->p_fd);
vattr.va_mode = (ACCESSPERMS & ~td->td_proc->p_fd->fd_cmask);
FILEDESC_UNLOCK(td->td_proc->p_fd);
- VOP_LEASE(nd.ni_dvp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(nd.ni_dvp, td, td->td_ucred, LEASE_WRITE);
error = VOP_CREATE(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr);
NDFREE(&nd, NDF_ONLY_PNBUF);
vput(nd.ni_dvp);
@@ -684,7 +684,7 @@ unp_connect(so, nam, td)
error = ENOTSOCK;
goto bad;
}
- error = VOP_ACCESS(vp, VWRITE, td->td_proc->p_ucred, td);
+ error = VOP_ACCESS(vp, VWRITE, td->td_ucred, td);
if (error)
goto bad;
so2 = vp->v_socket;
@@ -717,7 +717,7 @@ unp_connect(so, nam, td)
* from its process structure at the time of connect()
* (which is now).
*/
- cru2x(td->td_proc->p_ucred, &unp3->unp_peercred);
+ cru2x(td->td_ucred, &unp3->unp_peercred);
unp3->unp_flags |= UNP_HAVEPC;
/*
* The receiver's (server's) credentials are copied
@@ -853,7 +853,7 @@ unp_pcblist(SYSCTL_HANDLER_ARGS)
for (unp = LIST_FIRST(head), i = 0; unp && i < n;
unp = LIST_NEXT(unp, unp_link)) {
if (unp->unp_gencnt <= gencnt) {
- if (cr_cansee(req->td->td_proc->p_ucred,
+ if (cr_cansee(req->td->td_ucred,
unp->unp_socket->so_cred))
continue;
unp_list[i++] = unp;
@@ -1130,14 +1130,14 @@ unp_internalize(controlp, td)
cmcred = (struct cmsgcred *)
CMSG_DATA(mtod(*controlp, struct cmsghdr *));
cmcred->cmcred_pid = p->p_pid;
- cmcred->cmcred_uid = p->p_ucred->cr_ruid;
- cmcred->cmcred_gid = p->p_ucred->cr_rgid;
- cmcred->cmcred_euid = p->p_ucred->cr_uid;
- cmcred->cmcred_ngroups = MIN(p->p_ucred->cr_ngroups,
+ cmcred->cmcred_uid = td->td_ucred->cr_ruid;
+ cmcred->cmcred_gid = td->td_ucred->cr_rgid;
+ cmcred->cmcred_euid = td->td_ucred->cr_uid;
+ cmcred->cmcred_ngroups = MIN(td->td_ucred->cr_ngroups,
CMGROUP_MAX);
for (i = 0; i < cmcred->cmcred_ngroups; i++)
cmcred->cmcred_groups[i] =
- p->p_ucred->cr_groups[i];
+ td->td_ucred->cr_groups[i];
break;
case SCM_RIGHTS:
diff --git a/sys/kern/vfs_acl.c b/sys/kern/vfs_acl.c
index e7937bb..5f5502a 100644
--- a/sys/kern/vfs_acl.c
+++ b/sys/kern/vfs_acl.c
@@ -579,9 +579,9 @@ vacl_set_acl(struct thread *td, struct vnode *vp, acl_type_t type,
error = vn_start_write(vp, &mp, V_WAIT | PCATCH);
if (error != 0)
return (error);
- VOP_LEASE(vp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
- error = VOP_SETACL(vp, type, &inkernacl, td->td_proc->p_ucred, td);
+ error = VOP_SETACL(vp, type, &inkernacl, td->td_ucred, td);
VOP_UNLOCK(vp, 0, td);
vn_finished_write(mp);
return(error);
@@ -597,9 +597,9 @@ vacl_get_acl(struct thread *td, struct vnode *vp, acl_type_t type,
struct acl inkernelacl;
int error;
- VOP_LEASE(vp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
- error = VOP_GETACL(vp, type, &inkernelacl, td->td_proc->p_ucred, td);
+ error = VOP_GETACL(vp, type, &inkernelacl, td->td_ucred, td);
VOP_UNLOCK(vp, 0, td);
if (error == 0)
error = copyout(&inkernelacl, aclp, sizeof(struct acl));
@@ -618,10 +618,9 @@ vacl_delete(struct thread *td, struct vnode *vp, acl_type_t type)
error = vn_start_write(vp, &mp, V_WAIT | PCATCH);
if (error)
return (error);
- VOP_LEASE(vp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
- error = VOP_SETACL(vp, ACL_TYPE_DEFAULT, 0, td->td_proc->p_ucred,
- td);
+ error = VOP_SETACL(vp, ACL_TYPE_DEFAULT, 0, td->td_ucred, td);
VOP_UNLOCK(vp, 0, td);
vn_finished_write(mp);
return (error);
@@ -640,8 +639,7 @@ vacl_aclcheck(struct thread *td, struct vnode *vp, acl_type_t type,
error = copyin(aclp, &inkernelacl, sizeof(struct acl));
if (error)
return(error);
- error = VOP_ACLCHECK(vp, type, &inkernelacl, td->td_proc->p_ucred,
- td);
+ error = VOP_ACLCHECK(vp, type, &inkernelacl, td->td_ucred, td);
return (error);
}
diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c
index ebd45db..7cb7f15 100644
--- a/sys/kern/vfs_extattr.c
+++ b/sys/kern/vfs_extattr.c
@@ -213,7 +213,7 @@ vfs_mount(td, fstype, fspath, fsflags, fsdata)
/*
* Silently enforce MNT_NOSUID and MNT_NODEV for non-root users
*/
- if (suser_xxx(td->td_proc->p_ucred, 0, 0))
+ if (suser_xxx(td->td_ucred, 0, 0))
fsflags |= MNT_NOSUID | MNT_NODEV;
/*
* Get vnode to be covered
@@ -244,7 +244,7 @@ vfs_mount(td, fstype, fspath, fsflags, fsdata)
* Only root, or the user that did the original mount is
* permitted to update it.
*/
- if (mp->mnt_stat.f_owner != td->td_proc->p_ucred->cr_uid) {
+ if (mp->mnt_stat.f_owner != td->td_ucred->cr_uid) {
error = suser_td(td);
if (error) {
vput(vp);
@@ -274,19 +274,19 @@ vfs_mount(td, fstype, fspath, fsflags, fsdata)
* If the user is not root, ensure that they own the directory
* onto which we are attempting to mount.
*/
- error = VOP_GETATTR(vp, &va, td->td_proc->p_ucred, td);
+ error = VOP_GETATTR(vp, &va, td->td_ucred, td);
if (error) {
vput(vp);
return (error);
}
- if (va.va_uid != td->td_proc->p_ucred->cr_uid) {
+ if (va.va_uid != td->td_ucred->cr_uid) {
error = suser_td(td);
if (error) {
vput(vp);
return (error);
}
}
- if ((error = vinvalbuf(vp, V_SAVE, td->td_proc->p_ucred, td, 0, 0))
+ if ((error = vinvalbuf(vp, V_SAVE, td->td_ucred, td, 0, 0))
!= 0) {
vput(vp);
return (error);
@@ -352,7 +352,7 @@ vfs_mount(td, fstype, fspath, fsflags, fsdata)
strncpy(mp->mnt_stat.f_fstypename, fstype, MFSNAMELEN);
mp->mnt_stat.f_fstypename[MFSNAMELEN - 1] = '\0';
mp->mnt_vnodecovered = vp;
- mp->mnt_stat.f_owner = td->td_proc->p_ucred->cr_uid;
+ mp->mnt_stat.f_owner = td->td_ucred->cr_uid;
strncpy(mp->mnt_stat.f_mntonname, fspath, MNAMELEN);
mp->mnt_stat.f_mntonname[MNAMELEN - 1] = '\0';
mp->mnt_iosize_max = DFLTPHYS;
@@ -516,7 +516,7 @@ unmount(td, uap)
* Only root, or the user that did the original mount is
* permitted to unmount this filesystem.
*/
- if (mp->mnt_stat.f_owner != td->td_proc->p_ucred->cr_uid) {
+ if (mp->mnt_stat.f_owner != td->td_ucred->cr_uid) {
error = suser_td(td);
if (error) {
vput(vp);
@@ -588,7 +588,7 @@ dounmount(mp, flags, td)
vput(fsrootvp);
}
if (((mp->mnt_flag & MNT_RDONLY) ||
- (error = VFS_SYNC(mp, MNT_WAIT, td->td_proc->p_ucred, td)) == 0) ||
+ (error = VFS_SYNC(mp, MNT_WAIT, td->td_ucred, td)) == 0) ||
(flags & MNT_FORCE)) {
error = VFS_UNMOUNT(mp, flags, td);
}
@@ -667,7 +667,7 @@ sync(td, uap)
mp->mnt_flag &= ~MNT_ASYNC;
vfs_msync(mp, MNT_NOWAIT);
VFS_SYNC(mp, MNT_NOWAIT,
- ((td != NULL) ? td->td_proc->p_ucred : NOCRED), td);
+ ((td != NULL) ? td->td_ucred : NOCRED), td);
mp->mnt_flag |= asyncflag;
vn_finished_write(mp);
}
@@ -721,7 +721,7 @@ quotactl(td, uap)
int error;
struct nameidata nd;
- if (jailed(td->td_proc->p_ucred) && !prison_quotas)
+ if (jailed(td->td_ucred) && !prison_quotas)
return (EPERM);
NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), td);
if ((error = namei(&nd)) != 0)
@@ -772,7 +772,7 @@ statfs(td, uap)
if (error)
return (error);
sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK;
- if (suser_xxx(td->td_proc->p_ucred, 0, 0)) {
+ if (suser_xxx(td->td_ucred, 0, 0)) {
bcopy((caddr_t)sp, (caddr_t)&sb, sizeof(sb));
sb.f_fsid.val[0] = sb.f_fsid.val[1] = 0;
sp = &sb;
@@ -815,7 +815,7 @@ fstatfs(td, uap)
if (error)
return (error);
sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK;
- if (suser_xxx(td->td_proc->p_ucred, 0, 0)) {
+ if (suser_xxx(td->td_ucred, 0, 0)) {
bcopy((caddr_t)sp, (caddr_t)&sb, sizeof(sb));
sb.f_fsid.val[0] = sb.f_fsid.val[1] = 0;
sp = &sb;
@@ -923,7 +923,7 @@ fchdir(td, uap)
if (vp->v_type != VDIR)
error = ENOTDIR;
else
- error = VOP_ACCESS(vp, VEXEC, td->td_proc->p_ucred, td);
+ error = VOP_ACCESS(vp, VEXEC, td->td_ucred, td);
while (!error && (mp = vp->v_mountedhere) != NULL) {
if (vfs_busy(mp, 0, 0, td))
continue;
@@ -1091,7 +1091,7 @@ change_dir(ndp, td)
if (vp->v_type != VDIR)
error = ENOTDIR;
else
- error = VOP_ACCESS(vp, VEXEC, td->td_proc->p_ucred, td);
+ error = VOP_ACCESS(vp, VEXEC, td->td_ucred, td);
if (error)
vput(vp);
else
@@ -1235,11 +1235,11 @@ open(td, uap)
if (flags & O_TRUNC) {
if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0)
goto bad;
- VOP_LEASE(vp, td, p->p_ucred, LEASE_WRITE);
+ VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
VATTR_NULL(&vat);
vat.va_size = 0;
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
- error = VOP_SETATTR(vp, &vat, p->p_ucred, td);
+ error = VOP_SETATTR(vp, &vat, td->td_ucred, td);
VOP_UNLOCK(vp, 0, td);
vn_finished_write(mp);
if (error)
@@ -1378,7 +1378,7 @@ restart:
goto restart;
}
if (!error) {
- VOP_LEASE(nd.ni_dvp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(nd.ni_dvp, td, td->td_ucred, LEASE_WRITE);
if (whiteout)
error = VOP_WHITEOUT(nd.ni_dvp, &nd.ni_cnd, CREATE);
else {
@@ -1442,7 +1442,7 @@ restart:
FILEDESC_LOCK(td->td_proc->p_fd);
vattr.va_mode = (SCARG(uap, mode) & ALLPERMS) &~ td->td_proc->p_fd->fd_cmask;
FILEDESC_UNLOCK(td->td_proc->p_fd);
- VOP_LEASE(nd.ni_dvp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(nd.ni_dvp, td, td->td_ucred, LEASE_WRITE);
error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr);
if (error == 0)
vput(nd.ni_vp);
@@ -1495,8 +1495,8 @@ link(td, uap)
vrele(nd.ni_vp);
error = EEXIST;
} else {
- VOP_LEASE(nd.ni_dvp, td, td->td_proc->p_ucred, LEASE_WRITE);
- VOP_LEASE(vp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(nd.ni_dvp, td, td->td_ucred, LEASE_WRITE);
+ VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
error = VOP_LINK(nd.ni_dvp, vp, &nd.ni_cnd);
}
NDFREE(&nd, NDF_ONLY_PNBUF);
@@ -1559,7 +1559,7 @@ restart:
FILEDESC_LOCK(td->td_proc->p_fd);
vattr.va_mode = ACCESSPERMS &~ td->td_proc->p_fd->fd_cmask;
FILEDESC_UNLOCK(td->td_proc->p_fd);
- VOP_LEASE(nd.ni_dvp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(nd.ni_dvp, td, td->td_ucred, LEASE_WRITE);
error = VOP_SYMLINK(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr, path);
NDFREE(&nd, NDF_ONLY_PNBUF);
if (error == 0)
@@ -1610,7 +1610,7 @@ restart:
return (error);
goto restart;
}
- VOP_LEASE(nd.ni_dvp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(nd.ni_dvp, td, td->td_ucred, LEASE_WRITE);
error = VOP_WHITEOUT(nd.ni_dvp, &nd.ni_cnd, DELETE);
NDFREE(&nd, NDF_ONLY_PNBUF);
vput(nd.ni_dvp);
@@ -1666,10 +1666,10 @@ restart:
return (error);
goto restart;
}
- VOP_LEASE(vp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
if (!error) {
- VOP_LEASE(nd.ni_dvp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(nd.ni_dvp, td, td->td_ucred, LEASE_WRITE);
error = VOP_REMOVE(nd.ni_dvp, vp, &nd.ni_cnd);
}
NDFREE(&nd, NDF_ONLY_PNBUF);
@@ -1702,7 +1702,7 @@ lseek(td, uap)
syscallarg(int) whence;
} */ *uap;
{
- struct ucred *cred = td->td_proc->p_ucred;
+ struct ucred *cred = td->td_ucred;
struct file *fp;
struct vnode *vp;
struct vattr vattr;
@@ -1894,7 +1894,7 @@ eaccess(td, uap)
return (error);
vp = nd.ni_vp;
- error = vn_access(vp, SCARG(uap, flags), td->td_proc->p_ucred, td);
+ error = vn_access(vp, SCARG(uap, flags), td->td_ucred, td);
NDFREE(&nd, NDF_ONLY_PNBUF);
vput(vp);
return (error);
@@ -2258,7 +2258,7 @@ readlink(td, uap)
auio.uio_segflg = UIO_USERSPACE;
auio.uio_td = td;
auio.uio_resid = SCARG(uap, count);
- error = VOP_READLINK(vp, &auio, td->td_proc->p_ucred);
+ error = VOP_READLINK(vp, &auio, td->td_ucred);
}
vput(vp);
td->td_retval[0] = SCARG(uap, count) - auio.uio_resid;
@@ -2285,7 +2285,7 @@ setfflags(td, vp, flags)
* chown can't fail when done as root.
*/
if (vp->v_type == VCHR || vp->v_type == VBLK) {
- error = suser_xxx(td->td_proc->p_ucred, td->td_proc,
+ error = suser_xxx(td->td_ucred, td->td_proc,
PRISON_ROOT);
if (error)
return (error);
@@ -2293,11 +2293,11 @@ setfflags(td, vp, flags)
if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0)
return (error);
- VOP_LEASE(vp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
VATTR_NULL(&vattr);
vattr.va_flags = flags;
- error = VOP_SETATTR(vp, &vattr, td->td_proc->p_ucred, td);
+ error = VOP_SETATTR(vp, &vattr, td->td_ucred, td);
VOP_UNLOCK(vp, 0, td);
vn_finished_write(mp);
return (error);
@@ -2376,11 +2376,11 @@ setfmode(td, vp, mode)
if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0)
return (error);
- VOP_LEASE(vp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
VATTR_NULL(&vattr);
vattr.va_mode = mode & ALLPERMS;
- error = VOP_SETATTR(vp, &vattr, td->td_proc->p_ucred, td);
+ error = VOP_SETATTR(vp, &vattr, td->td_ucred, td);
VOP_UNLOCK(vp, 0, td);
vn_finished_write(mp);
return error;
@@ -2492,12 +2492,12 @@ setfown(td, vp, uid, gid)
if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0)
return (error);
- VOP_LEASE(vp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
VATTR_NULL(&vattr);
vattr.va_uid = uid;
vattr.va_gid = gid;
- error = VOP_SETATTR(vp, &vattr, td->td_proc->p_ucred, td);
+ error = VOP_SETATTR(vp, &vattr, td->td_ucred, td);
VOP_UNLOCK(vp, 0, td);
vn_finished_write(mp);
return error;
@@ -2640,14 +2640,14 @@ setutimes(td, vp, ts, nullflag)
if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0)
return (error);
- VOP_LEASE(vp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
VATTR_NULL(&vattr);
vattr.va_atime = ts[0];
vattr.va_mtime = ts[1];
if (nullflag)
vattr.va_vaflags |= VA_UTIMES_NULL;
- error = VOP_SETATTR(vp, &vattr, td->td_proc->p_ucred, td);
+ error = VOP_SETATTR(vp, &vattr, td->td_ucred, td);
VOP_UNLOCK(vp, 0, td);
vn_finished_write(mp);
return error;
@@ -2793,15 +2793,15 @@ truncate(td, uap)
return (error);
}
NDFREE(&nd, NDF_ONLY_PNBUF);
- VOP_LEASE(vp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
if (vp->v_type == VDIR)
error = EISDIR;
else if ((error = vn_writechk(vp)) == 0 &&
- (error = VOP_ACCESS(vp, VWRITE, td->td_proc->p_ucred, td)) == 0) {
+ (error = VOP_ACCESS(vp, VWRITE, td->td_ucred, td)) == 0) {
VATTR_NULL(&vattr);
vattr.va_size = SCARG(uap, length);
- error = VOP_SETATTR(vp, &vattr, td->td_proc->p_ucred, td);
+ error = VOP_SETATTR(vp, &vattr, td->td_ucred, td);
}
vput(vp);
vn_finished_write(mp);
@@ -2847,7 +2847,7 @@ ftruncate(td, uap)
fdrop(fp, td);
return (error);
}
- VOP_LEASE(vp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
if (vp->v_type == VDIR)
error = EISDIR;
@@ -3043,12 +3043,12 @@ rename(td, uap)
error = -1;
out:
if (!error) {
- VOP_LEASE(tdvp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(tdvp, td, td->td_ucred, LEASE_WRITE);
if (fromnd.ni_dvp != tdvp) {
- VOP_LEASE(fromnd.ni_dvp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(fromnd.ni_dvp, td, td->td_ucred, LEASE_WRITE);
}
if (tvp) {
- VOP_LEASE(tvp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(tvp, td, td->td_ucred, LEASE_WRITE);
}
error = VOP_RENAME(fromnd.ni_dvp, fromnd.ni_vp, &fromnd.ni_cnd,
tond.ni_dvp, tond.ni_vp, &tond.ni_cnd);
@@ -3140,7 +3140,7 @@ restart:
FILEDESC_LOCK(td->td_proc->p_fd);
vattr.va_mode = (mode & ACCESSPERMS) &~ td->td_proc->p_fd->fd_cmask;
FILEDESC_UNLOCK(td->td_proc->p_fd);
- VOP_LEASE(nd.ni_dvp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(nd.ni_dvp, td, td->td_ucred, LEASE_WRITE);
error = VOP_MKDIR(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr);
NDFREE(&nd, NDF_ONLY_PNBUF);
vput(nd.ni_dvp);
@@ -3209,8 +3209,8 @@ restart:
return (error);
goto restart;
}
- VOP_LEASE(nd.ni_dvp, td, td->td_proc->p_ucred, LEASE_WRITE);
- VOP_LEASE(vp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(nd.ni_dvp, td, td->td_ucred, LEASE_WRITE);
+ VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
error = VOP_RMDIR(nd.ni_dvp, nd.ni_vp, &nd.ni_cnd);
vn_finished_write(mp);
out:
@@ -3537,13 +3537,13 @@ revoke(td, uap)
vput(vp);
return (EINVAL);
}
- error = VOP_GETATTR(vp, &vattr, td->td_proc->p_ucred, td);
+ error = VOP_GETATTR(vp, &vattr, td->td_ucred, td);
if (error) {
vput(vp);
return (error);
}
VOP_UNLOCK(vp, 0, td);
- if (td->td_proc->p_ucred->cr_uid != vattr.va_uid) {
+ if (td->td_ucred->cr_uid != vattr.va_uid) {
error = suser_xxx(0, td->td_proc, PRISON_ROOT);
if (error)
goto out;
@@ -3720,7 +3720,7 @@ fhopen(td, uap)
if (fmode & FREAD)
mode |= VREAD;
if (mode) {
- error = VOP_ACCESS(vp, mode, p->p_ucred, td);
+ error = VOP_ACCESS(vp, mode, td->td_ucred, td);
if (error)
goto bad;
}
@@ -3730,23 +3730,23 @@ fhopen(td, uap)
vrele(vp);
return (error);
}
- VOP_LEASE(vp, td, p->p_ucred, LEASE_WRITE);
+ VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); /* XXX */
VATTR_NULL(vap);
vap->va_size = 0;
- error = VOP_SETATTR(vp, vap, p->p_ucred, td);
+ error = VOP_SETATTR(vp, vap, td->td_ucred, td);
vn_finished_write(mp);
if (error)
goto bad;
}
- error = VOP_OPEN(vp, fmode, p->p_ucred, td);
+ error = VOP_OPEN(vp, fmode, td->td_ucred, td);
if (error)
goto bad;
/*
* Make sure that a VM object is created for VMIO support.
*/
if (vn_canvmio(vp) == TRUE) {
- if ((error = vfs_object_create(vp, td, p->p_ucred)) != 0)
+ if ((error = vfs_object_create(vp, td, td->td_ucred)) != 0)
goto bad;
}
if (fmode & FWRITE)
@@ -3807,7 +3807,7 @@ fhopen(td, uap)
fp->f_flag |= FHASLOCK;
}
if ((vp->v_type == VREG) && (VOP_GETVOBJECT(vp, NULL) != 0))
- vfs_object_create(vp, td, p->p_ucred);
+ vfs_object_create(vp, td, td->td_ucred);
VOP_UNLOCK(vp, 0, td);
fdrop(fp, td);
@@ -3909,7 +3909,7 @@ fhstatfs(td, uap)
if ((error = VFS_STATFS(mp, sp, td)) != 0)
return (error);
sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK;
- if (suser_xxx(td->td_proc->p_ucred, 0, 0)) {
+ if (suser_xxx(td->td_ucred, 0, 0)) {
bcopy((caddr_t)sp, (caddr_t)&sb, sizeof(sb));
sb.f_fsid.val[0] = sb.f_fsid.val[1] = 0;
sp = &sb;
@@ -4021,7 +4021,7 @@ extattr_set_vp(struct vnode *vp, int attrnamespace, const char *attrname,
if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0)
return (error);
- VOP_LEASE(vp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
aiov.iov_base = data;
@@ -4040,7 +4040,7 @@ extattr_set_vp(struct vnode *vp, int attrnamespace, const char *attrname,
cnt = nbytes;
error = VOP_SETEXTATTR(vp, attrnamespace, attrname, &auio,
- td->td_proc->p_ucred, td);
+ td->td_ucred, td);
cnt -= auio.uio_resid;
td->td_retval[0] = cnt;
@@ -4121,7 +4121,7 @@ extattr_get_vp(struct vnode *vp, int attrnamespace, const char *attrname,
size_t size;
int error;
- VOP_LEASE(vp, td, td->td_proc->p_ucred, LEASE_READ);
+ VOP_LEASE(vp, td, td->td_ucred, LEASE_READ);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
/*
@@ -4227,11 +4227,11 @@ extattr_delete_vp(struct vnode *vp, int attrnamespace, const char *attrname,
if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0)
return (error);
- VOP_LEASE(vp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
error = VOP_SETEXTATTR(vp, attrnamespace, attrname, NULL,
- td->td_proc->p_ucred, td);
+ td->td_ucred, td);
VOP_UNLOCK(vp, 0, td);
vn_finished_write(mp);
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index b49717c..95df46b 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -830,7 +830,7 @@ getnewvnode(tag, mp, vops, vpp)
splx(s);
- vfs_object_create(vp, td, td->td_proc->p_ucred);
+ vfs_object_create(vp, td, td->td_ucred);
#if 0
vnodeallocs++;
@@ -1256,7 +1256,7 @@ sched_sync(void)
if (VOP_ISLOCKED(vp, NULL) == 0 &&
vn_start_write(vp, &mp, V_NOWAIT) == 0) {
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
- (void) VOP_FSYNC(vp, td->td_proc->p_ucred, MNT_LAZY, td);
+ (void) VOP_FSYNC(vp, td->td_ucred, MNT_LAZY, td);
VOP_UNLOCK(vp, 0, td);
vn_finished_write(mp);
}
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index ebd45db..7cb7f15 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -213,7 +213,7 @@ vfs_mount(td, fstype, fspath, fsflags, fsdata)
/*
* Silently enforce MNT_NOSUID and MNT_NODEV for non-root users
*/
- if (suser_xxx(td->td_proc->p_ucred, 0, 0))
+ if (suser_xxx(td->td_ucred, 0, 0))
fsflags |= MNT_NOSUID | MNT_NODEV;
/*
* Get vnode to be covered
@@ -244,7 +244,7 @@ vfs_mount(td, fstype, fspath, fsflags, fsdata)
* Only root, or the user that did the original mount is
* permitted to update it.
*/
- if (mp->mnt_stat.f_owner != td->td_proc->p_ucred->cr_uid) {
+ if (mp->mnt_stat.f_owner != td->td_ucred->cr_uid) {
error = suser_td(td);
if (error) {
vput(vp);
@@ -274,19 +274,19 @@ vfs_mount(td, fstype, fspath, fsflags, fsdata)
* If the user is not root, ensure that they own the directory
* onto which we are attempting to mount.
*/
- error = VOP_GETATTR(vp, &va, td->td_proc->p_ucred, td);
+ error = VOP_GETATTR(vp, &va, td->td_ucred, td);
if (error) {
vput(vp);
return (error);
}
- if (va.va_uid != td->td_proc->p_ucred->cr_uid) {
+ if (va.va_uid != td->td_ucred->cr_uid) {
error = suser_td(td);
if (error) {
vput(vp);
return (error);
}
}
- if ((error = vinvalbuf(vp, V_SAVE, td->td_proc->p_ucred, td, 0, 0))
+ if ((error = vinvalbuf(vp, V_SAVE, td->td_ucred, td, 0, 0))
!= 0) {
vput(vp);
return (error);
@@ -352,7 +352,7 @@ vfs_mount(td, fstype, fspath, fsflags, fsdata)
strncpy(mp->mnt_stat.f_fstypename, fstype, MFSNAMELEN);
mp->mnt_stat.f_fstypename[MFSNAMELEN - 1] = '\0';
mp->mnt_vnodecovered = vp;
- mp->mnt_stat.f_owner = td->td_proc->p_ucred->cr_uid;
+ mp->mnt_stat.f_owner = td->td_ucred->cr_uid;
strncpy(mp->mnt_stat.f_mntonname, fspath, MNAMELEN);
mp->mnt_stat.f_mntonname[MNAMELEN - 1] = '\0';
mp->mnt_iosize_max = DFLTPHYS;
@@ -516,7 +516,7 @@ unmount(td, uap)
* Only root, or the user that did the original mount is
* permitted to unmount this filesystem.
*/
- if (mp->mnt_stat.f_owner != td->td_proc->p_ucred->cr_uid) {
+ if (mp->mnt_stat.f_owner != td->td_ucred->cr_uid) {
error = suser_td(td);
if (error) {
vput(vp);
@@ -588,7 +588,7 @@ dounmount(mp, flags, td)
vput(fsrootvp);
}
if (((mp->mnt_flag & MNT_RDONLY) ||
- (error = VFS_SYNC(mp, MNT_WAIT, td->td_proc->p_ucred, td)) == 0) ||
+ (error = VFS_SYNC(mp, MNT_WAIT, td->td_ucred, td)) == 0) ||
(flags & MNT_FORCE)) {
error = VFS_UNMOUNT(mp, flags, td);
}
@@ -667,7 +667,7 @@ sync(td, uap)
mp->mnt_flag &= ~MNT_ASYNC;
vfs_msync(mp, MNT_NOWAIT);
VFS_SYNC(mp, MNT_NOWAIT,
- ((td != NULL) ? td->td_proc->p_ucred : NOCRED), td);
+ ((td != NULL) ? td->td_ucred : NOCRED), td);
mp->mnt_flag |= asyncflag;
vn_finished_write(mp);
}
@@ -721,7 +721,7 @@ quotactl(td, uap)
int error;
struct nameidata nd;
- if (jailed(td->td_proc->p_ucred) && !prison_quotas)
+ if (jailed(td->td_ucred) && !prison_quotas)
return (EPERM);
NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), td);
if ((error = namei(&nd)) != 0)
@@ -772,7 +772,7 @@ statfs(td, uap)
if (error)
return (error);
sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK;
- if (suser_xxx(td->td_proc->p_ucred, 0, 0)) {
+ if (suser_xxx(td->td_ucred, 0, 0)) {
bcopy((caddr_t)sp, (caddr_t)&sb, sizeof(sb));
sb.f_fsid.val[0] = sb.f_fsid.val[1] = 0;
sp = &sb;
@@ -815,7 +815,7 @@ fstatfs(td, uap)
if (error)
return (error);
sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK;
- if (suser_xxx(td->td_proc->p_ucred, 0, 0)) {
+ if (suser_xxx(td->td_ucred, 0, 0)) {
bcopy((caddr_t)sp, (caddr_t)&sb, sizeof(sb));
sb.f_fsid.val[0] = sb.f_fsid.val[1] = 0;
sp = &sb;
@@ -923,7 +923,7 @@ fchdir(td, uap)
if (vp->v_type != VDIR)
error = ENOTDIR;
else
- error = VOP_ACCESS(vp, VEXEC, td->td_proc->p_ucred, td);
+ error = VOP_ACCESS(vp, VEXEC, td->td_ucred, td);
while (!error && (mp = vp->v_mountedhere) != NULL) {
if (vfs_busy(mp, 0, 0, td))
continue;
@@ -1091,7 +1091,7 @@ change_dir(ndp, td)
if (vp->v_type != VDIR)
error = ENOTDIR;
else
- error = VOP_ACCESS(vp, VEXEC, td->td_proc->p_ucred, td);
+ error = VOP_ACCESS(vp, VEXEC, td->td_ucred, td);
if (error)
vput(vp);
else
@@ -1235,11 +1235,11 @@ open(td, uap)
if (flags & O_TRUNC) {
if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0)
goto bad;
- VOP_LEASE(vp, td, p->p_ucred, LEASE_WRITE);
+ VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
VATTR_NULL(&vat);
vat.va_size = 0;
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
- error = VOP_SETATTR(vp, &vat, p->p_ucred, td);
+ error = VOP_SETATTR(vp, &vat, td->td_ucred, td);
VOP_UNLOCK(vp, 0, td);
vn_finished_write(mp);
if (error)
@@ -1378,7 +1378,7 @@ restart:
goto restart;
}
if (!error) {
- VOP_LEASE(nd.ni_dvp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(nd.ni_dvp, td, td->td_ucred, LEASE_WRITE);
if (whiteout)
error = VOP_WHITEOUT(nd.ni_dvp, &nd.ni_cnd, CREATE);
else {
@@ -1442,7 +1442,7 @@ restart:
FILEDESC_LOCK(td->td_proc->p_fd);
vattr.va_mode = (SCARG(uap, mode) & ALLPERMS) &~ td->td_proc->p_fd->fd_cmask;
FILEDESC_UNLOCK(td->td_proc->p_fd);
- VOP_LEASE(nd.ni_dvp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(nd.ni_dvp, td, td->td_ucred, LEASE_WRITE);
error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr);
if (error == 0)
vput(nd.ni_vp);
@@ -1495,8 +1495,8 @@ link(td, uap)
vrele(nd.ni_vp);
error = EEXIST;
} else {
- VOP_LEASE(nd.ni_dvp, td, td->td_proc->p_ucred, LEASE_WRITE);
- VOP_LEASE(vp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(nd.ni_dvp, td, td->td_ucred, LEASE_WRITE);
+ VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
error = VOP_LINK(nd.ni_dvp, vp, &nd.ni_cnd);
}
NDFREE(&nd, NDF_ONLY_PNBUF);
@@ -1559,7 +1559,7 @@ restart:
FILEDESC_LOCK(td->td_proc->p_fd);
vattr.va_mode = ACCESSPERMS &~ td->td_proc->p_fd->fd_cmask;
FILEDESC_UNLOCK(td->td_proc->p_fd);
- VOP_LEASE(nd.ni_dvp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(nd.ni_dvp, td, td->td_ucred, LEASE_WRITE);
error = VOP_SYMLINK(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr, path);
NDFREE(&nd, NDF_ONLY_PNBUF);
if (error == 0)
@@ -1610,7 +1610,7 @@ restart:
return (error);
goto restart;
}
- VOP_LEASE(nd.ni_dvp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(nd.ni_dvp, td, td->td_ucred, LEASE_WRITE);
error = VOP_WHITEOUT(nd.ni_dvp, &nd.ni_cnd, DELETE);
NDFREE(&nd, NDF_ONLY_PNBUF);
vput(nd.ni_dvp);
@@ -1666,10 +1666,10 @@ restart:
return (error);
goto restart;
}
- VOP_LEASE(vp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
if (!error) {
- VOP_LEASE(nd.ni_dvp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(nd.ni_dvp, td, td->td_ucred, LEASE_WRITE);
error = VOP_REMOVE(nd.ni_dvp, vp, &nd.ni_cnd);
}
NDFREE(&nd, NDF_ONLY_PNBUF);
@@ -1702,7 +1702,7 @@ lseek(td, uap)
syscallarg(int) whence;
} */ *uap;
{
- struct ucred *cred = td->td_proc->p_ucred;
+ struct ucred *cred = td->td_ucred;
struct file *fp;
struct vnode *vp;
struct vattr vattr;
@@ -1894,7 +1894,7 @@ eaccess(td, uap)
return (error);
vp = nd.ni_vp;
- error = vn_access(vp, SCARG(uap, flags), td->td_proc->p_ucred, td);
+ error = vn_access(vp, SCARG(uap, flags), td->td_ucred, td);
NDFREE(&nd, NDF_ONLY_PNBUF);
vput(vp);
return (error);
@@ -2258,7 +2258,7 @@ readlink(td, uap)
auio.uio_segflg = UIO_USERSPACE;
auio.uio_td = td;
auio.uio_resid = SCARG(uap, count);
- error = VOP_READLINK(vp, &auio, td->td_proc->p_ucred);
+ error = VOP_READLINK(vp, &auio, td->td_ucred);
}
vput(vp);
td->td_retval[0] = SCARG(uap, count) - auio.uio_resid;
@@ -2285,7 +2285,7 @@ setfflags(td, vp, flags)
* chown can't fail when done as root.
*/
if (vp->v_type == VCHR || vp->v_type == VBLK) {
- error = suser_xxx(td->td_proc->p_ucred, td->td_proc,
+ error = suser_xxx(td->td_ucred, td->td_proc,
PRISON_ROOT);
if (error)
return (error);
@@ -2293,11 +2293,11 @@ setfflags(td, vp, flags)
if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0)
return (error);
- VOP_LEASE(vp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
VATTR_NULL(&vattr);
vattr.va_flags = flags;
- error = VOP_SETATTR(vp, &vattr, td->td_proc->p_ucred, td);
+ error = VOP_SETATTR(vp, &vattr, td->td_ucred, td);
VOP_UNLOCK(vp, 0, td);
vn_finished_write(mp);
return (error);
@@ -2376,11 +2376,11 @@ setfmode(td, vp, mode)
if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0)
return (error);
- VOP_LEASE(vp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
VATTR_NULL(&vattr);
vattr.va_mode = mode & ALLPERMS;
- error = VOP_SETATTR(vp, &vattr, td->td_proc->p_ucred, td);
+ error = VOP_SETATTR(vp, &vattr, td->td_ucred, td);
VOP_UNLOCK(vp, 0, td);
vn_finished_write(mp);
return error;
@@ -2492,12 +2492,12 @@ setfown(td, vp, uid, gid)
if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0)
return (error);
- VOP_LEASE(vp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
VATTR_NULL(&vattr);
vattr.va_uid = uid;
vattr.va_gid = gid;
- error = VOP_SETATTR(vp, &vattr, td->td_proc->p_ucred, td);
+ error = VOP_SETATTR(vp, &vattr, td->td_ucred, td);
VOP_UNLOCK(vp, 0, td);
vn_finished_write(mp);
return error;
@@ -2640,14 +2640,14 @@ setutimes(td, vp, ts, nullflag)
if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0)
return (error);
- VOP_LEASE(vp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
VATTR_NULL(&vattr);
vattr.va_atime = ts[0];
vattr.va_mtime = ts[1];
if (nullflag)
vattr.va_vaflags |= VA_UTIMES_NULL;
- error = VOP_SETATTR(vp, &vattr, td->td_proc->p_ucred, td);
+ error = VOP_SETATTR(vp, &vattr, td->td_ucred, td);
VOP_UNLOCK(vp, 0, td);
vn_finished_write(mp);
return error;
@@ -2793,15 +2793,15 @@ truncate(td, uap)
return (error);
}
NDFREE(&nd, NDF_ONLY_PNBUF);
- VOP_LEASE(vp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
if (vp->v_type == VDIR)
error = EISDIR;
else if ((error = vn_writechk(vp)) == 0 &&
- (error = VOP_ACCESS(vp, VWRITE, td->td_proc->p_ucred, td)) == 0) {
+ (error = VOP_ACCESS(vp, VWRITE, td->td_ucred, td)) == 0) {
VATTR_NULL(&vattr);
vattr.va_size = SCARG(uap, length);
- error = VOP_SETATTR(vp, &vattr, td->td_proc->p_ucred, td);
+ error = VOP_SETATTR(vp, &vattr, td->td_ucred, td);
}
vput(vp);
vn_finished_write(mp);
@@ -2847,7 +2847,7 @@ ftruncate(td, uap)
fdrop(fp, td);
return (error);
}
- VOP_LEASE(vp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
if (vp->v_type == VDIR)
error = EISDIR;
@@ -3043,12 +3043,12 @@ rename(td, uap)
error = -1;
out:
if (!error) {
- VOP_LEASE(tdvp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(tdvp, td, td->td_ucred, LEASE_WRITE);
if (fromnd.ni_dvp != tdvp) {
- VOP_LEASE(fromnd.ni_dvp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(fromnd.ni_dvp, td, td->td_ucred, LEASE_WRITE);
}
if (tvp) {
- VOP_LEASE(tvp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(tvp, td, td->td_ucred, LEASE_WRITE);
}
error = VOP_RENAME(fromnd.ni_dvp, fromnd.ni_vp, &fromnd.ni_cnd,
tond.ni_dvp, tond.ni_vp, &tond.ni_cnd);
@@ -3140,7 +3140,7 @@ restart:
FILEDESC_LOCK(td->td_proc->p_fd);
vattr.va_mode = (mode & ACCESSPERMS) &~ td->td_proc->p_fd->fd_cmask;
FILEDESC_UNLOCK(td->td_proc->p_fd);
- VOP_LEASE(nd.ni_dvp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(nd.ni_dvp, td, td->td_ucred, LEASE_WRITE);
error = VOP_MKDIR(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr);
NDFREE(&nd, NDF_ONLY_PNBUF);
vput(nd.ni_dvp);
@@ -3209,8 +3209,8 @@ restart:
return (error);
goto restart;
}
- VOP_LEASE(nd.ni_dvp, td, td->td_proc->p_ucred, LEASE_WRITE);
- VOP_LEASE(vp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(nd.ni_dvp, td, td->td_ucred, LEASE_WRITE);
+ VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
error = VOP_RMDIR(nd.ni_dvp, nd.ni_vp, &nd.ni_cnd);
vn_finished_write(mp);
out:
@@ -3537,13 +3537,13 @@ revoke(td, uap)
vput(vp);
return (EINVAL);
}
- error = VOP_GETATTR(vp, &vattr, td->td_proc->p_ucred, td);
+ error = VOP_GETATTR(vp, &vattr, td->td_ucred, td);
if (error) {
vput(vp);
return (error);
}
VOP_UNLOCK(vp, 0, td);
- if (td->td_proc->p_ucred->cr_uid != vattr.va_uid) {
+ if (td->td_ucred->cr_uid != vattr.va_uid) {
error = suser_xxx(0, td->td_proc, PRISON_ROOT);
if (error)
goto out;
@@ -3720,7 +3720,7 @@ fhopen(td, uap)
if (fmode & FREAD)
mode |= VREAD;
if (mode) {
- error = VOP_ACCESS(vp, mode, p->p_ucred, td);
+ error = VOP_ACCESS(vp, mode, td->td_ucred, td);
if (error)
goto bad;
}
@@ -3730,23 +3730,23 @@ fhopen(td, uap)
vrele(vp);
return (error);
}
- VOP_LEASE(vp, td, p->p_ucred, LEASE_WRITE);
+ VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); /* XXX */
VATTR_NULL(vap);
vap->va_size = 0;
- error = VOP_SETATTR(vp, vap, p->p_ucred, td);
+ error = VOP_SETATTR(vp, vap, td->td_ucred, td);
vn_finished_write(mp);
if (error)
goto bad;
}
- error = VOP_OPEN(vp, fmode, p->p_ucred, td);
+ error = VOP_OPEN(vp, fmode, td->td_ucred, td);
if (error)
goto bad;
/*
* Make sure that a VM object is created for VMIO support.
*/
if (vn_canvmio(vp) == TRUE) {
- if ((error = vfs_object_create(vp, td, p->p_ucred)) != 0)
+ if ((error = vfs_object_create(vp, td, td->td_ucred)) != 0)
goto bad;
}
if (fmode & FWRITE)
@@ -3807,7 +3807,7 @@ fhopen(td, uap)
fp->f_flag |= FHASLOCK;
}
if ((vp->v_type == VREG) && (VOP_GETVOBJECT(vp, NULL) != 0))
- vfs_object_create(vp, td, p->p_ucred);
+ vfs_object_create(vp, td, td->td_ucred);
VOP_UNLOCK(vp, 0, td);
fdrop(fp, td);
@@ -3909,7 +3909,7 @@ fhstatfs(td, uap)
if ((error = VFS_STATFS(mp, sp, td)) != 0)
return (error);
sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK;
- if (suser_xxx(td->td_proc->p_ucred, 0, 0)) {
+ if (suser_xxx(td->td_ucred, 0, 0)) {
bcopy((caddr_t)sp, (caddr_t)&sb, sizeof(sb));
sb.f_fsid.val[0] = sb.f_fsid.val[1] = 0;
sp = &sb;
@@ -4021,7 +4021,7 @@ extattr_set_vp(struct vnode *vp, int attrnamespace, const char *attrname,
if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0)
return (error);
- VOP_LEASE(vp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
aiov.iov_base = data;
@@ -4040,7 +4040,7 @@ extattr_set_vp(struct vnode *vp, int attrnamespace, const char *attrname,
cnt = nbytes;
error = VOP_SETEXTATTR(vp, attrnamespace, attrname, &auio,
- td->td_proc->p_ucred, td);
+ td->td_ucred, td);
cnt -= auio.uio_resid;
td->td_retval[0] = cnt;
@@ -4121,7 +4121,7 @@ extattr_get_vp(struct vnode *vp, int attrnamespace, const char *attrname,
size_t size;
int error;
- VOP_LEASE(vp, td, td->td_proc->p_ucred, LEASE_READ);
+ VOP_LEASE(vp, td, td->td_ucred, LEASE_READ);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
/*
@@ -4227,11 +4227,11 @@ extattr_delete_vp(struct vnode *vp, int attrnamespace, const char *attrname,
if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0)
return (error);
- VOP_LEASE(vp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
error = VOP_SETEXTATTR(vp, attrnamespace, attrname, NULL,
- td->td_proc->p_ucred, td);
+ td->td_ucred, td);
VOP_UNLOCK(vp, 0, td);
vn_finished_write(mp);
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index ab3e3c9..5ea1a61 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -83,7 +83,7 @@ vn_open(ndp, flagp, cmode)
{
struct thread *td = ndp->ni_cnd.cn_thread;
- return (vn_open_cred(ndp, flagp, cmode, td->td_proc->p_ucred));
+ return (vn_open_cred(ndp, flagp, cmode, td->td_ucred));
}
/*
@@ -511,7 +511,7 @@ vn_stat(vp, sb, td)
u_short mode;
vap = &vattr;
- error = VOP_GETATTR(vp, vap, td->td_proc->p_ucred, td);
+ error = VOP_GETATTR(vp, vap, td->td_ucred, td);
if (error)
return (error);
@@ -594,7 +594,7 @@ vn_stat(vp, sb, td)
}
sb->st_flags = vap->va_flags;
- if (suser_xxx(td->td_proc->p_ucred, 0, 0))
+ if (suser_xxx(td->td_ucred, 0, 0))
sb->st_gen = 0;
else
sb->st_gen = vap->va_gen;
@@ -629,7 +629,7 @@ vn_ioctl(fp, com, data, td)
case VDIR:
if (com == FIONREAD) {
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
- error = VOP_GETATTR(vp, &vattr, td->td_proc->p_ucred, td);
+ error = VOP_GETATTR(vp, &vattr, td->td_ucred, td);
VOP_UNLOCK(vp, 0, td);
if (error)
return (error);
@@ -653,7 +653,7 @@ vn_ioctl(fp, com, data, td)
*(int *)data = devsw(vp->v_rdev)->d_flags & D_TYPEMASK;
return (0);
}
- error = VOP_IOCTL(vp, com, data, fp->f_flag, td->td_proc->p_ucred, td);
+ error = VOP_IOCTL(vp, com, data, fp->f_flag, td->td_ucred, td);
if (error == 0 && com == TIOCSCTTY) {
/* Do nothing if reassigning same control tty */
@@ -872,7 +872,7 @@ vfs_write_suspend(mp)
mp->mnt_kern_flag |= MNTK_SUSPEND;
if (mp->mnt_writeopcount > 0)
(void) tsleep(&mp->mnt_writeopcount, PUSER - 1, "suspwt", 0);
- VFS_SYNC(mp, MNT_WAIT, td->td_proc->p_ucred, td);
+ VFS_SYNC(mp, MNT_WAIT, td->td_ucred, td);
mp->mnt_kern_flag |= MNTK_SUSPENDED;
}
OpenPOWER on IntegriCloud