diff options
author | trasz <trasz@FreeBSD.org> | 2011-03-03 17:33:22 +0000 |
---|---|---|
committer | trasz <trasz@FreeBSD.org> | 2011-03-03 17:33:22 +0000 |
commit | 758a56db9597c4366aee6b6a2d4aeba2ef5f1cef (patch) | |
tree | 649c06fda7740b20b65213b2e7d1d717e3fdeebe /sys/kern/tty_pts.c | |
parent | 26db4c6ff3383f8642521bcc3fc4d640035ed0b3 (diff) | |
download | FreeBSD-src-758a56db9597c4366aee6b6a2d4aeba2ef5f1cef.zip FreeBSD-src-758a56db9597c4366aee6b6a2d4aeba2ef5f1cef.tar.gz |
Make "struct pts_softc" point to ucred instead of uidinfo. This is no-op,
required for resource containers.
Reviewed by: kib (as part of a larger patch), ed
Diffstat (limited to 'sys/kern/tty_pts.c')
-rw-r--r-- | sys/kern/tty_pts.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/sys/kern/tty_pts.c b/sys/kern/tty_pts.c index 51f2641..afbef1f 100644 --- a/sys/kern/tty_pts.c +++ b/sys/kern/tty_pts.c @@ -97,7 +97,7 @@ struct pts_softc { struct cdev *pts_cdev; /* (c) Master device node. */ #endif /* PTS_EXTERNAL */ - struct uidinfo *pts_uidinfo; /* (c) Resource limit. */ + struct ucred *pts_cred; /* (c) Resource limit. */ }; /* @@ -681,8 +681,8 @@ ptsdrv_free(void *softc) if (psc->pts_unit >= 0) free_unr(pts_pool, psc->pts_unit); - chgptscnt(psc->pts_uidinfo, -1, 0); - uifree(psc->pts_uidinfo); + chgptscnt(psc->pts_cred->cr_ruidinfo, -1, 0); + crfree(psc->pts_cred); knlist_destroy(&psc->pts_inpoll.si_note); knlist_destroy(&psc->pts_outpoll.si_note); @@ -716,11 +716,11 @@ pts_alloc(int fflags, struct thread *td, struct file *fp) struct tty *tp; struct pts_softc *psc; struct proc *p = td->td_proc; - struct uidinfo *uid = td->td_ucred->cr_ruidinfo; + struct ucred *cred = td->td_ucred; /* Resource limiting. */ PROC_LOCK(p); - ok = chgptscnt(uid, 1, lim_cur(p, RLIMIT_NPTS)); + ok = chgptscnt(cred->cr_ruidinfo, 1, lim_cur(p, RLIMIT_NPTS)); PROC_UNLOCK(p); if (!ok) return (EAGAIN); @@ -728,7 +728,7 @@ pts_alloc(int fflags, struct thread *td, struct file *fp) /* Try to allocate a new pts unit number. */ unit = alloc_unr(pts_pool); if (unit < 0) { - chgptscnt(uid, -1, 0); + chgptscnt(cred->cr_ruidinfo, -1, 0); return (EAGAIN); } @@ -738,8 +738,7 @@ pts_alloc(int fflags, struct thread *td, struct file *fp) cv_init(&psc->pts_outwait, "ptsout"); psc->pts_unit = unit; - psc->pts_uidinfo = uid; - uihold(uid); + psc->pts_cred = crhold(cred); tp = tty_alloc(&pts_class, psc); knlist_init_mtx(&psc->pts_inpoll.si_note, tp->t_mtx); @@ -762,11 +761,11 @@ pts_alloc_external(int fflags, struct thread *td, struct file *fp, struct tty *tp; struct pts_softc *psc; struct proc *p = td->td_proc; - struct uidinfo *uid = td->td_ucred->cr_ruidinfo; + struct ucred *cred = td->td_ucred; /* Resource limiting. */ PROC_LOCK(p); - ok = chgptscnt(uid, 1, lim_cur(p, RLIMIT_NPTS)); + ok = chgptscnt(cred->cr_ruidinfo, 1, lim_cur(p, RLIMIT_NPTS)); PROC_UNLOCK(p); if (!ok) return (EAGAIN); @@ -778,8 +777,7 @@ pts_alloc_external(int fflags, struct thread *td, struct file *fp, psc->pts_unit = -1; psc->pts_cdev = dev; - psc->pts_uidinfo = uid; - uihold(uid); + psc->pts_cred = crhold(cred); tp = tty_alloc(&pts_class, psc); knlist_init_mtx(&psc->pts_inpoll.si_note, tp->t_mtx); |