diff options
author | markj <markj@FreeBSD.org> | 2016-04-25 18:13:21 +0000 |
---|---|---|
committer | markj <markj@FreeBSD.org> | 2016-04-25 18:13:21 +0000 |
commit | 534aa815190e9a7eb98fc46705ee736c692d076a (patch) | |
tree | 1c9e2ebcc777bd81c4563edab84d877f305a5abf | |
parent | 67321eda44f5579f23bcabe670cde32924ecb15e (diff) | |
download | FreeBSD-src-534aa815190e9a7eb98fc46705ee736c692d076a.zip FreeBSD-src-534aa815190e9a7eb98fc46705ee736c692d076a.tar.gz |
MFC r298173:
Use a loop instead of a goto in sysctl_kern_proc_kstack().
-rw-r--r-- | sys/kern/kern_proc.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index e45fc99..ac375a4 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -2462,10 +2462,8 @@ sysctl_kern_proc_kstack(SYSCTL_HANDLER_ARGS) 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")); |