svn commit: r362707 - head/bin/ps
Piotr Pawel Stefaniak
pstef at FreeBSD.org
Sat Jun 27 20:01:57 UTC 2020
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
More information about the svn-src-all
mailing list