svn commit: r298173 - head/sys/kern

Mark Johnston markj at FreeBSD.org
Sun Apr 17 23:22:34 UTC 2016


Author: markj
Date: Sun Apr 17 23:22:32 2016
New Revision: 298173
URL: https://svnweb.freebsd.org/changeset/base/298173

Log:
  Use a loop instead of a goto in sysctl_kern_proc_kstack().
  
  MFC after:	3 days

Modified:
  head/sys/kern/kern_proc.c

Modified: head/sys/kern/kern_proc.c
==============================================================================
--- head/sys/kern/kern_proc.c	Sun Apr 17 23:10:09 2016	(r298172)
+++ head/sys/kern/kern_proc.c	Sun Apr 17 23:22:32 2016	(r298173)
@@ -2534,10 +2534,8 @@ sysctl_kern_proc_kstack(SYSCTL_HANDLER_A
 	st = stack_create();
 
 	lwpidarray = NULL;
-	numthreads = 0;
 	PROC_LOCK(p);
-repeat:
-	if (numthreads < p->p_numthreads) {
+	do {
 		if (lwpidarray != NULL) {
 			free(lwpidarray, M_TEMP);
 			lwpidarray = NULL;
@@ -2547,9 +2545,7 @@ repeat:
 		lwpidarray = malloc(sizeof(*lwpidarray) * numthreads, M_TEMP,
 		    M_WAITOK | M_ZERO);
 		PROC_LOCK(p);
-		goto repeat;
-	}
-	i = 0;
+	} while (numthreads < p->p_numthreads);
 
 	/*
 	 * XXXRW: During the below loop, execve(2) and countless other sorts
@@ -2560,6 +2556,7 @@ repeat:
 	 * have changed, in which case the right to extract debug info might
 	 * no longer be assured.
 	 */
+	i = 0;
 	FOREACH_THREAD_IN_PROC(p, td) {
 		KASSERT(i < numthreads,
 		    ("sysctl_kern_proc_kstack: numthreads"));


More information about the svn-src-head mailing list