diff options
Diffstat (limited to 'sys/compat/linux/linux_uid16.c')
-rw-r--r-- | sys/compat/linux/linux_uid16.c | 72 |
1 files changed, 37 insertions, 35 deletions
diff --git a/sys/compat/linux/linux_uid16.c b/sys/compat/linux/linux_uid16.c index c6a1c12..80e5763 100644 --- a/sys/compat/linux/linux_uid16.c +++ b/sys/compat/linux/linux_uid16.c @@ -43,13 +43,13 @@ DUMMY(getresuid16); DUMMY(getresgid16); int -linux_chown16(struct proc *p, struct linux_chown16_args *args) +linux_chown16(struct thread *td, struct linux_chown16_args *args) { struct chown_args bsd; caddr_t sg; sg = stackgap_init(); - CHECKALTEXIST(p, &sg, args->path); + CHECKALTEXIST(td, &sg, args->path); #ifdef DEBUG if (ldebug(chown16)) @@ -60,17 +60,17 @@ linux_chown16(struct proc *p, struct linux_chown16_args *args) bsd.path = args->path; bsd.uid = args->uid; bsd.gid = args->gid; - return (chown(p, &bsd)); + return (chown(td, &bsd)); } int -linux_lchown16(struct proc *p, struct linux_lchown16_args *args) +linux_lchown16(struct thread *td, struct linux_lchown16_args *args) { struct lchown_args bsd; caddr_t sg; sg = stackgap_init(); - CHECKALTEXIST(p, &sg, args->path); + CHECKALTEXIST(td, &sg, args->path); #ifdef DEBUG if (ldebug(lchown16)) @@ -81,11 +81,11 @@ linux_lchown16(struct proc *p, struct linux_lchown16_args *args) bsd.path = args->path; bsd.uid = args->uid; bsd.gid = args->gid; - return (lchown(p, &bsd)); + return (lchown(td, &bsd)); } int -linux_setgroups16(struct proc *p, struct linux_setgroups16_args *args) +linux_setgroups16(struct thread *td, struct linux_setgroups16_args *args) { struct ucred *newcred, *oldcred; l_gid16_t linux_gidset[NGROUPS]; @@ -98,7 +98,7 @@ linux_setgroups16(struct proc *p, struct linux_setgroups16_args *args) #endif ngrp = args->gidsetsize; - oldcred = p->p_ucred; + oldcred = td->td_proc->p_ucred; /* * cr_groups[0] holds egid. Setting the whole set from @@ -131,14 +131,14 @@ linux_setgroups16(struct proc *p, struct linux_setgroups16_args *args) else newcred->cr_ngroups = 1; - setsugid(p); - p->p_ucred = newcred; + setsugid(td->td_proc); + td->td_proc->p_ucred = newcred; crfree(oldcred); return (0); } int -linux_getgroups16(struct proc *p, struct linux_getgroups16_args *args) +linux_getgroups16(struct thread *td, struct linux_getgroups16_args *args) { struct ucred *cred; l_gid16_t linux_gidset[NGROUPS]; @@ -150,7 +150,7 @@ linux_getgroups16(struct proc *p, struct linux_getgroups16_args *args) printf(ARGS(getgroups16, "%d, *"), args->gidsetsize); #endif - cred = p->p_ucred; + cred = td->td_proc->p_ucred; bsd_gidset = cred->cr_groups; bsd_gidsetsz = cred->cr_ngroups - 1; @@ -161,7 +161,7 @@ linux_getgroups16(struct proc *p, struct linux_getgroups16_args *args) */ if ((ngrp = args->gidsetsize) == 0) { - p->p_retval[0] = bsd_gidsetsz; + td->td_retval[0] = bsd_gidsetsz; return (0); } @@ -179,12 +179,12 @@ linux_getgroups16(struct proc *p, struct linux_getgroups16_args *args) if (error) return (error); - p->p_retval[0] = ngrp; + td->td_retval[0] = ngrp; return (0); } /* - * The FreeBSD native getgid(2) and getuid(2) also modify p->p_retval[1] + * The FreeBSD native getgid(2) and getuid(2) also modify td->td_retval[1] * when COMPAT_43 or COMPAT_SUNOS is defined. This globbers registers that * are assumed to be preserved. The following lightweight syscalls fixes * this. See also linux_getpid(2), linux_getgid(2) and linux_getuid(2) in @@ -195,91 +195,93 @@ linux_getgroups16(struct proc *p, struct linux_getgroups16_args *args) */ int -linux_getgid16(struct proc *p, struct linux_getgid16_args *args) +linux_getgid16(struct thread *td, struct linux_getgid16_args *args) { - p->p_retval[0] = p->p_ucred->cr_rgid; + + td->td_retval[0] = td->td_proc->p_ucred->cr_rgid; return (0); } int -linux_getuid16(struct proc *p, struct linux_getuid16_args *args) +linux_getuid16(struct thread *td, struct linux_getuid16_args *args) { - p->p_retval[0] = p->p_ucred->cr_ruid; + + td->td_retval[0] = td->td_proc->p_ucred->cr_ruid; return (0); } int -linux_getegid16(struct proc *p, struct linux_getegid16_args *args) +linux_getegid16(struct thread *td, struct linux_getegid16_args *args) { struct getegid_args bsd; - return (getegid(p, &bsd)); + return (getegid(td, &bsd)); } int -linux_geteuid16(struct proc *p, struct linux_geteuid16_args *args) +linux_geteuid16(struct thread *td, struct linux_geteuid16_args *args) { struct geteuid_args bsd; - return (geteuid(p, &bsd)); + return (geteuid(td, &bsd)); } int -linux_setgid16(struct proc *p, struct linux_setgid16_args *args) +linux_setgid16(struct thread *td, struct linux_setgid16_args *args) { struct setgid_args bsd; bsd.gid = args->gid; - return (setgid(p, &bsd)); + return (setgid(td, &bsd)); } int -linux_setuid16(struct proc *p, struct linux_setuid16_args *args) +linux_setuid16(struct thread *td, struct linux_setuid16_args *args) { struct setuid_args bsd; bsd.uid = args->uid; - return (setuid(p, &bsd)); + return (setuid(td, &bsd)); } int -linux_setregid16(struct proc *p, struct linux_setregid16_args *args) +linux_setregid16(struct thread *td, struct linux_setregid16_args *args) { struct setregid_args bsd; bsd.rgid = args->rgid; bsd.egid = args->egid; - return (setregid(p, &bsd)); + return (setregid(td, &bsd)); } int -linux_setreuid16(struct proc *p, struct linux_setreuid16_args *args) +linux_setreuid16(struct thread *td, struct linux_setreuid16_args *args) { struct setreuid_args bsd; bsd.ruid = args->ruid; bsd.euid = args->euid; - return (setreuid(p, &bsd)); + return (setreuid(td, &bsd)); } int -linux_setresgid16(struct proc *p, struct linux_setresgid16_args *args) +linux_setresgid16(struct thread *td, struct linux_setresgid16_args *args) { struct setresgid_args bsd; bsd.rgid = args->rgid; bsd.egid = args->egid; bsd.sgid = args->sgid; - return (setresgid(p, &bsd)); + return (setresgid(td, &bsd)); } int -linux_setresuid16(struct proc *p, struct linux_setresuid16_args *args) +linux_setresuid16(struct thread *td, struct linux_setresuid16_args *args) { struct setresuid_args bsd; bsd.ruid = args->ruid; bsd.euid = args->euid; bsd.suid = args->suid; - return (setresuid(p, &bsd)); + return (setresuid(td, &bsd)); } |