PERFORCE change 104225 for review
Roman Divacky
rdivacky at FreeBSD.org
Wed Aug 16 14:12:43 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=104225
Change 104225 by rdivacky at 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));
More information about the p4-projects
mailing list