Author: markj
Date: Mon Apr 25 18:13:21 2016
New Revision: 298588
URL: https://svnweb.freebsd.org/changeset/base/298588

Log:
  MFC r298173:
  Use a loop instead of a goto in sysctl_kern_proc_kstack().

Modified:
  stable/10/sys/kern/kern_proc.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/kern_proc.c
==============================================================================
--- stable/10/sys/kern/kern_proc.c      Mon Apr 25 18:09:36 2016        
(r298587)
+++ stable/10/sys/kern/kern_proc.c      Mon Apr 25 18:13:21 2016        
(r298588)
@@ -2462,10 +2462,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;
@@ -2475,9 +2473,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
@@ -2488,6 +2484,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"));
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to