PERFORCE change 102642 for review

Roman Divacky rdivacky at FreeBSD.org
Fri Jul 28 11:09:19 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=102642

Change 102642 by rdivacky at rdivacky_witten on 2006/07/28 11:08:20

	Fix the linux_getppid() to not panic immediately.

Affected files ...

.. //depot/projects/soc2006/rdivacky_linuxolator/compat/linux/linux_misc.c#5 edit

Differences ...

==== //depot/projects/soc2006/rdivacky_linuxolator/compat/linux/linux_misc.c#5 (text+ko) ====

@@ -1330,8 +1330,6 @@
  * linux_getuid() - MP SAFE
  */
 
-/* XXX: getppid must be changed too */
-
 int
 linux_getpid(struct thread *td, struct linux_getpid_args *args)
 {
@@ -1382,20 +1380,20 @@
 	PROC_LOCK(pp);
 	PROC_UNLOCK(p);
 
-	em = em_find(pp->p_pid, EMUL_UNLOCKED);
-
-	if (em == NULL) {
+	/* if its also linux process */
+	if (pp->p_sysent == &elf_linux_sysvec) {
+   	   	em = em_find(pp->p_pid, EMUL_LOCKED);
+   		if (em == NULL) {
+   		   	printf("this happens!\n");
 #ifdef	DEBUG
-		printf(LMSG("emuldata not found.\n"));
+			printf(LMSG("emuldata not found.\n"));
 #endif
-		EMUL_RUNLOCK(&emul_lock);
-		return (0);
-	}
-
-	/* if its also linux process */
-	if (pp->p_sysent == &elf_linux_sysvec)
+			PROC_UNLOCK(pp);
+			EMUL_RUNLOCK(&emul_lock);
+			return (0);
+		}
 	   	td->td_retval[0] = em->shared->group_pid;
-	else
+	} else
 	   	td->td_retval[0] = pp->p_pid;
 
 	EMUL_RUNLOCK(&emul_lock);


More information about the p4-projects mailing list