1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-28 11:57:28 +00:00

Simple p_ucred -> td_ucred changes to start using the per-thread ucred

reference.
This commit is contained in:
John Baldwin 2002-02-27 18:32:23 +00:00
parent 65e3406d28
commit a854ed9893
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=91406
117 changed files with 430 additions and 454 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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 @@ linux_getcwd_scandir(lvpp, uvpp, bpp, bufp, td)
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;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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 @@ ccdlookup(char *path, struct thread *td, struct vnode **vpp)
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);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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__

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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 */

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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 @@ ccdlookup(char *path, struct thread *td, struct vnode **vpp)
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);
}

View File

@ -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 */

View File

@ -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 */

View File

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

View File

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

View File

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

View File

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

View File

@ -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;
/*

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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);
}
/*

View File

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

View File

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

View File

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

View File

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

View File

@ -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 @@ link_aout_load_file(linker_class_t lc, const char* filename, linker_file_t* resu
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;
}

View File

@ -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 @@ link_elf_load_file(linker_class_t cls, const char* filename, linker_file_t* resu
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;
}

View File

@ -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 @@ link_elf_load_file(linker_class_t cls, const char* filename, linker_file_t* resu
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;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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 @@ sendfile(struct thread *td, struct sendfile_args *uap)
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);

View File

@ -636,7 +636,7 @@ unp_bind(unp, nam, td)
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:

View File

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

View File

@ -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 @@ mknod(td, uap)
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 @@ mkfifo(td, uap)
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 @@ symlink(td, uap)
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 @@ undelete(td, uap)
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 @@ unlink(td, uap)
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 @@ vn_mkdir(path, mode, segflg, td)
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 @@ rmdir(td, uap)
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);

View File

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

View File

@ -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 @@ mknod(td, uap)
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 @@ mkfifo(td, uap)
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 @@ symlink(td, uap)
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 @@ undelete(td, uap)
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 @@ unlink(td, uap)
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 @@ vn_mkdir(path, mode, segflg, td)
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 @@ rmdir(td, uap)
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);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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 */

Some files were not shown because too many files have changed in this diff Show More