aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorPiotr Pawel Stefaniak <pstef@FreeBSD.org>2020-06-27 20:01:56 +0000
committerPiotr Pawel Stefaniak <pstef@FreeBSD.org>2020-06-27 20:01:56 +0000
commitac4b8a1ce45ae5f1da70132d697908afff2a581c (patch)
treed4cd2da1d3f55378b96b1109b066f9cc38eeb7aa /bin
parent557905569dc5d15cc51bec20e72ebd4f61a91b81 (diff)
downloadsrc-ac4b8a1ce45ae5f1da70132d697908afff2a581c.tar.gz
src-ac4b8a1ce45ae5f1da70132d697908afff2a581c.zip
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
Notes
Notes: svn path=/head/; revision=362707
Diffstat (limited to 'bin')
-rw-r--r--bin/ps/extern.h2
-rw-r--r--bin/ps/print.c3
-rw-r--r--bin/ps/ps.c15
3 files changed, 1 insertions, 19 deletions
diff --git a/bin/ps/extern.h b/bin/ps/extern.h
index 2e72632b6542..723d7fcb85dd 100644
--- a/bin/ps/extern.h
+++ b/bin/ps/extern.h
@@ -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
diff --git a/bin/ps/print.c b/bin/ps/print.c
index d137056aa580..b4458b453cdd 100644
--- a/bin/ps/print.c
+++ b/bin/ps/print.c
@@ -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 {
diff --git a/bin/ps/ps.c b/bin/ps/ps.c
index 0bc388c25260..f6d32e5411fe 100644
--- a/bin/ps/ps.c
+++ b/bin/ps/ps.c
@@ -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;
@@ -1459,18 +1456,6 @@ pidmax_init(void)
}
}
-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
usage(void)
{