From owner-p4-projects@FreeBSD.ORG Wed Aug 16 14:12:43 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 7420416A505; Wed, 16 Aug 2006 14:12:43 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1D3A816A4E8 for ; Wed, 16 Aug 2006 14:12:43 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id AAD2243D46 for ; Wed, 16 Aug 2006 14:12:42 +0000 (GMT) (envelope-from rdivacky@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k7GECgeZ073352 for ; Wed, 16 Aug 2006 14:12:42 GMT (envelope-from rdivacky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k7GECg5V073349 for perforce@freebsd.org; Wed, 16 Aug 2006 14:12:42 GMT (envelope-from rdivacky@FreeBSD.org) Date: Wed, 16 Aug 2006 14:12:42 GMT Message-Id: <200608161412.k7GECg5V073349@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to rdivacky@FreeBSD.org using -f From: Roman Divacky To: Perforce Change Reviews Cc: Subject: PERFORCE change 104225 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2006 14:12:43 -0000 http://perforce.freebsd.org/chv.cgi?CH=104225 Change 104225 by rdivacky@rdivacky_witten on 2006/08/16 14:12:23 Let 2.4.x emulation work. My assumption that its ok to let getpid/getppid/exit_group as it is was false. Affected files ... .. //depot/projects/soc2006/rdivacky_linuxolator/compat/linux/linux_misc.c#15 edit Differences ... ==== //depot/projects/soc2006/rdivacky_linuxolator/compat/linux/linux_misc.c#15 (text+ko) ==== @@ -1332,12 +1332,17 @@ linux_getpid(struct thread *td, struct linux_getpid_args *args) { struct linux_emuldata *em; + char osrel[LINUX_MAX_UTSNAME]; em = em_find(td->td_proc, EMUL_UNLOCKED); KASSERT(em != NULL, ("getpid: emuldata not found.\n")); - td->td_retval[0] = em->shared->group_pid; + 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_pid; EMUL_UNLOCK(&emul_lock); return (0); } @@ -1360,6 +1365,7 @@ { struct linux_emuldata *em; struct proc *p, *pp; + char osrel[LINUX_MAX_UTSNAME]; em = em_find(td->td_proc, EMUL_UNLOCKED); @@ -1384,7 +1390,12 @@ em = em_find(pp, EMUL_LOCKED); KASSERT(em != NULL, ("getppid: parent emuldata not found.\n")); - td->td_retval[0] = em->shared->group_pid; + 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] = pp->p_pid; + printf("getppid: group_pid: %i\n, pid: %i\n", pp->p_pid, em->shared->group_pid); } else td->td_retval[0] = pp->p_pid; @@ -1458,6 +1469,7 @@ { struct linux_emuldata *em, *td_em, *tmp_em; struct proc *sp; + char osrel[LINUX_MAX_UTSNAME]; #ifdef DEBUG if (ldebug(exit_group)) @@ -1468,20 +1480,25 @@ KASSERT(td_em != NULL, ("exit_group: emuldata not found.\n")); - EMUL_SHARED_RLOCK(&emul_shared_lock); - LIST_FOREACH_SAFE(em, &td_em->shared->threads, threads, tmp_em) { - if (em->pid == td_em->pid) - continue; + linux_get_osrelease(td, osrel); + if (strlen(osrel) >= 3 && osrel[2] == '6') { + + EMUL_SHARED_RLOCK(&emul_shared_lock); + LIST_FOREACH_SAFE(em, &td_em->shared->threads, threads, tmp_em) { + printf("em->pid: %i, td_em->pid: %i\n", em->pid, td_em->pid); + if (em->pid == td_em->pid) + continue; - sp = pfind(em->pid); - psignal(sp, SIGKILL); - PROC_UNLOCK(sp); + sp = pfind(em->pid); + psignal(sp, SIGKILL); + PROC_UNLOCK(sp); #ifdef DEBUG - printf(LMSG("linux_sys_exit_group: kill PID %d\n"), em->pid); + printf(LMSG("linux_sys_exit_group: kill PID %d\n"), em->pid); #endif + } + + EMUL_SHARED_RUNLOCK(&emul_shared_lock); } - - EMUL_SHARED_RUNLOCK(&emul_shared_lock); EMUL_UNLOCK(&emul_lock); exit1(td, W_EXITCODE(args->error_code,0));