summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2002-02-27 18:32:23 +0000
committerjhb <jhb@FreeBSD.org>2002-02-27 18:32:23 +0000
commit3706cd350927f08fa8742cce9448c9ba8e4d6b2c (patch)
treede74317436bc6bf8211535e1dbda3f6762d05582
parentec01b5bdbc40025303ba133be03a747c8dc62a2c (diff)
downloadFreeBSD-src-3706cd350927f08fa8742cce9448c9ba8e4d6b2c.zip
FreeBSD-src-3706cd350927f08fa8742cce9448c9ba8e4d6b2c.tar.gz
Simple p_ucred -> td_ucred changes to start using the per-thread ucred
reference.
-rw-r--r--sys/alpha/alpha/mem.c2
-rw-r--r--sys/alpha/alpha/sys_machdep.c2
-rw-r--r--sys/alpha/osf1/osf1_misc.c2
-rw-r--r--sys/amd64/amd64/mem.c4
-rw-r--r--sys/amd64/amd64/sys_machdep.c2
-rw-r--r--sys/cam/scsi/scsi_pass.c2
-rw-r--r--sys/coda/coda_vfsops.c4
-rw-r--r--sys/compat/linux/linux_file.c2
-rw-r--r--sys/compat/linux/linux_getcwd.c8
-rw-r--r--sys/compat/linux/linux_misc.c6
-rw-r--r--sys/compat/linux/linux_uid16.c6
-rw-r--r--sys/compat/linux/linux_util.c4
-rw-r--r--sys/compat/pecoff/imgact_pecoff.c4
-rw-r--r--sys/compat/svr4/svr4_fcntl.c6
-rw-r--r--sys/compat/svr4/svr4_misc.c4
-rw-r--r--sys/compat/svr4/svr4_sysvec.c5
-rw-r--r--sys/dev/ccd/ccd.c10
-rw-r--r--sys/dev/md/md.c13
-rw-r--r--sys/dev/nmdm/nmdm.c2
-rw-r--r--sys/dev/pci/pci_user.c2
-rw-r--r--sys/dev/random/randomdev.c4
-rw-r--r--sys/dev/streams/streams.c2
-rw-r--r--sys/dev/syscons/syscons.c2
-rw-r--r--sys/fs/cd9660/cd9660_vfsops.c4
-rw-r--r--sys/fs/coda/coda_vfsops.c4
-rw-r--r--sys/fs/fifofs/fifo_vnops.c4
-rw-r--r--sys/fs/hpfs/hpfs_vfsops.c2
-rw-r--r--sys/fs/msdosfs/msdosfs_vfsops.c6
-rw-r--r--sys/fs/ntfs/ntfs_vfsops.c2
-rw-r--r--sys/fs/nwfs/nwfs_io.c8
-rw-r--r--sys/fs/nwfs/nwfs_node.c2
-rw-r--r--sys/fs/nwfs/nwfs_vfsops.c8
-rw-r--r--sys/fs/portalfs/portal_vnops.c4
-rw-r--r--sys/fs/smbfs/smbfs_io.c6
-rw-r--r--sys/fs/smbfs/smbfs_node.c2
-rw-r--r--sys/fs/smbfs/smbfs_vfsops.c8
-rw-r--r--sys/fs/smbfs/smbfs_vnops.c3
-rw-r--r--sys/fs/specfs/spec_vnops.c8
-rw-r--r--sys/fs/unionfs/union_subr.c6
-rw-r--r--sys/fs/unionfs/union_vfsops.c2
-rw-r--r--sys/geom/geom_ccd.c10
-rw-r--r--sys/gnu/ext2fs/ext2_vfsops.c6
-rw-r--r--sys/gnu/fs/ext2fs/ext2_vfsops.c6
-rw-r--r--sys/i386/i386/mem.c4
-rw-r--r--sys/i386/i386/sys_machdep.c2
-rw-r--r--sys/i386/ibcs2/ibcs2_util.c4
-rw-r--r--sys/i386/ibcs2/ibcs2_xenix.c2
-rw-r--r--sys/i386/ibcs2/imgact_coff.c6
-rw-r--r--sys/i386/isa/pcvt/pcvt_ext.c2
-rw-r--r--sys/i386/isa/spigot.c4
-rw-r--r--sys/i386/linux/linux_machdep.c2
-rw-r--r--sys/ia64/ia64/mem.c2
-rw-r--r--sys/isofs/cd9660/cd9660_vfsops.c4
-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
-rw-r--r--sys/net/if.c4
-rw-r--r--sys/net/rtsock.c4
-rw-r--r--sys/netgraph/ng_ksocket.c2
-rw-r--r--sys/netinet/in_pcb.c10
-rw-r--r--sys/netinet/ip_dummynet.c2
-rw-r--r--sys/netinet/ip_fw.c2
-rw-r--r--sys/netinet/raw_ip.c2
-rw-r--r--sys/netinet/tcp_subr.c6
-rw-r--r--sys/netinet/tcp_timewait.c6
-rw-r--r--sys/netinet/tcp_usrreq.c4
-rw-r--r--sys/netinet/udp_usrreq.c12
-rw-r--r--sys/netsmb/smb_conn.c2
-rw-r--r--sys/netsmb/smb_dev.c3
-rw-r--r--sys/netsmb/smb_subr.c2
-rw-r--r--sys/netsmb/smb_trantcp.c2
-rw-r--r--sys/nfsclient/bootp_subr.c6
-rw-r--r--sys/nfsclient/krpc_subr.c3
-rw-r--r--sys/nfsclient/nfs_bio.c4
-rw-r--r--sys/nfsclient/nfs_lock.c4
-rw-r--r--sys/nfsclient/nfs_vfsops.c12
-rw-r--r--sys/nfsserver/nfs_serv.c2
-rw-r--r--sys/nfsserver/nfs_srvsubs.c3
-rw-r--r--sys/pc98/pc98/syscons.c2
-rw-r--r--sys/security/lomac/kernel_mmap.c2
-rw-r--r--sys/security/lomac/kernel_socket.c4
-rw-r--r--sys/security/lomac/kernel_util.c5
-rw-r--r--sys/ufs/ffs/ffs_snapshot.c2
-rw-r--r--sys/ufs/ffs/ffs_softdep.c18
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c12
-rw-r--r--sys/ufs/ufs/ufs_extattr.c18
-rw-r--r--sys/ufs/ufs/ufs_lookup.c4
-rw-r--r--sys/ufs/ufs/ufs_quota.c6
-rw-r--r--sys/ufs/ufs/ufs_vfsops.c4
-rw-r--r--sys/vm/vm_mmap.c6
-rw-r--r--sys/vm/vm_swap.c11
-rw-r--r--sys/vm/vnode_pager.c12
117 files changed, 430 insertions, 454 deletions
diff --git a/sys/alpha/alpha/mem.c b/sys/alpha/alpha/mem.c
index 8e75113..c610c6e 100644
--- a/sys/alpha/alpha/mem.c
+++ b/sys/alpha/alpha/mem.c
@@ -122,7 +122,7 @@ mmopen(dev_t dev, int flags, int fmt, struct thread *td)
case 0:
case 1:
if (flags & FWRITE) {
- error = securelevel_gt(td->td_proc->p_ucred, 0);
+ error = securelevel_gt(td->td_ucred, 0);
if (error)
return (error);
}
diff --git a/sys/alpha/alpha/sys_machdep.c b/sys/alpha/alpha/sys_machdep.c
index 7f6c270..bc7bc02 100644
--- a/sys/alpha/alpha/sys_machdep.c
+++ b/sys/alpha/alpha/sys_machdep.c
@@ -114,7 +114,7 @@ alpha_sethae(struct thread *td, char *args)
if (error)
return (error);
- error = securelevel_gt(td->td_proc->p_ucred, 0);
+ error = securelevel_gt(td->td_ucred, 0);
if (error)
return (error);
diff --git a/sys/alpha/osf1/osf1_misc.c b/sys/alpha/osf1/osf1_misc.c
index df37cc6..235ba90 100644
--- a/sys/alpha/osf1/osf1_misc.c
+++ b/sys/alpha/osf1/osf1_misc.c
@@ -194,7 +194,7 @@ osf1_emul_find(td, sgp, prefix, path, pbuf, cflag)
return error;
}
- ucred = td->td_proc->p_ucred;
+ ucred = td->td_ucred;
if ((error = VOP_GETATTR(nd.ni_vp, &vat, ucred, td)) != 0) {
goto bad;
}
diff --git a/sys/amd64/amd64/mem.c b/sys/amd64/amd64/mem.c
index c8fdd2a..94851fd 100644
--- a/sys/amd64/amd64/mem.c
+++ b/sys/amd64/amd64/mem.c
@@ -116,7 +116,7 @@ mmopen(dev_t dev, int flags, int fmt, struct thread *td)
case 0:
case 1:
if (flags & FWRITE) {
- error = securelevel_gt(td->td_proc->p_ucred, 0);
+ error = securelevel_gt(td->td_ucred, 0);
if (error != 0)
return (error);
}
@@ -125,7 +125,7 @@ mmopen(dev_t dev, int flags, int fmt, struct thread *td)
error = suser_td(td);
if (error != 0)
return (error);
- error = securelevel_gt(td->td_proc->p_ucred, 0);
+ error = securelevel_gt(td->td_ucred, 0);
if (error != 0)
return (error);
td->td_frame->tf_eflags |= PSL_IOPL;
diff --git a/sys/amd64/amd64/sys_machdep.c b/sys/amd64/amd64/sys_machdep.c
index b7beea9..58e1a22 100644
--- a/sys/amd64/amd64/sys_machdep.c
+++ b/sys/amd64/amd64/sys_machdep.c
@@ -185,7 +185,7 @@ i386_set_ioperm(td, args)
if ((error = suser_td(td)) != 0)
return (error);
- if ((error = securelevel_gt(td->td_proc->p_ucred, 0)) != 0)
+ if ((error = securelevel_gt(td->td_ucred, 0)) != 0)
return (error);
/*
* XXX
diff --git a/sys/cam/scsi/scsi_pass.c b/sys/cam/scsi/scsi_pass.c
index 964d383..e291aca 100644
--- a/sys/cam/scsi/scsi_pass.c
+++ b/sys/cam/scsi/scsi_pass.c
@@ -371,7 +371,7 @@ passopen(dev_t dev, int flags, int fmt, struct thread *td)
/*
* Don't allow access when we're running at a high securelevel.
*/
- error = securelevel_gt(td->td_proc->p_ucred, 1);
+ error = securelevel_gt(td->td_ucred, 1);
if (error) {
splx(s);
return(error);
diff --git a/sys/coda/coda_vfsops.c b/sys/coda/coda_vfsops.c
index 275b036..5d5a810 100644
--- a/sys/coda/coda_vfsops.c
+++ b/sys/coda/coda_vfsops.c
@@ -317,7 +317,7 @@ coda_root(vfsp, vpp)
}
}
- error = venus_root(vftomi(vfsp), p->p_ucred, p, &VFid);
+ error = venus_root(vftomi(vfsp), td->td_ucred, p, &VFid);
if (!error) {
/*
@@ -457,7 +457,7 @@ coda_fhtovp(vfsp, fhp, nam, vpp, exflagsp, creadanonp)
return(0);
}
- error = venus_fhtovp(vftomi(vfsp), &cfid->cfid_fid, p->p_ucred, p, &VFid, &vtype);
+ error = venus_fhtovp(vftomi(vfsp), &cfid->cfid_fid, td->td_ucred, p, &VFid, &vtype);
if (error) {
CODADEBUG(CODA_VGET, myprintf(("vget error %d\n",error));)
diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c
index dd4f219..0d9273e 100644
--- a/sys/compat/linux/linux_file.c
+++ b/sys/compat/linux/linux_file.c
@@ -285,7 +285,7 @@ getdents_common(struct thread *td, struct linux_getdents64_args *args,
return (EINVAL);
}
- if ((error = VOP_GETATTR(vp, &va, td->td_proc->p_ucred, td))) {
+ if ((error = VOP_GETATTR(vp, &va, td->td_ucred, td))) {
fdrop(fp, td);
return (error);
}
diff --git a/sys/compat/linux/linux_getcwd.c b/sys/compat/linux/linux_getcwd.c
index 509cdec..2a09fd3 100644
--- a/sys/compat/linux/linux_getcwd.c
+++ b/sys/compat/linux/linux_getcwd.c
@@ -132,7 +132,7 @@ linux_getcwd_scandir(lvpp, uvpp, bpp, bufp, td)
* current directory is still locked.
*/
if (bufp != NULL) {
- error = VOP_GETATTR(lvp, &va, td->td_proc->p_ucred, td);
+ error = VOP_GETATTR(lvp, &va, td->td_ucred, td);
if (error) {
vput(lvp);
*lvpp = NULL;
@@ -148,7 +148,7 @@ linux_getcwd_scandir(lvpp, uvpp, bpp, bufp, td)
cn.cn_nameiop = LOOKUP;
cn.cn_flags = ISLASTCN | ISDOTDOT | RDONLY;
cn.cn_thread = td;
- cn.cn_cred = td->td_proc->p_ucred;
+ cn.cn_cred = td->td_ucred;
cn.cn_pnbuf = NULL;
cn.cn_nameptr = "..";
cn.cn_namelen = 2;
@@ -200,7 +200,7 @@ unionread:
eofflag = 0;
- error = VOP_READDIR(uvp, &uio, td->td_proc->p_ucred, &eofflag, 0, 0);
+ error = VOP_READDIR(uvp, &uio, td->td_ucred, &eofflag, 0, 0);
off = uio.uio_offset;
@@ -335,7 +335,7 @@ linux_getcwd_common (lvp, rvp, bpp, bufp, limit, flags, td)
* whether or not caller cares.
*/
if (flags & GETCWD_CHECK_ACCESS) {
- error = VOP_ACCESS(lvp, perms, td->td_proc->p_ucred, td);
+ error = VOP_ACCESS(lvp, perms, td->td_ucred, td);
if (error)
goto out;
perms = VEXEC|VREAD;
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index 031c406..68f99fb 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -284,7 +284,7 @@ linux_uselib(struct thread *td, struct linux_uselib_args *args)
}
/* Executable? */
- error = VOP_GETATTR(vp, &attr, td->td_proc->p_ucred, td);
+ error = VOP_GETATTR(vp, &attr, td->td_ucred, td);
if (error)
goto cleanup;
@@ -301,11 +301,11 @@ linux_uselib(struct thread *td, struct linux_uselib_args *args)
}
/* Can we access it? */
- error = VOP_ACCESS(vp, VEXEC, td->td_proc->p_ucred, td);
+ error = VOP_ACCESS(vp, VEXEC, td->td_ucred, td);
if (error)
goto cleanup;
- error = VOP_OPEN(vp, FREAD, td->td_proc->p_ucred, td);
+ error = VOP_OPEN(vp, FREAD, td->td_ucred, td);
if (error)
goto cleanup;
diff --git a/sys/compat/linux/linux_uid16.c b/sys/compat/linux/linux_uid16.c
index dcb61a7..f768bae 100644
--- a/sys/compat/linux/linux_uid16.c
+++ b/sys/compat/linux/linux_uid16.c
@@ -152,7 +152,7 @@ linux_getgroups16(struct thread *td, struct linux_getgroups16_args *args)
printf(ARGS(getgroups16, "%d, *"), args->gidsetsize);
#endif
- cred = td->td_proc->p_ucred;
+ cred = td->td_ucred;
bsd_gidset = cred->cr_groups;
bsd_gidsetsz = cred->cr_ngroups - 1;
@@ -200,7 +200,7 @@ int
linux_getgid16(struct thread *td, struct linux_getgid16_args *args)
{
- td->td_retval[0] = td->td_proc->p_ucred->cr_rgid;
+ td->td_retval[0] = td->td_ucred->cr_rgid;
return (0);
}
@@ -208,7 +208,7 @@ int
linux_getuid16(struct thread *td, struct linux_getuid16_args *args)
{
- td->td_retval[0] = td->td_proc->p_ucred->cr_ruid;
+ td->td_retval[0] = td->td_ucred->cr_ruid;
return (0);
}
diff --git a/sys/compat/linux/linux_util.c b/sys/compat/linux/linux_util.c
index c30d0f4..4949a45 100644
--- a/sys/compat/linux/linux_util.c
+++ b/sys/compat/linux/linux_util.c
@@ -140,11 +140,11 @@ linux_emul_find(td, sgp, path, pbuf, cflag)
return error;
}
- if ((error = VOP_GETATTR(nd.ni_vp, &vat, td->td_proc->p_ucred, td)) != 0) {
+ if ((error = VOP_GETATTR(nd.ni_vp, &vat, td->td_ucred, td)) != 0) {
goto bad;
}
- if ((error = VOP_GETATTR(ndroot.ni_vp, &vatroot, td->td_proc->p_ucred, td))
+ if ((error = VOP_GETATTR(ndroot.ni_vp, &vatroot, td->td_ucred, td))
!= 0) {
goto bad;
}
diff --git a/sys/compat/pecoff/imgact_pecoff.c b/sys/compat/pecoff/imgact_pecoff.c
index ac608f5..f3acb99 100644
--- a/sys/compat/pecoff/imgact_pecoff.c
+++ b/sys/compat/pecoff/imgact_pecoff.c
@@ -163,7 +163,7 @@ static int
pecoff_coredump(register struct thread * td, register struct vnode * vp,
off_t limit)
{
- register struct ucred *cred = td->td_proc->p_ucred;
+ register struct ucred *cred = td->td_ucred;
register struct vmspace *vm = td->td_proc->p_vmspace;
int error;
#ifdef PECOFF_DEBUG
@@ -607,7 +607,7 @@ pecoff_read_from(td, vp, pos, buf, siz)
size_t resid;
error = vn_rdwr(UIO_READ, vp, buf, siz, pos,
- UIO_SYSSPACE, IO_NODELOCKED, td->td_proc->p_ucred,
+ UIO_SYSSPACE, IO_NODELOCKED, td->td_ucred,
&resid, td);
if (error)
return error;
diff --git a/sys/compat/svr4/svr4_fcntl.c b/sys/compat/svr4/svr4_fcntl.c
index 12c956c..394b1d5 100644
--- a/sys/compat/svr4/svr4_fcntl.c
+++ b/sys/compat/svr4/svr4_fcntl.c
@@ -260,10 +260,10 @@ fd_revoke(td, fd)
goto out;
}
- if ((error = VOP_GETATTR(vp, &vattr, td->td_proc->p_ucred, td)) != 0)
+ if ((error = VOP_GETATTR(vp, &vattr, td->td_ucred, td)) != 0)
goto out;
- if (td->td_proc->p_ucred->cr_uid != vattr.va_uid &&
+ if (td->td_ucred->cr_uid != vattr.va_uid &&
(error = suser_td(td)) != 0)
goto out;
@@ -306,7 +306,7 @@ fd_truncate(td, fd, flp)
return ESPIPE;
}
- if ((error = VOP_GETATTR(vp, &vattr, td->td_proc->p_ucred, td)) != 0) {
+ if ((error = VOP_GETATTR(vp, &vattr, td->td_ucred, td)) != 0) {
fdrop(fp, td);
return error;
}
diff --git a/sys/compat/svr4/svr4_misc.c b/sys/compat/svr4/svr4_misc.c
index 9dcfa7f..40a12c6 100644
--- a/sys/compat/svr4/svr4_misc.c
+++ b/sys/compat/svr4/svr4_misc.c
@@ -275,7 +275,7 @@ svr4_sys_getdents64(td, uap)
return (EINVAL);
}
- if ((error = VOP_GETATTR(vp, &va, td->td_proc->p_ucred, td))) {
+ if ((error = VOP_GETATTR(vp, &va, td->td_ucred, td))) {
fdrop(fp, td);
return error;
}
@@ -616,7 +616,7 @@ svr4_sys_fchroot(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);
VOP_UNLOCK(vp, 0, td);
if (error) {
fdrop(fp, td);
diff --git a/sys/compat/svr4/svr4_sysvec.c b/sys/compat/svr4/svr4_sysvec.c
index 39aa904..5292a8c 100644
--- a/sys/compat/svr4/svr4_sysvec.c
+++ b/sys/compat/svr4/svr4_sysvec.c
@@ -246,7 +246,6 @@ svr4_emul_find(td, sgp, prefix, path, pbuf, cflag)
char **pbuf;
int cflag;
{
- struct proc *p = td->td_proc;
struct nameidata nd;
struct nameidata ndroot;
struct vattr vat;
@@ -331,11 +330,11 @@ svr4_emul_find(td, sgp, prefix, path, pbuf, cflag)
}
NDFREE(&ndroot, NDF_ONLY_PNBUF);
- if ((error = VOP_GETATTR(nd.ni_vp, &vat, p->p_ucred, td)) != 0) {
+ if ((error = VOP_GETATTR(nd.ni_vp, &vat, td->td_ucred, td)) != 0) {
goto done;
}
- if ((error = VOP_GETATTR(ndroot.ni_vp, &vatroot, p->p_ucred, td))
+ if ((error = VOP_GETATTR(ndroot.ni_vp, &vatroot, td->td_ucred, td))
!= 0) {
goto done;
}
diff --git a/sys/dev/ccd/ccd.c b/sys/dev/ccd/ccd.c
index fcf968e..a1d1965 100644
--- a/sys/dev/ccd/ccd.c
+++ b/sys/dev/ccd/ccd.c
@@ -441,7 +441,7 @@ ccdinit(struct ccd_s *cs, char **cpaths, struct thread *td)
* Get partition information for the component.
*/
if ((error = VOP_IOCTL(vp, DIOCGPART, (caddr_t)&dpart,
- FREAD, td->td_proc->p_ucred, td)) != 0) {
+ FREAD, td->td_ucred, td)) != 0) {
#ifdef DEBUG
if (ccddebug & (CCDB_FOLLOW|CCDB_INIT))
printf("ccd%d: %s: ioctl failed, error = %d\n",
@@ -1328,7 +1328,7 @@ ccdioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
if ((error = ccdlookup(cpp[i], td, &vpp[i])) != 0) {
for (j = 0; j < lookedup; ++j)
(void)vn_close(vpp[j], FREAD|FWRITE,
- td->td_proc->p_ucred, td);
+ td->td_ucred, td);
free(vpp, M_DEVBUF);
free(cpp, M_DEVBUF);
ccdunlock(cs);
@@ -1345,7 +1345,7 @@ ccdioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
if ((error = ccdinit(cs, cpp, td)) != 0) {
for (j = 0; j < lookedup; ++j)
(void)vn_close(vpp[j], FREAD|FWRITE,
- td->td_proc->p_ucred, td);
+ td->td_ucred, td);
/*
* We can't ccddestroy() cs just yet, because nothing
* prevents user-level app to do another ioctl()
@@ -1406,7 +1406,7 @@ ccdioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
cs->sc_cinfo[i].ci_vp);
#endif
(void)vn_close(cs->sc_cinfo[i].ci_vp, FREAD|FWRITE,
- td->td_proc->p_ucred, td);
+ td->td_ucred, td);
free(cs->sc_cinfo[i].ci_path, M_DEVBUF);
}
@@ -1637,7 +1637,7 @@ bad:
VOP_UNLOCK(vp, 0, td);
NDFREE(&nd, NDF_ONLY_PNBUF);
/* vn_close does vrele() for vp */
- (void)vn_close(vp, FREAD|FWRITE, td->td_proc->p_ucred, td);
+ (void)vn_close(vp, FREAD|FWRITE, td->td_ucred, td);
return (error);
}
diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c
index 749e7a9..c1ddf8a 100644
--- a/sys/dev/md/md.c
+++ b/sys/dev/md/md.c
@@ -604,7 +604,6 @@ mdsetcred(struct md_s *sc, struct ucred *cred)
static int
mdcreate_vnode(struct md_ioctl *mdio, struct thread *td)
{
- struct proc *p = td->td_proc;
struct md_s *sc;
struct vattr vattr;
struct nameidata nd;
@@ -637,9 +636,9 @@ mdcreate_vnode(struct md_ioctl *mdio, struct thread *td)
}
NDFREE(&nd, NDF_ONLY_PNBUF);
if (nd.ni_vp->v_type != VREG ||
- (error = VOP_GETATTR(nd.ni_vp, &vattr, p->p_ucred, td))) {
+ (error = VOP_GETATTR(nd.ni_vp, &vattr, td->td_ucred, td))) {
VOP_UNLOCK(nd.ni_vp, 0, td);
- (void) vn_close(nd.ni_vp, flags, p->p_ucred, td);
+ (void) vn_close(nd.ni_vp, flags, td->td_ucred, td);
return (error ? error : EINVAL);
}
VOP_UNLOCK(nd.ni_vp, 0, td);
@@ -654,12 +653,12 @@ mdcreate_vnode(struct md_ioctl *mdio, struct thread *td)
else
sc->nsect = vattr.va_size / sc->secsize; /* XXX: round up ? */
if (sc->nsect == 0) {
- (void) vn_close(nd.ni_vp, flags, p->p_ucred, td);
+ (void) vn_close(nd.ni_vp, flags, td->td_ucred, td);
return (EINVAL);
}
- error = mdsetcred(sc, p->p_ucred);
+ error = mdsetcred(sc, td->td_ucred);
if (error) {
- (void) vn_close(nd.ni_vp, flags, p->p_ucred, td);
+ (void) vn_close(nd.ni_vp, flags, td->td_ucred, td);
return (error);
}
mdinit(sc);
@@ -749,7 +748,7 @@ mdcreate_swap(struct md_ioctl *mdio, struct thread *td)
return (EDOM);
}
}
- error = mdsetcred(sc, td->td_proc->p_ucred);
+ error = mdsetcred(sc, td->td_ucred);
if (error)
mddestroy(sc, td);
else
diff --git a/sys/dev/nmdm/nmdm.c b/sys/dev/nmdm/nmdm.c
index 46e7f3c..10d5d70 100644
--- a/sys/dev/nmdm/nmdm.c
+++ b/sys/dev/nmdm/nmdm.c
@@ -211,7 +211,7 @@ nmdmopen(dev_t dev, int flag, int devtype, struct thread *td)
tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
} else if (tp->t_state & TS_XCLUDE && suser_td(td)) {
return (EBUSY);
- } else if (pti->pt_prison != td->td_proc->p_ucred->cr_prison) {
+ } else if (pti->pt_prison != td->td_ucred->cr_prison) {
return (EBUSY);
}
diff --git a/sys/dev/pci/pci_user.c b/sys/dev/pci/pci_user.c
index 6131a43..83b63b3 100644
--- a/sys/dev/pci/pci_user.c
+++ b/sys/dev/pci/pci_user.c
@@ -91,7 +91,7 @@ pci_open(dev_t dev, int oflags, int devtype, struct thread *td)
int error;
if (oflags & FWRITE) {
- error = securelevel_gt(td->td_proc->p_ucred, 0);
+ error = securelevel_gt(td->td_ucred, 0);
if (error)
return (error);
}
diff --git a/sys/dev/random/randomdev.c b/sys/dev/random/randomdev.c
index cd6f873..fe73b0f 100644
--- a/sys/dev/random/randomdev.c
+++ b/sys/dev/random/randomdev.c
@@ -147,7 +147,7 @@ random_open(dev_t dev, int flags, int fmt, struct thread *td)
error = suser(td->td_proc);
if (error)
return (error);
- error = securelevel_gt(td->td_proc->p_ucred, 0);
+ error = securelevel_gt(td->td_ucred, 0);
if (error)
return (error);
}
@@ -159,7 +159,7 @@ random_close(dev_t dev, int flags, int fmt, struct thread *td)
{
if (flags & FWRITE) {
if (!(suser(td->td_proc) ||
- securelevel_gt(td->td_proc->p_ucred, 0)))
+ securelevel_gt(td->td_ucred, 0)))
random_reseed();
}
return 0;
diff --git a/sys/dev/streams/streams.c b/sys/dev/streams/streams.c
index a5c2b4d..1b916a1 100644
--- a/sys/dev/streams/streams.c
+++ b/sys/dev/streams/streams.c
@@ -265,7 +265,7 @@ streamsopen(dev_t dev, int oflags, int devtype, struct thread *td)
return error;
if ((error = socreate(family, &so, type, protocol,
- td->td_proc->p_ucred, td)) != 0) {
+ td->td_ucred, td)) != 0) {
FILEDESC_LOCK(p->p_fd);
p->p_fd->fd_ofiles[fd] = 0;
FILEDESC_UNLOCK(p->p_fd);
diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c
index 0a01b18..1e6a506 100644
--- a/sys/dev/syscons/syscons.c
+++ b/sys/dev/syscons/syscons.c
@@ -978,7 +978,7 @@ scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
error = suser_td(td);
if (error != 0)
return error;
- error = securelevel_gt(td->td_proc->p_ucred, 0);
+ error = securelevel_gt(td->td_ucred, 0);
if (error != 0)
return error;
#ifdef __i386__
diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c
index 5d7ff1b..1e3719d 100644
--- a/sys/fs/cd9660/cd9660_vfsops.c
+++ b/sys/fs/cd9660/cd9660_vfsops.c
@@ -236,7 +236,7 @@ cd9660_mount(mp, path, data, ndp, td)
*/
accessmode = VREAD;
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
- error = VOP_ACCESS(devvp, accessmode, td->td_proc->p_ucred, td);
+ error = VOP_ACCESS(devvp, accessmode, td->td_ucred, td);
if (error)
error = suser_td(td);
if (error) {
@@ -305,7 +305,7 @@ iso_mountfs(devvp, mp, td, argp)
return error;
if (vcount(devvp) > 1 && devvp != rootvp)
return EBUSY;
- if ((error = vinvalbuf(devvp, V_SAVE, td->td_proc->p_ucred, td, 0, 0)))
+ if ((error = vinvalbuf(devvp, V_SAVE, td->td_ucred, td, 0, 0)))
return (error);
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
diff --git a/sys/fs/coda/coda_vfsops.c b/sys/fs/coda/coda_vfsops.c
index 275b036..5d5a810 100644
--- a/sys/fs/coda/coda_vfsops.c
+++ b/sys/fs/coda/coda_vfsops.c
@@ -317,7 +317,7 @@ coda_root(vfsp, vpp)
}
}
- error = venus_root(vftomi(vfsp), p->p_ucred, p, &VFid);
+ error = venus_root(vftomi(vfsp), td->td_ucred, p, &VFid);
if (!error) {
/*
@@ -457,7 +457,7 @@ coda_fhtovp(vfsp, fhp, nam, vpp, exflagsp, creadanonp)
return(0);
}
- error = venus_fhtovp(vftomi(vfsp), &cfid->cfid_fid, p->p_ucred, p, &VFid, &vtype);
+ error = venus_fhtovp(vftomi(vfsp), &cfid->cfid_fid, td->td_ucred, p, &VFid, &vtype);
if (error) {
CODADEBUG(CODA_VGET, myprintf(("vget error %d\n",error));)
diff --git a/sys/fs/fifofs/fifo_vnops.c b/sys/fs/fifofs/fifo_vnops.c
index 3699f96..8153670 100644
--- a/sys/fs/fifofs/fifo_vnops.c
+++ b/sys/fs/fifofs/fifo_vnops.c
@@ -176,7 +176,7 @@ fifo_open(ap)
MALLOC(fip, struct fifoinfo *, sizeof(*fip), M_VNODE, M_WAITOK);
vp->v_fifoinfo = fip;
error = socreate(AF_LOCAL, &rso, SOCK_STREAM, 0,
- ap->a_td->td_proc->p_ucred, ap->a_td);
+ ap->a_td->td_ucred, ap->a_td);
if (error) {
free(fip, M_VNODE);
vp->v_fifoinfo = NULL;
@@ -184,7 +184,7 @@ fifo_open(ap)
}
fip->fi_readsock = rso;
error = socreate(AF_LOCAL, &wso, SOCK_STREAM, 0,
- ap->a_td->td_proc->p_ucred, ap->a_td);
+ ap->a_td->td_ucred, ap->a_td);
if (error) {
(void)soclose(rso);
free(fip, M_VNODE);
diff --git a/sys/fs/hpfs/hpfs_vfsops.c b/sys/fs/hpfs/hpfs_vfsops.c
index c3226e6..dcb5995 100644
--- a/sys/fs/hpfs/hpfs_vfsops.c
+++ b/sys/fs/hpfs/hpfs_vfsops.c
@@ -239,7 +239,7 @@ hpfs_mountfs(devvp, mp, argsp, td)
return (EBUSY);
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
- error = vinvalbuf(devvp, V_SAVE, td->td_proc->p_ucred, td, 0, 0);
+ error = vinvalbuf(devvp, V_SAVE, td->td_ucred, td, 0, 0);
VOP_UNLOCK(devvp, 0, td);
if (error)
return (error);
diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c
index de7668d..622d7d0 100644
--- a/sys/fs/msdosfs/msdosfs_vfsops.c
+++ b/sys/fs/msdosfs/msdosfs_vfsops.c
@@ -199,7 +199,7 @@ msdosfs_mount(mp, path, data, ndp, td)
devvp = pmp->pm_devvp;
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
error = VOP_ACCESS(devvp, VREAD | VWRITE,
- td->td_proc->p_ucred, td);
+ td->td_ucred, td);
if (error) {
VOP_UNLOCK(devvp, 0, td);
return (error);
@@ -247,7 +247,7 @@ msdosfs_mount(mp, path, data, ndp, td)
if ((mp->mnt_flag & MNT_RDONLY) == 0)
accessmode |= VWRITE;
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
- error = VOP_ACCESS(devvp, accessmode, td->td_proc->p_ucred, td);
+ error = VOP_ACCESS(devvp, accessmode, td->td_ucred, td);
if (error) {
vput(devvp);
return (error);
@@ -315,7 +315,7 @@ mountmsdosfs(devvp, mp, td, argp)
if (vcount(devvp) > 1 && devvp != rootvp)
return (EBUSY);
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
- error = vinvalbuf(devvp, V_SAVE, td->td_proc->p_ucred, td, 0, 0);
+ error = vinvalbuf(devvp, V_SAVE, td->td_ucred, td, 0, 0);
VOP_UNLOCK(devvp, 0, td);
if (error)
return (error);
diff --git a/sys/fs/ntfs/ntfs_vfsops.c b/sys/fs/ntfs/ntfs_vfsops.c
index 2a58601..712d4d3 100644
--- a/sys/fs/ntfs/ntfs_vfsops.c
+++ b/sys/fs/ntfs/ntfs_vfsops.c
@@ -294,7 +294,7 @@ ntfs_mountfs(devvp, mp, argsp, td)
if (ncount > 1 && devvp != rootvp)
return (EBUSY);
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
- error = vinvalbuf(devvp, V_SAVE, td->td_proc->p_ucred, td, 0, 0);
+ error = vinvalbuf(devvp, V_SAVE, td->td_ucred, td, 0, 0);
VOP_UNLOCK(devvp, 0, td);
if (error)
return (error);
diff --git a/sys/fs/nwfs/nwfs_io.c b/sys/fs/nwfs/nwfs_io.c
index e3772f0..ff33fc3 100644
--- a/sys/fs/nwfs/nwfs_io.c
+++ b/sys/fs/nwfs/nwfs_io.c
@@ -407,8 +407,8 @@ nwfs_getpages(ap)
vm_page_t *pages;
vp = ap->a_vp;
- td = curthread; /* XXX */
- cred = curproc->p_ucred; /* XXX */
+ td = curthread; /* XXX */
+ cred = td->td_ucred; /* XXX */
np = VTONW(vp);
nmp = VFSTONWFS(vp->v_mount);
pages = ap->a_m;
@@ -517,7 +517,7 @@ nwfs_putpages(ap)
#ifndef NWFS_RWCACHE
td = curthread; /* XXX */
- cred = td->td_proc->p_ucred; /* XXX */
+ cred = td->td_ucred; /* XXX */
VOP_OPEN(vp, FWRITE, cred, td);
error = vop_stdputpages(ap);
VOP_CLOSE(vp, FWRITE, cred, td);
@@ -534,7 +534,7 @@ nwfs_putpages(ap)
vm_page_t *pages;
td = curthread; /* XXX */
- cred = td->td_proc->p_ucred; /* XXX */
+ cred = td->td_ucred; /* XXX */
/* VOP_OPEN(vp, FWRITE, cred, td);*/
np = VTONW(vp);
nmp = VFSTONWFS(vp->v_mount);
diff --git a/sys/fs/nwfs/nwfs_node.c b/sys/fs/nwfs/nwfs_node.c
index d6f8788..d8693fa 100644
--- a/sys/fs/nwfs/nwfs_node.c
+++ b/sys/fs/nwfs/nwfs_node.c
@@ -287,7 +287,7 @@ nwfs_inactive(ap)
} */ *ap;
{
struct thread *td = ap->a_td;
- struct ucred *cred = td->td_proc->p_ucred;
+ struct ucred *cred = td->td_ucred;
struct vnode *vp = ap->a_vp;
struct nwnode *np = VTONW(vp);
int error;
diff --git a/sys/fs/nwfs/nwfs_vfsops.c b/sys/fs/nwfs/nwfs_vfsops.c
index 119a163..490f861 100644
--- a/sys/fs/nwfs/nwfs_vfsops.c
+++ b/sys/fs/nwfs/nwfs_vfsops.c
@@ -169,7 +169,7 @@ static int nwfs_mount(struct mount *mp, char *path, caddr_t data,
nwfs_printf("mount version mismatch: kernel=%d, mount=%d\n",NWFS_VERSION,args.version);
return (1);
}
- error = ncp_conn_getbyref(args.connRef, td , td->td_proc->p_ucred,NCPM_EXECUTE,&conn);
+ error = ncp_conn_getbyref(args.connRef, td , td->td_ucred,NCPM_EXECUTE,&conn);
if (error) {
nwfs_printf("invalid connection refernce %d\n",args.connRef);
return (error);
@@ -249,7 +249,7 @@ nwfs_unmount(struct mount *mp, int mntflags, struct thread *td)
return (error);
conn = NWFSTOCONN(nmp);
ncp_conn_puthandle(nmp->connh,NULL,0);
- if (ncp_conn_lock(conn, td, td->td_proc->p_ucred,NCPM_WRITE | NCPM_EXECUTE) == 0) {
+ if (ncp_conn_lock(conn, td, td->td_ucred,NCPM_WRITE | NCPM_EXECUTE) == 0) {
if(ncp_conn_free(conn))
ncp_conn_unlock(conn, td);
}
@@ -270,7 +270,7 @@ nwfs_root(struct mount *mp, struct vnode **vpp) {
struct ncp_conn *conn;
struct nw_entry_info fattr;
struct thread *td = curthread;
- struct ucred *cred = td->td_proc->p_ucred;
+ struct ucred *cred = td->td_ucred;
int error, nsf, opt;
u_char vol;
@@ -431,7 +431,7 @@ nwfs_statfs(mp, sbp, td)
if (np == NULL) return EINVAL;
error = ncp_get_volume_info_with_number(NWFSTOCONN(nmp),
- nmp->n_volume, &vi, td, td->td_proc->p_ucred);
+ nmp->n_volume, &vi, td, td->td_ucred);
if (error) return error;
secsize = 512; /* XXX how to get real value ??? */
sbp->f_spare2=0; /* placeholder */
diff --git a/sys/fs/portalfs/portal_vnops.c b/sys/fs/portalfs/portal_vnops.c
index a7d9832..934cf97 100644
--- a/sys/fs/portalfs/portal_vnops.c
+++ b/sys/fs/portalfs/portal_vnops.c
@@ -246,8 +246,8 @@ portal_open(ap)
/*
* Create a new socket.
*/
- error = socreate(AF_UNIX, &so, SOCK_STREAM, 0,
- ap->a_td->td_proc->p_ucred, ap->a_td);
+ error = socreate(AF_UNIX, &so, SOCK_STREAM, 0, ap->a_td->td_ucred,
+ ap->a_td);
if (error)
goto bad;
diff --git a/sys/fs/smbfs/smbfs_io.c b/sys/fs/smbfs/smbfs_io.c
index c7d337e..62290be 100644
--- a/sys/fs/smbfs/smbfs_io.c
+++ b/sys/fs/smbfs/smbfs_io.c
@@ -429,7 +429,7 @@ smbfs_getpages(ap)
vp = ap->a_vp;
td = curthread; /* XXX */
- cred = td->td_proc->p_ucred; /* XXX */
+ cred = td->td_ucred; /* XXX */
np = VTOSMB(vp);
smp = VFSTOSMBFS(vp->v_mount);
pages = ap->a_m;
@@ -549,7 +549,7 @@ smbfs_putpages(ap)
#ifdef SMBFS_RWGENERIC
td = curthread; /* XXX */
- cred = td->td_proc->p_ucred; /* XXX */
+ cred = td->td_ucred; /* XXX */
VOP_OPEN(vp, FWRITE, cred, td);
error = vop_stdputpages(ap);
VOP_CLOSE(vp, FWRITE, cred, td);
@@ -567,7 +567,7 @@ smbfs_putpages(ap)
vm_page_t *pages;
td = curthread; /* XXX */
- cred = td->td_proc->p_ucred; /* XXX */
+ cred = td->td_ucred; /* XXX */
/* VOP_OPEN(vp, FWRITE, cred, td);*/
np = VTOSMB(vp);
smp = VFSTOSMBFS(vp->v_mount);
diff --git a/sys/fs/smbfs/smbfs_node.c b/sys/fs/smbfs/smbfs_node.c
index f170b1d..8dabd00 100644
--- a/sys/fs/smbfs/smbfs_node.c
+++ b/sys/fs/smbfs/smbfs_node.c
@@ -337,7 +337,7 @@ smbfs_inactive(ap)
} */ *ap;
{
struct thread *td = ap->a_td;
- struct ucred *cred = td->td_proc->p_ucred;
+ struct ucred *cred = td->td_ucred;
struct vnode *vp = ap->a_vp;
struct smbnode *np = VTOSMB(vp);
struct smb_cred scred;
diff --git a/sys/fs/smbfs/smbfs_vfsops.c b/sys/fs/smbfs/smbfs_vfsops.c
index eff50e3..b3b5cd3 100644
--- a/sys/fs/smbfs/smbfs_vfsops.c
+++ b/sys/fs/smbfs/smbfs_vfsops.c
@@ -166,7 +166,7 @@ smbfs_mount(struct mount *mp, char *path, caddr_t data,
SMBFS_VERSION, args.version);
return EINVAL;
}
- smb_makescred(&scred, td, td->td_proc->p_ucred);
+ smb_makescred(&scred, td, td->td_ucred);
error = smb_dev2share(args.dev, SMBM_EXEC, &scred, &ssp);
if (error) {
printf("invalid device handle %d (%d)\n", args.dev, error);
@@ -267,7 +267,7 @@ smbfs_unmount(struct mount *mp, int mntflags, struct thread *td)
error = vflush(mp, 1, flags);
if (error)
return error;
- smb_makescred(&scred, td, td->td_proc->p_ucred);
+ smb_makescred(&scred, td, td->td_ucred);
smb_share_put(smp->sm_share, &scred);
mp->mnt_data = (qaddr_t)0;
@@ -294,7 +294,7 @@ smbfs_root(struct mount *mp, struct vnode **vpp)
struct smbnode *np;
struct smbfattr fattr;
struct thread *td = curthread;
- struct ucred *cred = td->td_proc->p_ucred;
+ struct ucred *cred = td->td_ucred;
struct smb_cred scred;
int error;
@@ -399,7 +399,7 @@ smbfs_statfs(struct mount *mp, struct statfs *sbp, struct thread *td)
sbp->f_iosize = SSTOVC(ssp)->vc_txmax; /* optimal transfer block size */
sbp->f_spare2 = 0; /* placeholder */
- smb_makescred(&scred, td, td->td_proc->p_ucred);
+ smb_makescred(&scred, td, td->td_ucred);
if (SMB_DIALECT(SSTOVC(ssp)) >= SMB_DIALECT_LANMAN2_0)
error = smbfs_smb_statfs2(ssp, sbp, &scred);
diff --git a/sys/fs/smbfs/smbfs_vnops.c b/sys/fs/smbfs/smbfs_vnops.c
index 392468e..d01dc42 100644
--- a/sys/fs/smbfs/smbfs_vnops.c
+++ b/sys/fs/smbfs/smbfs_vnops.c
@@ -976,7 +976,6 @@ smbfs_advlock(ap)
caddr_t id = (caddr_t)1 /* ap->a_id */;
/* int flags = ap->a_flags;*/
struct thread *td = curthread;
- struct proc *p = td ? td->td_proc : NULL;
struct smb_cred scred;
u_quad_t size;
off_t start, end, oadd;
@@ -1027,7 +1026,7 @@ smbfs_advlock(ap)
return EOVERFLOW;
end = start + oadd;
}
- smb_makescred(&scred, td, p ? p->p_ucred : NULL);
+ smb_makescred(&scred, td, td->td_ucred);
switch (ap->a_op) {
case F_SETLK:
switch (fl->l_type) {
diff --git a/sys/fs/specfs/spec_vnops.c b/sys/fs/specfs/spec_vnops.c
index 7887ddb..6c4fcd9 100644
--- a/sys/fs/specfs/spec_vnops.c
+++ b/sys/fs/specfs/spec_vnops.c
@@ -177,7 +177,7 @@ spec_open(ap)
* When running in secure mode, do not allow opens
* for writing if the disk is mounted.
*/
- error = securelevel_ge(td->td_proc->p_ucred, 1);
+ error = securelevel_ge(td->td_ucred, 1);
if (error && vfs_mountedon(vp))
return (error);
@@ -185,7 +185,7 @@ spec_open(ap)
* When running in very secure mode, do not allow
* opens for writing of any disks.
*/
- error = securelevel_ge(td->td_proc->p_ucred, 2);
+ error = securelevel_ge(td->td_ucred, 2);
if (error)
return (error);
}
@@ -729,8 +729,8 @@ spec_getpages(ap)
/* B_PHYS is not set, but it is nice to fill this in. */
KASSERT(bp->b_rcred == NOCRED, ("leaking read ucred"));
KASSERT(bp->b_wcred == NOCRED, ("leaking write ucred"));
- bp->b_rcred = crhold(curthread->td_proc->p_ucred);
- bp->b_wcred = crhold(curthread->td_proc->p_ucred);
+ bp->b_rcred = crhold(curthread->td_ucred);
+ bp->b_wcred = crhold(curthread->td_ucred);
bp->b_blkno = blkno;
bp->b_lblkno = blkno;
pbgetvp(ap->a_vp, bp);
diff --git a/sys/fs/unionfs/union_subr.c b/sys/fs/unionfs/union_subr.c
index 70a9f52..fde7df5 100644
--- a/sys/fs/unionfs/union_subr.c
+++ b/sys/fs/unionfs/union_subr.c
@@ -1011,7 +1011,7 @@ union_mkwhiteout(um, dvp, cnp, path)
}
/* VOP_LEASE: dvp is locked */
- VOP_LEASE(dvp, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(dvp, td, td->td_ucred, LEASE_WRITE);
error = VOP_WHITEOUT(dvp, &cn, CREATE);
if (cn.cn_flags & HASBUF) {
@@ -1043,7 +1043,7 @@ union_vn_create(vpp, un, td)
struct thread *td;
{
struct vnode *vp;
- struct ucred *cred = td->td_proc->p_ucred;
+ struct ucred *cred = td->td_ucred;
struct vattr vat;
struct vattr *vap = &vat;
int fmode = FFLAGS(O_WRONLY|O_CREAT|O_TRUNC|O_EXCL);
@@ -1071,7 +1071,7 @@ union_vn_create(vpp, un, td)
cn.cn_nameiop = CREATE;
cn.cn_flags = (LOCKPARENT|LOCKLEAF|HASBUF|SAVENAME|ISLASTCN);
cn.cn_thread = td;
- cn.cn_cred = td->td_proc->p_ucred;
+ cn.cn_cred = td->td_ucred;
cn.cn_nameptr = cn.cn_pnbuf;
cn.cn_consume = 0;
diff --git a/sys/fs/unionfs/union_vfsops.c b/sys/fs/unionfs/union_vfsops.c
index 92f46d5..58f283b 100644
--- a/sys/fs/unionfs/union_vfsops.c
+++ b/sys/fs/unionfs/union_vfsops.c
@@ -223,7 +223,7 @@ union_mount(mp, path, data, ndp, td)
goto bad;
}
- um->um_cred = crhold(td->td_proc->p_ucred);
+ um->um_cred = crhold(td->td_ucred);
FILEDESC_LOCK(td->td_proc->p_fd);
um->um_cmode = UN_DIRMODE &~ td->td_proc->p_fd->fd_cmask;
FILEDESC_UNLOCK(td->td_proc->p_fd);
diff --git a/sys/geom/geom_ccd.c b/sys/geom/geom_ccd.c
index fcf968e..a1d1965 100644
--- a/sys/geom/geom_ccd.c
+++ b/sys/geom/geom_ccd.c
@@ -441,7 +441,7 @@ ccdinit(struct ccd_s *cs, char **cpaths, struct thread *td)
* Get partition information for the component.
*/
if ((error = VOP_IOCTL(vp, DIOCGPART, (caddr_t)&dpart,
- FREAD, td->td_proc->p_ucred, td)) != 0) {
+ FREAD, td->td_ucred, td)) != 0) {
#ifdef DEBUG
if (ccddebug & (CCDB_FOLLOW|CCDB_INIT))
printf("ccd%d: %s: ioctl failed, error = %d\n",
@@ -1328,7 +1328,7 @@ ccdioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
if ((error = ccdlookup(cpp[i], td, &vpp[i])) != 0) {
for (j = 0; j < lookedup; ++j)
(void)vn_close(vpp[j], FREAD|FWRITE,
- td->td_proc->p_ucred, td);
+ td->td_ucred, td);
free(vpp, M_DEVBUF);
free(cpp, M_DEVBUF);
ccdunlock(cs);
@@ -1345,7 +1345,7 @@ ccdioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
if ((error = ccdinit(cs, cpp, td)) != 0) {
for (j = 0; j < lookedup; ++j)
(void)vn_close(vpp[j], FREAD|FWRITE,
- td->td_proc->p_ucred, td);
+ td->td_ucred, td);
/*
* We can't ccddestroy() cs just yet, because nothing
* prevents user-level app to do another ioctl()
@@ -1406,7 +1406,7 @@ ccdioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
cs->sc_cinfo[i].ci_vp);
#endif
(void)vn_close(cs->sc_cinfo[i].ci_vp, FREAD|FWRITE,
- td->td_proc->p_ucred, td);
+ td->td_ucred, td);
free(cs->sc_cinfo[i].ci_path, M_DEVBUF);
}
@@ -1637,7 +1637,7 @@ bad:
VOP_UNLOCK(vp, 0, td);
NDFREE(&nd, NDF_ONLY_PNBUF);
/* vn_close does vrele() for vp */
- (void)vn_close(vp, FREAD|FWRITE, td->td_proc->p_ucred, td);
+ (void)vn_close(vp, FREAD|FWRITE, td->td_ucred, td);
return (error);
}
diff --git a/sys/gnu/ext2fs/ext2_vfsops.c b/sys/gnu/ext2fs/ext2_vfsops.c
index b20d205..e08b2f2 100644
--- a/sys/gnu/ext2fs/ext2_vfsops.c
+++ b/sys/gnu/ext2fs/ext2_vfsops.c
@@ -238,7 +238,7 @@ ext2_mount(mp, path, data, ndp, td)
if (suser_td(td)) {
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
if ((error = VOP_ACCESS(devvp, VREAD | VWRITE,
- td->td_proc->p_ucred, td)) != 0) {
+ td->td_ucred, td)) != 0) {
VOP_UNLOCK(devvp, 0, td);
return (error);
}
@@ -293,7 +293,7 @@ ext2_mount(mp, path, data, ndp, td)
if ((mp->mnt_flag & MNT_RDONLY) == 0)
accessmode |= VWRITE;
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
- if ((error = VOP_ACCESS(devvp, accessmode, td->td_proc->p_ucred, td)) != 0) {
+ if ((error = VOP_ACCESS(devvp, accessmode, td->td_ucred, td)) != 0) {
vput(devvp);
return (error);
}
@@ -642,7 +642,7 @@ ext2_mountfs(devvp, mp, td)
return (error);
if (vcount(devvp) > 1 && devvp != rootvp)
return (EBUSY);
- if ((error = vinvalbuf(devvp, V_SAVE, td->td_proc->p_ucred, td, 0, 0)) != 0)
+ if ((error = vinvalbuf(devvp, V_SAVE, td->td_ucred, td, 0, 0)) != 0)
return (error);
#ifdef READONLY
/* turn on this to force it to be read-only */
diff --git a/sys/gnu/fs/ext2fs/ext2_vfsops.c b/sys/gnu/fs/ext2fs/ext2_vfsops.c
index b20d205..e08b2f2 100644
--- a/sys/gnu/fs/ext2fs/ext2_vfsops.c
+++ b/sys/gnu/fs/ext2fs/ext2_vfsops.c
@@ -238,7 +238,7 @@ ext2_mount(mp, path, data, ndp, td)
if (suser_td(td)) {
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
if ((error = VOP_ACCESS(devvp, VREAD | VWRITE,
- td->td_proc->p_ucred, td)) != 0) {
+ td->td_ucred, td)) != 0) {
VOP_UNLOCK(devvp, 0, td);
return (error);
}
@@ -293,7 +293,7 @@ ext2_mount(mp, path, data, ndp, td)
if ((mp->mnt_flag & MNT_RDONLY) == 0)
accessmode |= VWRITE;
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
- if ((error = VOP_ACCESS(devvp, accessmode, td->td_proc->p_ucred, td)) != 0) {
+ if ((error = VOP_ACCESS(devvp, accessmode, td->td_ucred, td)) != 0) {
vput(devvp);
return (error);
}
@@ -642,7 +642,7 @@ ext2_mountfs(devvp, mp, td)
return (error);
if (vcount(devvp) > 1 && devvp != rootvp)
return (EBUSY);
- if ((error = vinvalbuf(devvp, V_SAVE, td->td_proc->p_ucred, td, 0, 0)) != 0)
+ if ((error = vinvalbuf(devvp, V_SAVE, td->td_ucred, td, 0, 0)) != 0)
return (error);
#ifdef READONLY
/* turn on this to force it to be read-only */
diff --git a/sys/i386/i386/mem.c b/sys/i386/i386/mem.c
index c8fdd2a..94851fd 100644
--- a/sys/i386/i386/mem.c
+++ b/sys/i386/i386/mem.c
@@ -116,7 +116,7 @@ mmopen(dev_t dev, int flags, int fmt, struct thread *td)
case 0:
case 1:
if (flags & FWRITE) {
- error = securelevel_gt(td->td_proc->p_ucred, 0);
+ error = securelevel_gt(td->td_ucred, 0);
if (error != 0)
return (error);
}
@@ -125,7 +125,7 @@ mmopen(dev_t dev, int flags, int fmt, struct thread *td)
error = suser_td(td);
if (error != 0)
return (error);
- error = securelevel_gt(td->td_proc->p_ucred, 0);
+ error = securelevel_gt(td->td_ucred, 0);
if (error != 0)
return (error);
td->td_frame->tf_eflags |= PSL_IOPL;
diff --git a/sys/i386/i386/sys_machdep.c b/sys/i386/i386/sys_machdep.c
index b7beea9..58e1a22 100644
--- a/sys/i386/i386/sys_machdep.c
+++ b/sys/i386/i386/sys_machdep.c
@@ -185,7 +185,7 @@ i386_set_ioperm(td, args)
if ((error = suser_td(td)) != 0)
return (error);
- if ((error = securelevel_gt(td->td_proc->p_ucred, 0)) != 0)
+ if ((error = securelevel_gt(td->td_ucred, 0)) != 0)
return (error);
/*
* XXX
diff --git a/sys/i386/ibcs2/ibcs2_util.c b/sys/i386/ibcs2/ibcs2_util.c
index 8b0720a..2172433 100644
--- a/sys/i386/ibcs2/ibcs2_util.c
+++ b/sys/i386/ibcs2/ibcs2_util.c
@@ -140,11 +140,11 @@ ibcs2_emul_find(td, sgp, prefix, path, pbuf, cflag)
return error;
}
- if ((error = VOP_GETATTR(nd.ni_vp, &vat, td->td_proc->p_ucred, td)) != 0) {
+ if ((error = VOP_GETATTR(nd.ni_vp, &vat, td->td_ucred, td)) != 0) {
goto done;
}
- if ((error = VOP_GETATTR(ndroot.ni_vp, &vatroot, td->td_proc->p_ucred, td))
+ if ((error = VOP_GETATTR(ndroot.ni_vp, &vatroot, td->td_ucred, td))
!= 0) {
goto done;
}
diff --git a/sys/i386/ibcs2/ibcs2_xenix.c b/sys/i386/ibcs2/ibcs2_xenix.c
index 0e40c45..1e06a4b 100644
--- a/sys/i386/ibcs2/ibcs2_xenix.c
+++ b/sys/i386/ibcs2/ibcs2_xenix.c
@@ -194,7 +194,7 @@ xenix_scoinfo(struct thread *td, struct xenix_scoinfo_args *uap)
int
xenix_eaccess(struct thread *td, struct xenix_eaccess_args *uap)
{
- struct ucred *cred = td->td_proc->p_ucred;
+ struct ucred *cred = td->td_ucred;
struct vnode *vp;
struct nameidata nd;
int error, flags;
diff --git a/sys/i386/ibcs2/imgact_coff.c b/sys/i386/ibcs2/imgact_coff.c
index 6d5621f..fd89db4 100644
--- a/sys/i386/ibcs2/imgact_coff.c
+++ b/sys/i386/ibcs2/imgact_coff.c
@@ -183,7 +183,7 @@ coff_load_file(struct thread *td, char *name)
goto fail;
}
- if ((error = VOP_GETATTR(vp, &attr, p->p_ucred, td)) != 0)
+ if ((error = VOP_GETATTR(vp, &attr, td->td_ucred, td)) != 0)
goto fail;
if ((vp->v_mount->mnt_flag & MNT_NOEXEC)
@@ -196,10 +196,10 @@ coff_load_file(struct thread *td, char *name)
goto fail;
}
- if ((error = VOP_ACCESS(vp, VEXEC, p->p_ucred, td)) != 0)
+ if ((error = VOP_ACCESS(vp, VEXEC, td->td_ucred, td)) != 0)
goto fail;
- if ((error = VOP_OPEN(vp, FREAD, p->p_ucred, td)) != 0)
+ if ((error = VOP_OPEN(vp, FREAD, td->td_ucred, td)) != 0)
goto fail;
/*
diff --git a/sys/i386/isa/pcvt/pcvt_ext.c b/sys/i386/isa/pcvt/pcvt_ext.c
index 9e3cc44..8e72849 100644
--- a/sys/i386/isa/pcvt/pcvt_ext.c
+++ b/sys/i386/isa/pcvt/pcvt_ext.c
@@ -2619,7 +2619,7 @@ usl_vt_ioctl(dev_t dev, int cmd, caddr_t data, int flag, struct thread *td)
error = suser_td(td);
if (error != 0)
return (error);
- error = securelevel_gt(p->p_ucred, 0);
+ error = securelevel_gt(td->td_ucred, 0);
if (error != 0)
return (error);
diff --git a/sys/i386/isa/spigot.c b/sys/i386/isa/spigot.c
index 23cbd3c..cc51b18 100644
--- a/sys/i386/isa/spigot.c
+++ b/sys/i386/isa/spigot.c
@@ -178,7 +178,7 @@ struct spigot_softc *ss = (struct spigot_softc *)&spigot_softc[UNIT(dev)];
error = suser_td(td);
if (error != 0)
return error;
- error = securelevel_gt(td->td_proc->p_ucred, 0);
+ error = securelevel_gt(td->td_ucred, 0);
if (error != 0)
return error;
#endif
@@ -235,7 +235,7 @@ struct spigot_info *info;
error = suser_td(td);
if (error != 0)
return error;
- error = securelevel_gt(td->td_proc->p_ucred, 0);
+ error = securelevel_gt(td->td_ucred, 0);
if (error)
return error;
#endif
diff --git a/sys/i386/linux/linux_machdep.c b/sys/i386/linux/linux_machdep.c
index 9954026..33a4ee2 100644
--- a/sys/i386/linux/linux_machdep.c
+++ b/sys/i386/linux/linux_machdep.c
@@ -561,7 +561,7 @@ linux_iopl(struct thread *td, struct linux_iopl_args *args)
return (EINVAL);
if ((error = suser_td(td)) != 0)
return (error);
- if ((error = securelevel_gt(td->td_proc->p_ucred, 0)) != 0)
+ if ((error = securelevel_gt(td->td_ucred, 0)) != 0)
return (error);
td->td_frame->tf_eflags = (td->td_frame->tf_eflags & ~PSL_IOPL) |
(args->level * (PSL_IOPL / 3));
diff --git a/sys/ia64/ia64/mem.c b/sys/ia64/ia64/mem.c
index d6503f6..4ab2292 100644
--- a/sys/ia64/ia64/mem.c
+++ b/sys/ia64/ia64/mem.c
@@ -121,7 +121,7 @@ mmopen(dev_t dev, int flags, int fmt, struct thread *td)
case 0:
case 1:
if (flags & FWRITE) {
- error = securelevel_gt(td->td_proc->p_ucred, 0);
+ error = securelevel_gt(td->td_ucred, 0);
if (error)
return error;
}
diff --git a/sys/isofs/cd9660/cd9660_vfsops.c b/sys/isofs/cd9660/cd9660_vfsops.c
index 5d7ff1b..1e3719d 100644
--- a/sys/isofs/cd9660/cd9660_vfsops.c
+++ b/sys/isofs/cd9660/cd9660_vfsops.c
@@ -236,7 +236,7 @@ cd9660_mount(mp, path, data, ndp, td)
*/
accessmode = VREAD;
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
- error = VOP_ACCESS(devvp, accessmode, td->td_proc->p_ucred, td);
+ error = VOP_ACCESS(devvp, accessmode, td->td_ucred, td);
if (error)
error = suser_td(td);
if (error) {
@@ -305,7 +305,7 @@ iso_mountfs(devvp, mp, td, argp)
return error;
if (vcount(devvp) > 1 && devvp != rootvp)
return EBUSY;
- if ((error = vinvalbuf(devvp, V_SAVE, td->td_proc->p_ucred, td, 0, 0)))
+ if ((error = vinvalbuf(devvp, V_SAVE, td->td_ucred, td, 0, 0)))
return (error);
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
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;
}
diff --git a/sys/net/if.c b/sys/net/if.c
index 3cb7994..98dd728 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1532,8 +1532,8 @@ ifconf(cmd, data)
if (space < sizeof(ifr))
break;
- if (jailed(curproc->p_ucred) &&
- prison_if(curproc->p_ucred, sa))
+ if (jailed(curthread->td_ucred) &&
+ prison_if(curthread->td_ucred, sa))
continue;
addrs++;
#ifdef COMPAT_43
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
index 2a08540..1bdc439 100644
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -968,8 +968,8 @@ sysctl_iflist(af, w)
while ((ifa = TAILQ_NEXT(ifa, ifa_link)) != 0) {
if (af && af != ifa->ifa_addr->sa_family)
continue;
- if (jailed(curproc->p_ucred) &&
- prison_if(curproc->p_ucred, ifa->ifa_addr))
+ if (jailed(curthread->td_ucred) &&
+ prison_if(curthread->td_ucred, ifa->ifa_addr))
continue;
ifaaddr = ifa->ifa_addr;
netmask = ifa->ifa_netmask;
diff --git a/sys/netgraph/ng_ksocket.c b/sys/netgraph/ng_ksocket.c
index abc36f7..ba60213 100644
--- a/sys/netgraph/ng_ksocket.c
+++ b/sys/netgraph/ng_ksocket.c
@@ -588,7 +588,7 @@ ng_ksocket_newhook(node_p node, hook_p hook, const char *name0)
/* Create the socket */
error = socreate(family, &priv->so, type, protocol,
- td->td_proc->p_ucred, td);
+ td->td_ucred, td);
if (error != 0)
return (error);
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index 59aec2e..7d5a745 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -206,7 +206,7 @@ in_pcbbind(inp, nam, td)
return (EAFNOSUPPORT);
#endif
if (sin->sin_addr.s_addr != INADDR_ANY)
- if (prison_ip(p->p_ucred, 0, &sin->sin_addr.s_addr))
+ if (prison_ip(td->td_ucred, 0, &sin->sin_addr.s_addr))
return(EINVAL);
lport = sin->sin_port;
if (IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) {
@@ -231,7 +231,7 @@ in_pcbbind(inp, nam, td)
if (ntohs(lport) < IPPORT_RESERVED && p &&
suser_xxx(0, p, PRISON_ROOT))
return (EACCES);
- if (p && jailed(p->p_ucred))
+ if (td && jailed(td->td_ucred))
prison = 1;
if (so->so_cred->cr_uid != 0 &&
!IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) {
@@ -257,7 +257,7 @@ in_pcbbind(inp, nam, td)
}
}
if (prison &&
- prison_ip(p->p_ucred, 0, &sin->sin_addr.s_addr))
+ prison_ip(td->td_ucred, 0, &sin->sin_addr.s_addr))
return (EADDRNOTAVAIL);
t = in_pcblookup_local(pcbinfo, sin->sin_addr,
lport, prison ? 0 : wild);
@@ -281,7 +281,7 @@ in_pcbbind(inp, nam, td)
int count;
if (inp->inp_laddr.s_addr != INADDR_ANY)
- if (prison_ip(p->p_ucred, 0, &inp->inp_laddr.s_addr )) {
+ if (prison_ip(td->td_ucred, 0, &inp->inp_laddr.s_addr )) {
inp->inp_laddr.s_addr = INADDR_ANY;
return (EINVAL);
}
@@ -352,7 +352,7 @@ in_pcbbind(inp, nam, td)
}
}
inp->inp_lport = lport;
- if (prison_ip(p->p_ucred, 0, &inp->inp_laddr.s_addr)) {
+ if (prison_ip(td->td_ucred, 0, &inp->inp_laddr.s_addr)) {
inp->inp_laddr.s_addr = INADDR_ANY;
inp->inp_lport = 0;
return (EINVAL);
diff --git a/sys/netinet/ip_dummynet.c b/sys/netinet/ip_dummynet.c
index bb3c409..5da5ea8 100644
--- a/sys/netinet/ip_dummynet.c
+++ b/sys/netinet/ip_dummynet.c
@@ -1830,7 +1830,7 @@ ip_dn_ctl(struct sockopt *sopt)
/* Disallow sets in really-really secure mode. */
if (sopt->sopt_dir == SOPT_SET) {
- error = securelevel_ge(sopt->sopt_td->td_proc->p_ucred, 3);
+ error = securelevel_ge(sopt->sopt_td->td_ucred, 3);
if (error)
return (error);
}
diff --git a/sys/netinet/ip_fw.c b/sys/netinet/ip_fw.c
index 01908d7..744e2da 100644
--- a/sys/netinet/ip_fw.c
+++ b/sys/netinet/ip_fw.c
@@ -1940,7 +1940,7 @@ ip_fw_ctl(struct sockopt *sopt)
*/
if (sopt->sopt_name == IP_FW_ADD ||
(sopt->sopt_dir == SOPT_SET && sopt->sopt_name != IP_FW_RESETLOG)) {
- error = securelevel_ge(sopt->sopt_td->td_proc->p_ucred, 3);
+ error = securelevel_ge(sopt->sopt_td->td_ucred, 3);
if (error)
return (error);
}
diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c
index e9a6ff1..709a919 100644
--- a/sys/netinet/raw_ip.c
+++ b/sys/netinet/raw_ip.c
@@ -628,7 +628,7 @@ rip_pcblist(SYSCTL_HANDLER_ARGS)
for (inp = LIST_FIRST(ripcbinfo.listhead), i = 0; inp && i < n;
inp = LIST_NEXT(inp, inp_list)) {
if (inp->inp_gencnt <= gencnt) {
- if (cr_cansee(req->td->td_proc->p_ucred,
+ if (cr_cansee(req->td->td_ucred,
inp->inp_socket->so_cred))
continue;
inp_list[i++] = inp;
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index 99b08c4..94773d2 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -848,7 +848,7 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS)
for (inp = LIST_FIRST(tcbinfo.listhead), i = 0; inp && i < n;
inp = LIST_NEXT(inp, inp_list)) {
if (inp->inp_gencnt <= gencnt) {
- if (cr_cansee(req->td->td_proc->p_ucred,
+ if (cr_cansee(req->td->td_ucred,
inp->inp_socket->so_cred))
continue;
inp_list[i++] = inp;
@@ -919,7 +919,7 @@ tcp_getcred(SYSCTL_HANDLER_ARGS)
error = ENOENT;
goto out;
}
- error = cr_cansee(req->td->td_proc->p_ucred, inp->inp_socket->so_cred);
+ error = cr_cansee(req->td->td_ucred, inp->inp_socket->so_cred);
if (error)
goto out;
cru2x(inp->inp_socket->so_cred, &xuc);
@@ -971,7 +971,7 @@ tcp6_getcred(SYSCTL_HANDLER_ARGS)
error = ENOENT;
goto out;
}
- error = cr_cansee(req->td->td_proc->p_ucred, inp->inp_socket->so_cred);
+ error = cr_cansee(req->td->td_ucred, inp->inp_socket->so_cred);
if (error)
goto out;
cru2x(inp->inp_socket->so_cred, &xuc);
diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c
index 99b08c4..94773d2 100644
--- a/sys/netinet/tcp_timewait.c
+++ b/sys/netinet/tcp_timewait.c
@@ -848,7 +848,7 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS)
for (inp = LIST_FIRST(tcbinfo.listhead), i = 0; inp && i < n;
inp = LIST_NEXT(inp, inp_list)) {
if (inp->inp_gencnt <= gencnt) {
- if (cr_cansee(req->td->td_proc->p_ucred,
+ if (cr_cansee(req->td->td_ucred,
inp->inp_socket->so_cred))
continue;
inp_list[i++] = inp;
@@ -919,7 +919,7 @@ tcp_getcred(SYSCTL_HANDLER_ARGS)
error = ENOENT;
goto out;
}
- error = cr_cansee(req->td->td_proc->p_ucred, inp->inp_socket->so_cred);
+ error = cr_cansee(req->td->td_ucred, inp->inp_socket->so_cred);
if (error)
goto out;
cru2x(inp->inp_socket->so_cred, &xuc);
@@ -971,7 +971,7 @@ tcp6_getcred(SYSCTL_HANDLER_ARGS)
error = ENOENT;
goto out;
}
- error = cr_cansee(req->td->td_proc->p_ucred, inp->inp_socket->so_cred);
+ error = cr_cansee(req->td->td_ucred, inp->inp_socket->so_cred);
if (error)
goto out;
cru2x(inp->inp_socket->so_cred, &xuc);
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index e3a35d7..c3aa59f 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -330,8 +330,8 @@ tcp_usr_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
goto out;
}
- if (td && jailed(td->td_proc->p_ucred))
- prison_remote_ip(td->td_proc->p_ucred, 0, &sinp->sin_addr.s_addr);
+ if (td && jailed(td->td_ucred))
+ prison_remote_ip(td->td_ucred, 0, &sinp->sin_addr.s_addr);
if ((error = tcp_connect(tp, nam, td)) != 0)
goto out;
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index 047a5d4..3f98ea7 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -583,7 +583,7 @@ udp_pcblist(SYSCTL_HANDLER_ARGS)
for (inp = LIST_FIRST(udbinfo.listhead), i = 0; inp && i < n;
inp = LIST_NEXT(inp, inp_list)) {
if (inp->inp_gencnt <= gencnt) {
- if (cr_cansee(req->td->td_proc->p_ucred,
+ if (cr_cansee(req->td->td_ucred,
inp->inp_socket->so_cred))
continue;
inp_list[i++] = inp;
@@ -648,7 +648,7 @@ udp_getcred(SYSCTL_HANDLER_ARGS)
error = ENOENT;
goto out;
}
- error = cr_cansee(req->td->td_proc->p_ucred, inp->inp_socket->so_cred);
+ error = cr_cansee(req->td->td_ucred, inp->inp_socket->so_cred);
if (error)
goto out;
cru2x(inp->inp_socket->so_cred, &xuc);
@@ -686,8 +686,8 @@ udp_output(inp, m, addr, control, td)
if (addr) {
sin = (struct sockaddr_in *)addr;
- if (td && jailed(td->td_proc->p_ucred))
- prison_remote_ip(td->td_proc->p_ucred, 0, &sin->sin_addr.s_addr);
+ if (td && jailed(td->td_ucred))
+ prison_remote_ip(td->td_ucred, 0, &sin->sin_addr.s_addr);
laddr = inp->inp_laddr;
if (inp->inp_faddr.s_addr != INADDR_ANY) {
error = EISCONN;
@@ -856,8 +856,8 @@ udp_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
return EISCONN;
s = splnet();
sin = (struct sockaddr_in *)nam;
- if (td && jailed(td->td_proc->p_ucred))
- prison_remote_ip(td->td_proc->p_ucred, 0, &sin->sin_addr.s_addr);
+ if (td && jailed(td->td_ucred))
+ prison_remote_ip(td->td_ucred, 0, &sin->sin_addr.s_addr);
error = in_pcbconnect(inp, nam, td);
splx(s);
if (error == 0)
diff --git a/sys/netsmb/smb_conn.c b/sys/netsmb/smb_conn.c
index b58781f..657c469 100644
--- a/sys/netsmb/smb_conn.c
+++ b/sys/netsmb/smb_conn.c
@@ -833,7 +833,7 @@ smb_sysctl_treedump(SYSCTL_HANDLER_ARGS)
struct smb_share_info ssi;
int error, itype;
- smb_makescred(&scred, td, td->td_proc->p_ucred);
+ smb_makescred(&scred, td, td->td_ucred);
error = smb_sm_lockvclist(LK_SHARED, td);
if (error)
return error;
diff --git a/sys/netsmb/smb_dev.c b/sys/netsmb/smb_dev.c
index c832fa8..f020b2c 100644
--- a/sys/netsmb/smb_dev.c
+++ b/sys/netsmb/smb_dev.c
@@ -123,8 +123,7 @@ static int
nsmb_dev_open(dev_t dev, int oflags, int devtype, struct thread *td)
{
struct smb_dev *sdp;
- struct proc *p = td->td_proc;
- struct ucred *cred = p->p_ucred;
+ struct ucred *cred = td->td_ucred;
int s;
sdp = SMB_GETDEV(dev);
diff --git a/sys/netsmb/smb_subr.c b/sys/netsmb/smb_subr.c
index 63b0d82..f4634d4 100644
--- a/sys/netsmb/smb_subr.c
+++ b/sys/netsmb/smb_subr.c
@@ -60,7 +60,7 @@ smb_makescred(struct smb_cred *scred, struct thread *td, struct ucred *cred)
{
if (td) {
scred->scr_td = td;
- scred->scr_cred = cred ? cred : td->td_proc->p_ucred;
+ scred->scr_cred = cred ? cred : td->td_ucred;
} else {
scred->scr_td = NULL;
scred->scr_cred = cred ? cred : NULL;
diff --git a/sys/netsmb/smb_trantcp.c b/sys/netsmb/smb_trantcp.c
index 171e83b..f1040dc 100644
--- a/sys/netsmb/smb_trantcp.c
+++ b/sys/netsmb/smb_trantcp.c
@@ -227,7 +227,7 @@ nb_connect_in(struct nbpcb *nbp, struct sockaddr_in *to, struct thread *td)
int error, s;
error = socreate(AF_INET, &so, SOCK_STREAM, IPPROTO_TCP,
- td->td_proc->p_ucred, td);
+ td->td_ucred, td);
if (error)
return error;
nbp->nbp_tso = so;
diff --git a/sys/nfsclient/bootp_subr.c b/sys/nfsclient/bootp_subr.c
index 4440abd..3bae16a 100644
--- a/sys/nfsclient/bootp_subr.c
+++ b/sys/nfsclient/bootp_subr.c
@@ -587,8 +587,7 @@ bootpc_call(struct bootpc_globalcontext *gctx, struct thread *td)
/*
* Create socket and set its recieve timeout.
*/
- error = socreate(AF_INET, &so, SOCK_DGRAM, 0, td->td_proc->p_ucred,
- td);
+ error = socreate(AF_INET, &so, SOCK_DGRAM, 0, td->td_ucred, td);
if (error != 0)
goto out;
@@ -973,8 +972,7 @@ bootpc_fakeup_interface(struct bootpc_ifcontext *ifctx,
struct ifaddr *ifa;
struct sockaddr_dl *sdl;
- error = socreate(AF_INET, &ifctx->so, SOCK_DGRAM, 0,
- td->td_proc->p_ucred, td);
+ error = socreate(AF_INET, &ifctx->so, SOCK_DGRAM, 0, td->td_ucred, td);
if (error != 0)
panic("nfs_boot: socreate, error=%d", error);
diff --git a/sys/nfsclient/krpc_subr.c b/sys/nfsclient/krpc_subr.c
index 349cdf0..4690104 100644
--- a/sys/nfsclient/krpc_subr.c
+++ b/sys/nfsclient/krpc_subr.c
@@ -216,8 +216,7 @@ krpc_call(struct sockaddr_in *sa, u_int prog, u_int vers, u_int func,
/*
* Create socket and set its recieve timeout.
*/
- if ((error = socreate(AF_INET, &so, SOCK_DGRAM, 0,
- td->td_proc->p_ucred, td)))
+ if ((error = socreate(AF_INET, &so, SOCK_DGRAM, 0, td->td_ucred, td)))
goto out;
tv.tv_sec = 1;
diff --git a/sys/nfsclient/nfs_bio.c b/sys/nfsclient/nfs_bio.c
index 1b607dc..40fac72 100644
--- a/sys/nfsclient/nfs_bio.c
+++ b/sys/nfsclient/nfs_bio.c
@@ -105,7 +105,7 @@ nfs_getpages(struct vop_getpages_args *ap)
vp = ap->a_vp;
td = curthread; /* XXX */
- cred = curthread->td_proc->p_ucred; /* XXX */
+ cred = curthread->td_ucred; /* XXX */
nmp = VFSTONFS(vp->v_mount);
pages = ap->a_m;
count = ap->a_count;
@@ -266,7 +266,7 @@ nfs_putpages(struct vop_putpages_args *ap)
vp = ap->a_vp;
np = VTONFS(vp);
td = curthread; /* XXX */
- cred = curthread->td_proc->p_ucred; /* XXX */
+ cred = curthread->td_ucred; /* XXX */
nmp = VFSTONFS(vp->v_mount);
pages = ap->a_m;
count = ap->a_count;
diff --git a/sys/nfsclient/nfs_lock.c b/sys/nfsclient/nfs_lock.c
index a239c1c..2998463 100644
--- a/sys/nfsclient/nfs_lock.c
+++ b/sys/nfsclient/nfs_lock.c
@@ -140,7 +140,7 @@ nfs_dolock(struct vop_advlock_args *ap)
msg.lm_fh_len = NFS_ISV3(vp) ? VTONFS(vp)->n_fhsize : NFSX_V2FH;
bcopy(VTONFS(vp)->n_fhp, msg.lm_fh, msg.lm_fh_len);
msg.lm_nfsv3 = NFS_ISV3(vp);
- msg.lm_cred = *(p->p_ucred);
+ msg.lm_cred = *(td->td_ucred);
/*
* Open the lock fifo. If for any reason we don't find the fifo, it
@@ -242,7 +242,7 @@ nfslockdans(struct thread *td, struct lockd_ans *ansp)
* XXX This authorization check is probably not right.
*/
if ((error = suser(td->td_proc)) != 0 &&
- td->td_proc->p_ucred->cr_svuid != 0)
+ td->td_ucred->cr_svuid != 0)
return (error);
/* the version should match, or we're out of sync */
diff --git a/sys/nfsclient/nfs_vfsops.c b/sys/nfsclient/nfs_vfsops.c
index 62d412e..675cd94 100644
--- a/sys/nfsclient/nfs_vfsops.c
+++ b/sys/nfsclient/nfs_vfsops.c
@@ -253,13 +253,13 @@ nfs_statfs(struct mount *mp, struct statfs *sbp, struct thread *td)
return (error);
vp = NFSTOV(np);
if (v3 && (nmp->nm_state & NFSSTA_GOTFSINFO) == 0)
- (void)nfs_fsinfo(nmp, vp, td->td_proc->p_ucred, td);
+ (void)nfs_fsinfo(nmp, vp, td->td_ucred, td);
nfsstats.rpccnt[NFSPROC_FSSTAT]++;
mreq = nfsm_reqhead(vp, NFSPROC_FSSTAT, NFSX_FH(v3));
mb = mreq;
bpos = mtod(mb, caddr_t);
nfsm_fhtom(vp, v3);
- nfsm_request(vp, NFSPROC_FSSTAT, td, td->td_proc->p_ucred);
+ nfsm_request(vp, NFSPROC_FSSTAT, td, td->td_ucred);
if (v3)
nfsm_postop_attr(vp, retattr);
if (error) {
@@ -420,7 +420,7 @@ nfs_mountroot(struct mount *mp, struct thread *td)
* talk to the server.
*/
error = socreate(nd->myif.ifra_addr.sa_family, &so, SOCK_DGRAM, 0,
- td->td_proc->p_ucred, td);
+ td->td_ucred, td);
if (error)
panic("nfs_mountroot: socreate(%04x): %d",
nd->myif.ifra_addr.sa_family, error);
@@ -559,7 +559,7 @@ nfs_mountdiskless(char *path, char *which, int mountflag,
mp->mnt_flag = mountflag;
nam = dup_sockaddr((struct sockaddr *)sin, 1);
if ((error = mountnfs(args, mp, nam, which, path, vpp,
- td->td_proc->p_ucred)) != 0) {
+ td->td_ucred)) != 0) {
printf("nfs_mountroot: mount %s on %s: %d", path, which, error);
mp->mnt_vfc->vfc_refcount--;
vfs_unbusy(mp, td);
@@ -787,7 +787,7 @@ nfs_mount(struct mount *mp, char *path, caddr_t data, struct nameidata *ndp,
if (error)
return (error);
args.fh = nfh;
- error = mountnfs(&args, mp, nam, path, hst, &vp, td->td_proc->p_ucred);
+ error = mountnfs(&args, mp, nam, path, hst, &vp, td->td_ucred);
return (error);
}
@@ -884,7 +884,7 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam,
* Get file attributes for the mountpoint. This has the side
* effect of filling in (*vpp)->v_type with the correct value.
*/
- VOP_GETATTR(*vpp, &attrs, curthread->td_proc->p_ucred, curthread);
+ VOP_GETATTR(*vpp, &attrs, curthread->td_ucred, curthread);
/*
* Lose the lock but keep the ref.
diff --git a/sys/nfsserver/nfs_serv.c b/sys/nfsserver/nfs_serv.c
index b9d54af..17aea87 100644
--- a/sys/nfsserver/nfs_serv.c
+++ b/sys/nfsserver/nfs_serv.c
@@ -1966,7 +1966,7 @@ nfsrv_mknod(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
nd.ni_cnd.cn_nameiop = LOOKUP;
nd.ni_cnd.cn_flags &= ~(LOCKPARENT);
nd.ni_cnd.cn_thread = td;
- nd.ni_cnd.cn_cred = td->td_proc->p_ucred;
+ nd.ni_cnd.cn_cred = td->td_ucred;
error = lookup(&nd);
nd.ni_dvp = NULL;
diff --git a/sys/nfsserver/nfs_srvsubs.c b/sys/nfsserver/nfs_srvsubs.c
index 3e57612..a8b0b83 100644
--- a/sys/nfsserver/nfs_srvsubs.c
+++ b/sys/nfsserver/nfs_srvsubs.c
@@ -1156,8 +1156,7 @@ nfsrv_object_create(struct vnode *vp)
if (vp == NULL || vp->v_type != VREG)
return (1);
- return (vfs_object_create(vp, curthread,
- curthread ? curthread->td_proc->p_ucred : NULL));
+ return (vfs_object_create(vp, curthread, curthread->td_ucred));
}
/*
diff --git a/sys/pc98/pc98/syscons.c b/sys/pc98/pc98/syscons.c
index d9ad26d..48cf887 100644
--- a/sys/pc98/pc98/syscons.c
+++ b/sys/pc98/pc98/syscons.c
@@ -980,7 +980,7 @@ scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
error = suser_td(td);
if (error != 0)
return error;
- error = securelevel_gt(td->td_proc->p_ucred, 0);
+ error = securelevel_gt(td->td_ucred, 0);
if (error != 0)
return error;
#ifdef __i386__
diff --git a/sys/security/lomac/kernel_mmap.c b/sys/security/lomac/kernel_mmap.c
index 6b01dc7..40d53e6 100644
--- a/sys/security/lomac/kernel_mmap.c
+++ b/sys/security/lomac/kernel_mmap.c
@@ -345,7 +345,7 @@ mmap(td, uap)
struct vattr va;
if ((error =
VOP_GETATTR(vp, &va,
- p->p_ucred, td))) {
+ td->td_ucred, td))) {
goto done;
}
if ((va.va_flags &
diff --git a/sys/security/lomac/kernel_socket.c b/sys/security/lomac/kernel_socket.c
index 3ed2ee1..cc432a0 100644
--- a/sys/security/lomac/kernel_socket.c
+++ b/sys/security/lomac/kernel_socket.c
@@ -232,7 +232,7 @@ lomac_local_connect(struct socket *so, struct sockaddr *nam, struct thread *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;
@@ -265,7 +265,7 @@ lomac_local_connect(struct socket *so, struct sockaddr *nam, struct thread *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
diff --git a/sys/security/lomac/kernel_util.c b/sys/security/lomac/kernel_util.c
index 9a7a0ab..8a57a2b 100644
--- a/sys/security/lomac/kernel_util.c
+++ b/sys/security/lomac/kernel_util.c
@@ -383,7 +383,7 @@ unmount(td, uap)
*/
if (!mediate_subject_at_level("unmount", td->td_proc,
LOMAC_HIGHEST_LEVEL) ||
- ((mp->mnt_stat.f_owner != td->td_proc->p_ucred->cr_uid) &&
+ ((mp->mnt_stat.f_owner != td->td_ucred->cr_uid) &&
(error = suser_td(td)))) {
vput(vp);
return (error);
@@ -661,8 +661,7 @@ lomac_do_recwd(struct proc *p) {
if (vp->v_type != VDIR)
error = ENOTDIR;
else
- error = VOP_ACCESS(vp, VEXEC, td->td_proc->p_ucred,
- curthread);
+ error = VOP_ACCESS(vp, VEXEC, td->td_ucred, curthread);
if (error)
vput(vp);
else {
diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c
index e88cc15..f740c9f 100644
--- a/sys/ufs/ffs/ffs_snapshot.c
+++ b/sys/ufs/ffs/ffs_snapshot.c
@@ -207,7 +207,7 @@ restart:
*/
for (blkno = NDADDR; blkno < numblks; blkno += NINDIR(fs)) {
error = UFS_BALLOC(vp, lblktosize(fs, (off_t)blkno),
- fs->fs_bsize, td->td_proc->p_ucred, B_METAONLY, &ibp);
+ fs->fs_bsize, td->td_ucred, B_METAONLY, &ibp);
if (error)
goto out;
bdwrite(ibp);
diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c
index 05da93e..9aaf4bd 100644
--- a/sys/ufs/ffs/ffs_softdep.c
+++ b/sys/ufs/ffs/ffs_softdep.c
@@ -812,7 +812,7 @@ softdep_flushworklist(oldmnt, countp, td)
while ((count = softdep_process_worklist(oldmnt)) > 0) {
*countp += count;
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
- error = VOP_FSYNC(devvp, td->td_proc->p_ucred, MNT_WAIT, td);
+ error = VOP_FSYNC(devvp, td->td_ucred, MNT_WAIT, td);
VOP_UNLOCK(devvp, 0, td);
if (error)
break;
@@ -3078,7 +3078,7 @@ handle_workitem_remove(dirrem)
}
inodedep->id_nlinkdelta = ip->i_nlink - ip->i_effnlink;
FREE_LOCK(&lk);
- if ((error = UFS_TRUNCATE(vp, (off_t)0, 0, td->td_proc->p_ucred, td)) != 0)
+ if ((error = UFS_TRUNCATE(vp, (off_t)0, 0, td->td_ucred, td)) != 0)
softdep_error("handle_workitem_remove: truncate", error);
/*
* Rename a directory to a new parent. Since, we are both deleting
@@ -4245,7 +4245,7 @@ softdep_fsync(vp)
return (error);
}
if ((pagedep->pd_state & NEWBLOCK) &&
- (error = VOP_FSYNC(pvp, td->td_proc->p_ucred, MNT_WAIT, td))) {
+ (error = VOP_FSYNC(pvp, td->td_ucred, MNT_WAIT, td))) {
vput(pvp);
return (error);
}
@@ -4253,7 +4253,7 @@ softdep_fsync(vp)
/*
* Flush directory page containing the inode's name.
*/
- error = bread(pvp, lbn, blksize(fs, VTOI(pvp), lbn), td->td_proc->p_ucred,
+ error = bread(pvp, lbn, blksize(fs, VTOI(pvp), lbn), td->td_ucred,
&bp);
if (error == 0)
error = BUF_WRITE(bp);
@@ -4730,8 +4730,8 @@ flush_pagedep_deps(pvp, mp, diraddhdp)
FREE_LOCK(&lk);
if ((error = VFS_VGET(mp, inum, &vp)) != 0)
break;
- if ((error=VOP_FSYNC(vp, td->td_proc->p_ucred, MNT_NOWAIT, td)) ||
- (error=VOP_FSYNC(vp, td->td_proc->p_ucred, MNT_NOWAIT, td))) {
+ if ((error=VOP_FSYNC(vp, td->td_ucred, MNT_NOWAIT, td)) ||
+ (error=VOP_FSYNC(vp, td->td_ucred, MNT_NOWAIT, td))) {
vput(vp);
break;
}
@@ -4997,7 +4997,7 @@ clear_remove(td)
vn_finished_write(mp);
return;
}
- if ((error = VOP_FSYNC(vp, td->td_proc->p_ucred, MNT_NOWAIT, td)))
+ if ((error = VOP_FSYNC(vp, td->td_ucred, MNT_NOWAIT, td)))
softdep_error("clear_remove: fsync", error);
drain_output(vp, 0);
vput(vp);
@@ -5071,10 +5071,10 @@ clear_inodedeps(td)
return;
}
if (ino == lastino) {
- if ((error = VOP_FSYNC(vp, td->td_proc->p_ucred, MNT_WAIT, td)))
+ if ((error = VOP_FSYNC(vp, td->td_ucred, MNT_WAIT, td)))
softdep_error("clear_inodedeps: fsync1", error);
} else {
- if ((error = VOP_FSYNC(vp, td->td_proc->p_ucred, MNT_NOWAIT, td)))
+ if ((error = VOP_FSYNC(vp, td->td_ucred, MNT_NOWAIT, td)))
softdep_error("clear_inodedeps: fsync2", error);
drain_output(vp, 0);
}
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index 9025767..091fd64 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -230,7 +230,7 @@ ffs_mount(mp, path, data, ndp, td)
if (suser_td(td)) {
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
if ((error = VOP_ACCESS(devvp, VREAD | VWRITE,
- td->td_proc->p_ucred, td)) != 0) {
+ td->td_ucred, td)) != 0) {
VOP_UNLOCK(devvp, 0, td);
return (error);
}
@@ -261,7 +261,7 @@ ffs_mount(mp, path, data, ndp, td)
}
/* check to see if we need to start softdep */
if ((fs->fs_flags & FS_DOSOFTDEP) &&
- (error = softdep_mount(devvp, mp, fs, td->td_proc->p_ucred))){
+ (error = softdep_mount(devvp, mp, fs, td->td_ucred))){
vn_finished_write(mp);
return (error);
}
@@ -313,7 +313,7 @@ ffs_mount(mp, path, data, ndp, td)
if ((mp->mnt_flag & MNT_RDONLY) == 0)
accessmode |= VWRITE;
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
- if ((error = VOP_ACCESS(devvp, accessmode, td->td_proc->p_ucred, td))!= 0){
+ if ((error = VOP_ACCESS(devvp, accessmode, td->td_ucred, td))!= 0){
vput(devvp);
return (error);
}
@@ -409,7 +409,7 @@ ffs_reload(mp, cred, td)
*/
if (vn_isdisk(devvp, NULL)) {
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
- vfs_object_create(devvp, td, td->td_proc->p_ucred);
+ vfs_object_create(devvp, td, td->td_ucred);
mtx_lock(&devvp->v_interlock);
VOP_UNLOCK(devvp, LK_INTERLOCK, td);
}
@@ -556,7 +556,7 @@ ffs_mountfs(devvp, mp, td, malloctype)
int ncount;
dev = devvp->v_rdev;
- cred = td ? td->td_proc->p_ucred : NOCRED;
+ cred = td ? td->td_ucred : NOCRED;
/*
* Disallow multiple mounts of the same device.
* Disallow mounting of a device that is currently in use
@@ -942,7 +942,7 @@ ffs_flushfiles(mp, flags, td)
* Flush filesystem metadata.
*/
vn_lock(ump->um_devvp, LK_EXCLUSIVE | LK_RETRY, td);
- error = VOP_FSYNC(ump->um_devvp, td->td_proc->p_ucred, MNT_WAIT, td);
+ error = VOP_FSYNC(ump->um_devvp, td->td_ucred, MNT_WAIT, td);
VOP_UNLOCK(ump->um_devvp, 0, td);
return (error);
}
diff --git a/sys/ufs/ufs/ufs_extattr.c b/sys/ufs/ufs/ufs_extattr.c
index 09645a1..2ab61fb 100644
--- a/sys/ufs/ufs/ufs_extattr.c
+++ b/sys/ufs/ufs/ufs_extattr.c
@@ -224,7 +224,7 @@ ufs_extattr_start(struct mount *mp, struct thread *td)
ump->um_extattr.uepm_flags |= UFS_EXTATTR_UEPM_STARTED;
- ump->um_extattr.uepm_ucred = crhold(td->td_proc->p_ucred);
+ ump->um_extattr.uepm_ucred = crhold(td->td_ucred);
unlock:
ufs_extattr_uepm_unlock(ump, td);
@@ -258,7 +258,7 @@ ufs_extattr_lookup(struct vnode *start_dvp, int lockparent, char *dirname,
if (lockparent == UE_GETDIR_LOCKPARENT)
cnp.cn_flags |= LOCKPARENT;
cnp.cn_thread = td;
- cnp.cn_cred = td->td_proc->p_ucred;
+ cnp.cn_cred = td->td_ucred;
cnp.cn_pnbuf = zalloc(namei_zone);
cnp.cn_nameptr = cnp.cn_pnbuf;
error = copystr(dirname, cnp.cn_pnbuf, MAXPATHLEN,
@@ -330,7 +330,7 @@ ufs_extattr_enable_with_open(struct ufsmount *ump, struct vnode *vp,
{
int error;
- error = VOP_OPEN(vp, FREAD|FWRITE, td->td_proc->p_ucred, td);
+ error = VOP_OPEN(vp, FREAD|FWRITE, td->td_ucred, td);
if (error) {
printf("ufs_extattr_enable_with_open.VOP_OPEN(): failed "
"with %d\n", error);
@@ -344,7 +344,7 @@ ufs_extattr_enable_with_open(struct ufsmount *ump, struct vnode *vp,
*/
if (vn_canvmio(vp) == TRUE)
if ((error = vfs_object_create(vp, td,
- td->td_proc->p_ucred)) != 0) {
+ td->td_ucred)) != 0) {
/*
* XXX: bug replicated from vn_open(): should
* VOP_CLOSE() here.
@@ -361,7 +361,7 @@ ufs_extattr_enable_with_open(struct ufsmount *ump, struct vnode *vp,
error = ufs_extattr_enable(ump, attrnamespace, attrname, vp, td);
if (error != 0)
- vn_close(vp, FREAD|FWRITE, td->td_proc->p_ucred, td);
+ vn_close(vp, FREAD|FWRITE, td->td_ucred, td);
return (error);
}
@@ -400,7 +400,7 @@ ufs_extattr_iterate_directory(struct ufsmount *ump, struct vnode *dvp,
vargs.a_desc = NULL;
vargs.a_vp = dvp;
vargs.a_uio = &auio;
- vargs.a_cred = td->td_proc->p_ucred;
+ vargs.a_cred = td->td_ucred;
vargs.a_eofflag = &eofflag;
vargs.a_ncookies = NULL;
vargs.a_cookies = NULL;
@@ -631,7 +631,7 @@ ufs_extattr_enable(struct ufsmount *ump, int attrnamespace,
auio.uio_rw = UIO_READ;
auio.uio_td = td;
- VOP_LEASE(backing_vnode, td, td->td_proc->p_ucred, LEASE_WRITE);
+ VOP_LEASE(backing_vnode, td, td->td_ucred, LEASE_WRITE);
vn_lock(backing_vnode, LK_SHARED | LK_NOPAUSE | LK_RETRY, td);
error = VOP_READ(backing_vnode, &auio, IO_NODELOCKED,
ump->um_extattr.uepm_ucred);
@@ -692,7 +692,7 @@ ufs_extattr_disable(struct ufsmount *ump, int attrnamespace,
uele->uele_backing_vnode->v_flag &= ~VSYSTEM;
error = vn_close(uele->uele_backing_vnode, FREAD|FWRITE,
- td->td_proc->p_ucred, td);
+ td->td_ucred, td);
FREE(uele, M_UFS_EXTATTR);
@@ -715,7 +715,7 @@ ufs_extattrctl(struct mount *mp, int cmd, struct vnode *filename_vp,
* Processes with privilege, but in jail, are not allowed to
* configure extended attributes.
*/
- if ((error = suser_xxx(td->td_proc->p_ucred, td->td_proc, 0))) {
+ if ((error = suser_xxx(td->td_ucred, td->td_proc, 0))) {
if (filename_vp != NULL)
VOP_UNLOCK(filename_vp, 0, td);
return (error);
diff --git a/sys/ufs/ufs/ufs_lookup.c b/sys/ufs/ufs/ufs_lookup.c
index ee7df3d..bbb07af 100644
--- a/sys/ufs/ufs/ufs_lookup.c
+++ b/sys/ufs/ufs/ufs_lookup.c
@@ -749,7 +749,7 @@ ufs_direnter(dvp, tvp, dirp, cnp, newdirbp)
char *dirbuf;
td = curthread; /* XXX */
- cr = td->td_proc->p_ucred;
+ cr = td->td_ucred;
dp = VTOI(dvp);
newentrysize = DIRSIZ(OFSFMT(dvp), dirp);
@@ -819,7 +819,7 @@ ufs_direnter(dvp, tvp, dirp, cnp, newdirbp)
return (error);
if (tvp != NULL)
VOP_UNLOCK(tvp, 0, td);
- error = VOP_FSYNC(dvp, td->td_proc->p_ucred, MNT_WAIT, td);
+ error = VOP_FSYNC(dvp, td->td_ucred, MNT_WAIT, td);
if (tvp != NULL)
vn_lock(tvp, LK_EXCLUSIVE | LK_RETRY, td);
return (error);
diff --git a/sys/ufs/ufs/ufs_quota.c b/sys/ufs/ufs/ufs_quota.c
index 7abf70c..7c31bb0 100644
--- a/sys/ufs/ufs/ufs_quota.c
+++ b/sys/ufs/ufs/ufs_quota.c
@@ -409,7 +409,7 @@ quotaon(td, mp, type, fname)
vp = nd.ni_vp;
VOP_UNLOCK(vp, 0, td);
if (vp->v_type != VREG) {
- (void) vn_close(vp, FREAD|FWRITE, td->td_proc->p_ucred, td);
+ (void) vn_close(vp, FREAD|FWRITE, td->td_ucred, td);
return (EACCES);
}
if (*vpp != vp)
@@ -422,7 +422,7 @@ quotaon(td, mp, type, fname)
* Save the credential of the process that turned on quotas.
* Set up the time limits for this quota.
*/
- ump->um_cred[type] = crhold(td->td_proc->p_ucred);
+ ump->um_cred[type] = crhold(td->td_ucred);
ump->um_btime[type] = MAX_DQ_TIME;
ump->um_itime[type] = MAX_IQ_TIME;
if (dqget(NULLVP, 0, ump, type, &dq) == 0) {
@@ -523,7 +523,7 @@ again:
mtx_unlock(&mntvnode_mtx);
dqflush(qvp);
qvp->v_flag &= ~VSYSTEM;
- error = vn_close(qvp, FREAD|FWRITE, td->td_proc->p_ucred, td);
+ error = vn_close(qvp, FREAD|FWRITE, td->td_ucred, td);
ump->um_quotas[type] = NULLVP;
crfree(ump->um_cred[type]);
ump->um_cred[type] = NOCRED;
diff --git a/sys/ufs/ufs/ufs_vfsops.c b/sys/ufs/ufs/ufs_vfsops.c
index 7b42452..e6cbd6c 100644
--- a/sys/ufs/ufs/ufs_vfsops.c
+++ b/sys/ufs/ufs/ufs_vfsops.c
@@ -108,14 +108,14 @@ ufs_quotactl(mp, cmds, uid, arg, td)
int cmd, type, error;
if (uid == -1)
- uid = td->td_proc->p_ucred->cr_ruid;
+ uid = td->td_ucred->cr_ruid;
cmd = cmds >> SUBCMDSHIFT;
switch (cmd) {
case Q_SYNC:
break;
case Q_GETQUOTA:
- if (uid == td->td_proc->p_ucred->cr_ruid)
+ if (uid == td->td_ucred->cr_ruid)
break;
/* fall through */
default:
diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c
index aafa26a..27a1ae3 100644
--- a/sys/vm/vm_mmap.c
+++ b/sys/vm/vm_mmap.c
@@ -346,7 +346,7 @@ mmap(td, uap)
* other securelevel.
* XXX this will have to go
*/
- if (securelevel_ge(td->td_proc->p_ucred, 1))
+ if (securelevel_ge(td->td_ucred, 1))
disablexworkaround = 1;
else
disablexworkaround = suser_td(td);
@@ -387,7 +387,7 @@ mmap(td, uap)
struct vattr va;
if ((error =
VOP_GETATTR(vp, &va,
- td->td_proc->p_ucred, td))) {
+ td->td_ucred, td))) {
goto done;
}
if ((va.va_flags &
@@ -1184,7 +1184,7 @@ vm_mmap(vm_map_t map, vm_offset_t *addr, vm_size_t size, vm_prot_t prot,
struct vattr vat;
int error;
- error = VOP_GETATTR(vp, &vat, td->td_proc->p_ucred, td);
+ error = VOP_GETATTR(vp, &vat, td->td_ucred, td);
if (error) {
mtx_unlock(&Giant);
return (error);
diff --git a/sys/vm/vm_swap.c b/sys/vm/vm_swap.c
index 1a26712..eb7251c 100644
--- a/sys/vm/vm_swap.c
+++ b/sys/vm/vm_swap.c
@@ -222,7 +222,7 @@ swapon(td, uap)
if (vn_isdisk(vp, &error))
error = swaponvp(td, vp, vp->v_rdev, 0);
else if (vp->v_type == VREG && vp->v_tag == VT_NFS &&
- (error = VOP_GETATTR(vp, &attr, td->td_proc->p_ucred, td)) == 0) {
+ (error = VOP_GETATTR(vp, &attr, td->td_ucred, td)) == 0) {
/*
* Allow direct swapping to NFS regular files in the same
* way that nfs_mountroot() sets up diskless swapping.
@@ -262,7 +262,6 @@ swaponvp(td, vp, dev, nblks)
swblk_t dvbase;
int error;
u_long aligned_nblks;
- struct proc *p = td->td_proc;
if (!swapdev_vp) {
error = getnewvnode(VT_NON, NULL, swapdev_vnodeop_p,
@@ -283,18 +282,18 @@ swaponvp(td, vp, dev, nblks)
return EINVAL;
found:
(void) vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
- error = VOP_OPEN(vp, FREAD | FWRITE, p->p_ucred, td);
+ error = VOP_OPEN(vp, FREAD | FWRITE, td->td_ucred, td);
(void) VOP_UNLOCK(vp, 0, td);
if (error)
return (error);
if (nblks == 0 && dev != NODEV && (devsw(dev)->d_psize == 0 ||
(nblks = (*devsw(dev)->d_psize) (dev)) == -1)) {
- (void) VOP_CLOSE(vp, FREAD | FWRITE, p->p_ucred, td);
+ (void) VOP_CLOSE(vp, FREAD | FWRITE, td->td_ucred, td);
return (ENXIO);
}
if (nblks == 0) {
- (void) VOP_CLOSE(vp, FREAD | FWRITE, p->p_ucred, td);
+ (void) VOP_CLOSE(vp, FREAD | FWRITE, td->td_ucred, td);
return (ENXIO);
}
@@ -305,7 +304,7 @@ swaponvp(td, vp, dev, nblks)
if (nblks > 0x40000000 / BLIST_META_RADIX / nswdev) {
printf("exceeded maximum of %d blocks per swap unit\n",
0x40000000 / BLIST_META_RADIX / nswdev);
- (void) VOP_CLOSE(vp, FREAD | FWRITE, p->p_ucred, td);
+ (void) VOP_CLOSE(vp, FREAD | FWRITE, td->td_ucred, td);
return (ENXIO);
}
/*
diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c
index b0348c6..d9d1d73 100644
--- a/sys/vm/vnode_pager.c
+++ b/sys/vm/vnode_pager.c
@@ -463,8 +463,8 @@ vnode_pager_input_smlfs(object, m)
bp->b_iodone = vnode_pager_iodone;
KASSERT(bp->b_rcred == NOCRED, ("leaking read ucred"));
KASSERT(bp->b_wcred == NOCRED, ("leaking write ucred"));
- bp->b_rcred = crhold(curthread->td_proc->p_ucred);
- bp->b_wcred = crhold(curthread->td_proc->p_ucred);
+ bp->b_rcred = crhold(curthread->td_ucred);
+ bp->b_wcred = crhold(curthread->td_ucred);
bp->b_data = (caddr_t) kva + i * bsize;
bp->b_blkno = fileaddr;
pbgetvp(dp, bp);
@@ -555,7 +555,7 @@ vnode_pager_input_old(object, m)
auio.uio_resid = size;
auio.uio_td = curthread;
- error = VOP_READ(vp, &auio, 0, curthread->td_proc->p_ucred);
+ error = VOP_READ(vp, &auio, 0, curthread->td_ucred);
if (!error) {
int count = size - auio.uio_resid;
@@ -782,8 +782,8 @@ vnode_pager_generic_getpages(vp, m, bytecount, reqpage)
/* B_PHYS is not set, but it is nice to fill this in */
KASSERT(bp->b_rcred == NOCRED, ("leaking read ucred"));
KASSERT(bp->b_wcred == NOCRED, ("leaking write ucred"));
- bp->b_rcred = crhold(curthread->td_proc->p_ucred);
- bp->b_wcred = crhold(curthread->td_proc->p_ucred);
+ bp->b_rcred = crhold(curthread->td_ucred);
+ bp->b_wcred = crhold(curthread->td_ucred);
bp->b_blkno = firstaddr;
pbgetvp(dp, bp);
bp->b_bcount = size;
@@ -1030,7 +1030,7 @@ vnode_pager_generic_putpages(vp, m, bytecount, flags, rtvals)
auio.uio_rw = UIO_WRITE;
auio.uio_resid = maxsize;
auio.uio_td = (struct thread *) 0;
- error = VOP_WRITE(vp, &auio, ioflags, curthread->td_proc->p_ucred);
+ error = VOP_WRITE(vp, &auio, ioflags, curthread->td_ucred);
cnt.v_vnodeout++;
cnt.v_vnodepgsout += ncount;
OpenPOWER on IntegriCloud