Date: Thu, 17 Jul 2008 13:30:43 GMT From: Ed Schouten <ed@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 145362 for review Message-ID: <200807171330.m6HDUh8r058837@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=145362 Change 145362 by ed@ed_dull on 2008/07/17 13:30:21 Revert the changes to pgfind(). We should fix this somewhere in the far future, if we would decompose proctree_lock. Affected files ... .. //depot/projects/mpsafetty/share/man/man9/Makefile#2 edit .. //depot/projects/mpsafetty/share/man/man9/pgfind.9#2 edit .. //depot/projects/mpsafetty/sys/kern/kern_proc.c#2 edit .. //depot/projects/mpsafetty/sys/kern/tty.c#3 edit Differences ... ==== //depot/projects/mpsafetty/share/man/man9/Makefile#2 (text+ko) ==== @@ -884,7 +884,6 @@ pfil.9 pfil_hook_get.9 \ pfil.9 pfil_remove_hook.9 MLINKS+=pfind.9 zpfind.9 -MLINKS+=pgfind.9 pgfind_unlocked.9 MLINKS+=pmap_clear_modify.9 pmap_clear_reference.9 MLINKS+=pmap_copy.9 pmap_copy_page.9 MLINKS+=pmap_extract.9 pmap_extract_and_hold.9 ==== //depot/projects/mpsafetty/share/man/man9/pgfind.9#2 (text+ko) ==== @@ -35,8 +35,6 @@ .In sys/proc.h .Ft "struct pgrp *" .Fn pgfind "pid_t pgid" -.Ft "struct pgrp *" -.Fn pgfind_unlocked "pid_t pgid" .Sh DESCRIPTION The .Fn pgfind @@ -51,9 +49,7 @@ .Fn pgfind locks the .Vt pgrp -structure that is returned, while -.Fn pgfind_unlocked -does not. +structure that is returned. .Sh RETURN VALUES The .Fn pgfind ==== //depot/projects/mpsafetty/sys/kern/kern_proc.c#2 (text+ko) ==== @@ -301,7 +301,7 @@ * The caller must hold proctree_lock. */ struct pgrp * -pgfind_unlocked(pgid) +pgfind(pgid) register pid_t pgid; { register struct pgrp *pgrp; @@ -309,30 +309,15 @@ sx_assert(&proctree_lock, SX_LOCKED); LIST_FOREACH(pgrp, PGRPHASH(pgid), pg_hash) { - if (pgrp->pg_id == pgid) + if (pgrp->pg_id == pgid) { + PGRP_LOCK(pgrp); return (pgrp); + } } return (NULL); } /* - * Same as pgfind_unlocked(), but acquires the lock on the process - * group. - */ -struct pgrp * -pgfind(pgid) - register pid_t pgid; -{ - register struct pgrp *pgrp; - - pgrp = pgfind_unlocked(pgid); - if (pgrp != NULL) - PGRP_LOCK(pgrp); - - return (pgrp); -} - -/* * Create a new process group. * pgid must be equal to the pid of p. * Begin a new session if required. ==== //depot/projects/mpsafetty/sys/kern/tty.c#3 (text+ko) ==== @@ -1438,12 +1438,15 @@ struct pgrp *pg; /* - * Temporarily unlock the TTY to locate the process - * group. + * XXX: Temporarily unlock the TTY to locate the process + * group. This code would be lot nicer if we would ever + * decompose proctree_lock. */ tty_unlock(tp); sx_slock(&proctree_lock); - pg = pgfind_unlocked(*(int *)data); + pg = pgfind(*(int *)data); + if (pg != NULL) + PGRP_UNLOCK(pg); if (pg == NULL || pg->pg_session != td->td_proc->p_session) { sx_sunlock(&proctree_lock); tty_lock(tp);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200807171330.m6HDUh8r058837>