PERFORCE change 104235 for review

Roman Divacky rdivacky at FreeBSD.org
Wed Aug 16 14:34:27 UTC 2006


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

Change 104235 by rdivacky at rdivacky_witten on 2006/08/16 14:34:20

	Make ssouhlal happy and dont lock/unlock in getpid()/exit_group()

Affected files ...

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

Differences ...

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

@@ -1334,16 +1334,14 @@
    	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"));
-
 	linux_get_osrelease(td, osrel);
-	if (strlen(osrel) >= 3 && osrel[2] == '6')
+	if (strlen(osrel) >= 3 && osrel[2] == '6') {
+   	   	em = em_find(td->td_proc, EMUL_UNLOCKED);
+		KASSERT(em != NULL, ("getpid: emuldata not found.\n"));
    		td->td_retval[0] = em->shared->group_pid;
-	else
+		EMUL_UNLOCK(&emul_lock);
+	} else
    	   	td->td_retval[0] = td->td_proc->p_pid;
-	EMUL_UNLOCK(&emul_lock);
 	return (0);
 }
 
@@ -1475,12 +1473,11 @@
 		printf(ARGS(exit_group, "%i"), args->error_code);
 #endif
 
-	td_em = em_find(td->td_proc, EMUL_UNLOCKED);
-
-	KASSERT(td_em != NULL, ("exit_group: emuldata not found.\n"));
-
 	linux_get_osrelease(td, osrel);
 	if (strlen(osrel) >= 3 && osrel[2] == '6') {
+   	   	td_em = em_find(td->td_proc, EMUL_UNLOCKED);
+
+		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) {
@@ -1496,8 +1493,8 @@
 		}	
 
 		EMUL_SHARED_RUNLOCK(&emul_shared_lock);
+		EMUL_UNLOCK(&emul_lock);
 	}
-	EMUL_UNLOCK(&emul_lock);
 
 	exit1(td, W_EXITCODE(args->error_code,0));
 


More information about the p4-projects mailing list