From owner-svn-src-head@freebsd.org Sat Jun 27 20:01:57 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5D00A35B32B; Sat, 27 Jun 2020 20:01:57 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49vPm51qnSz4NvS; Sat, 27 Jun 2020 20:01:57 +0000 (UTC) (envelope-from pstef@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1FEFFA7E5; Sat, 27 Jun 2020 20:01:57 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05RK1v0H085551; Sat, 27 Jun 2020 20:01:57 GMT (envelope-from pstef@FreeBSD.org) Received: (from pstef@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05RK1uHk085549; Sat, 27 Jun 2020 20:01:56 GMT (envelope-from pstef@FreeBSD.org) Message-Id: <202006272001.05RK1uHk085549@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pstef set sender to pstef@FreeBSD.org using -f From: Piotr Pawel Stefaniak Date: Sat, 27 Jun 2020 20:01:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362707 - head/bin/ps X-SVN-Group: head X-SVN-Commit-Author: pstef X-SVN-Commit-Paths: head/bin/ps X-SVN-Commit-Revision: 362707 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Jun 2020 20:01:57 -0000 Author: pstef Date: Sat Jun 27 20:01:56 2020 New Revision: 362707 URL: https://svnweb.freebsd.org/changeset/base/362707 Log: ps(1): don't try to handle non-SMP systems As reported by kib, sysctl machdep.smp_active doesn't exist and on UP we return CPU 0 for all threads anyway. Reported by: kib Modified: head/bin/ps/extern.h head/bin/ps/print.c head/bin/ps/ps.c Modified: head/bin/ps/extern.h ============================================================================== --- head/bin/ps/extern.h Sat Jun 27 19:29:07 2020 (r362706) +++ head/bin/ps/extern.h Sat Jun 27 20:01:56 2020 (r362707) @@ -41,7 +41,7 @@ extern fixpt_t ccpu; extern int cflag, eval, fscale, nlistread, rawcpu; extern unsigned long mempages; extern time_t now; -extern int showthreads, sumrusage, termwidth, smp; +extern int showthreads, sumrusage, termwidth; extern STAILQ_HEAD(velisthead, varent) varlist; __BEGIN_DECLS Modified: head/bin/ps/print.c ============================================================================== --- head/bin/ps/print.c Sat Jun 27 19:29:07 2020 (r362706) +++ head/bin/ps/print.c Sat Jun 27 20:01:56 2020 (r362707) @@ -555,9 +555,6 @@ cpunum(KINFO *k, VARENT *ve __unused) { char *cpu; - if (!smp) - return (NULL); - if (k->ki_p->ki_stat == SRUN && k->ki_p->ki_oncpu != NOCPU) { asprintf(&cpu, "%d", k->ki_p->ki_oncpu); } else { Modified: head/bin/ps/ps.c ============================================================================== --- head/bin/ps/ps.c Sat Jun 27 19:29:07 2020 (r362706) +++ head/bin/ps/ps.c Sat Jun 27 20:01:56 2020 (r362707) @@ -105,7 +105,6 @@ int rawcpu; /* -C */ int sumrusage; /* -S */ int termwidth; /* Width of the screen (0 == infinity). */ int showthreads; /* will threads be shown? */ -int smp; /* multi-processor support */ struct velisthead varlist = STAILQ_HEAD_INITIALIZER(varlist); @@ -158,7 +157,6 @@ static void saveuser(KINFO *); static void scanvars(void); static void sizevars(void); static void pidmax_init(void); -static void smp_init(void); static void usage(void); static char dfmt[] = "pid,tt,state,time,command"; @@ -228,7 +226,6 @@ main(int argc, char *argv[]) argv[1] = kludge_oldps_options(PS_ARGS, argv[1], argv[2]); pidmax_init(); - smp_init(); all = descendancy = _fmt = nselectors = optfatal = 0; prtheader = showthreads = wflag = xkeep_implied = 0; @@ -1457,18 +1454,6 @@ pidmax_init(void) xo_warn("unable to read kern.pid_max"); pid_max = 99999; } -} - -static void -smp_init(void) -{ - size_t size; - - size = sizeof(smp); - if ((sysctlbyname("machdep.smp_active", &smp, &size, NULL, 0) != 0 && - sysctlbyname("kern.smp.active", &smp, &size, NULL, 0) != 0) || - size != sizeof(smp)) - smp = 0; } static void __dead2