diff options
author | des <des@FreeBSD.org> | 2003-08-04 10:55:22 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2003-08-04 10:55:22 +0000 |
commit | f907274e332225cf9bc363a2b303492043126de5 (patch) | |
tree | 3b7287be294250b6421c27fed000ba64bb7862bd | |
parent | 01818123675239aeb601925ab51a70266ff164c2 (diff) | |
download | FreeBSD-src-f907274e332225cf9bc363a2b303492043126de5.zip FreeBSD-src-f907274e332225cf9bc363a2b303492043126de5.tar.gz |
Add support for multiple CPUs to cpuinfo.
-rw-r--r-- | sys/compat/linprocfs/linprocfs.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c index da3530b..201a9fc 100644 --- a/sys/compat/linprocfs/linprocfs.c +++ b/sys/compat/linprocfs/linprocfs.c @@ -253,7 +253,14 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) static int linprocfs_docpuinfo(PFS_FILL_ARGS) { - int class, i, fqmhz, fqkhz; + int class, fqmhz, fqkhz, ncpu; + int name[2], olen, plen; + int i; + + name[0] = CTL_HW; + name[1] = HW_NCPU; + if (kernel_sysctl(td, name, 2, &ncpu, &olen, NULL, 0, &plen) != 0) + ncpu = 1; /* * We default the flags to include all non-conflicting flags, @@ -290,13 +297,16 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) break; } - sbuf_printf(sb, - "processor\t: %d\n" - "vendor_id\t: %.20s\n" - "cpu family\t: %d\n" - "model\t\t: %d\n" - "stepping\t: %d\n", - 0, cpu_vendor, class, cpu, cpu_id & 0xf); + for (i = 0; i < ncpu; ++i) { + sbuf_printf(sb, + "processor\t: %d\n" + "vendor_id\t: %.20s\n" + "cpu family\t: %d\n" + "model\t\t: %d\n" + "stepping\t: %d\n", + i, cpu_vendor, class, cpu, cpu_id & 0xf); + /* XXX per-cpu vendor / class / id? */ + } sbuf_cat(sb, "flags\t\t:"); |