Date: Wed, 16 Aug 2006 16:44:33 GMT From: Roman Divacky <rdivacky@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 104259 for review Message-ID: <200608161644.k7GGiXqw088955@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=104259 Change 104259 by rdivacky@rdivacky_witten on 2006/08/16 16:44:09 Lock proc and rework getppid(). Affected files ... .. //depot/projects/soc2006/rdivacky_linuxolator/compat/linux/linux_misc.c#20 edit Differences ... ==== //depot/projects/soc2006/rdivacky_linuxolator/compat/linux/linux_misc.c#20 (text+ko) ==== @@ -1340,8 +1340,11 @@ KASSERT(em != NULL, ("getpid: emuldata not found.\n")); td->td_retval[0] = em->shared->group_pid; EMUL_UNLOCK(&emul_lock); - } else + } else { + PROC_LOCK(td->td_proc); td->td_retval[0] = td->td_proc->p_pid; + PROC_UNLOCK(td->td_proc); + } return (0); } @@ -1365,6 +1368,14 @@ struct proc *p, *pp; char osrel[LINUX_MAX_UTSNAME]; + linux_get_osrelease(td, osrel); + if (strlen(osrel) >= 3 && osrel[2] != '6') { + PROC_LOCK(td->td_proc); + td->td_retval[0] = td->td_proc->p_pptr->p_pid; + PROC_UNLOCK(td->td_proc); + return (0); + } + em = em_find(td->td_proc, EMUL_UNLOCKED); KASSERT(em != NULL, ("getppid: process emuldata not found.\n")); @@ -1388,11 +1399,7 @@ em = em_find(pp, EMUL_LOCKED); KASSERT(em != NULL, ("getppid: parent emuldata not found.\n")); - linux_get_osrelease(td, osrel); - if (strlen(osrel) >= 3 && osrel[2] == '6') - td->td_retval[0] = em->shared->group_pid; - else - td->td_retval[0] = td->td_proc->p_pptr->p_pid; + td->td_retval[0] = em->shared->group_pid; } else td->td_retval[0] = pp->p_pid;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200608161644.k7GGiXqw088955>