From owner-svn-src-stable@freebsd.org Mon Apr 25 18:13:22 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6A19B1C2F8; Mon, 25 Apr 2016 18:13:22 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 85E1816E0; Mon, 25 Apr 2016 18:13:22 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3PIDLSF057441; Mon, 25 Apr 2016 18:13:21 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3PIDLrP057440; Mon, 25 Apr 2016 18:13:21 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201604251813.u3PIDLrP057440@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 25 Apr 2016 18:13:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298588 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Apr 2016 18:13:22 -0000 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"));