summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2004-06-25 08:41:20 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2004-06-25 08:41:20 +0000
commitb931374cf34889aaeeb87e3d70dd7c41e3d593bf (patch)
tree3ab69a26487321d6af4330d63ced4be9d1993b28
parentdcccc87f9e630f68e565a5746279342b43553c8f (diff)
Instead of accessing ci_dev (that's an MI field), provide a marco that
translates a cpu_info structure into a human-readable cpu number. drahn@ deraadt@ ok
-rw-r--r--sys/arch/i386/include/cpu.h4
-rw-r--r--sys/ddb/db_command.c4
-rw-r--r--sys/kern/kern_sysctl.c4
3 files changed, 7 insertions, 5 deletions
diff --git a/sys/arch/i386/include/cpu.h b/sys/arch/i386/include/cpu.h
index 18da562cd3b..f30153e7487 100644
--- a/sys/arch/i386/include/cpu.h
+++ b/sys/arch/i386/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.64 2004/06/21 23:12:14 art Exp $ */
+/* $OpenBSD: cpu.h,v 1.65 2004/06/25 08:41:19 art Exp $ */
/* $NetBSD: cpu.h,v 1.35 1996/05/05 19:29:26 christos Exp $ */
/*-
@@ -170,6 +170,8 @@ extern struct cpu_info *cpu_info_list;
#define CPU_INFO_FOREACH(cii, ci) cii = 0, ci = cpu_info_list; \
ci != NULL; ci = ci->ci_next
+#define CPU_INFO_UNIT(ci) ((ci)->ci_dev.dv_unit)
+
#ifdef MULTIPROCESSOR
#define I386_MAXPROCS 32 /* because we use a bitmask */
diff --git a/sys/ddb/db_command.c b/sys/ddb/db_command.c
index b47ae3b9ddf..c4ac1ec31d0 100644
--- a/sys/ddb/db_command.c
+++ b/sys/ddb/db_command.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_command.c,v 1.37 2004/06/21 22:41:12 andreas Exp $ */
+/* $OpenBSD: db_command.c,v 1.38 2004/06/25 08:41:19 art Exp $ */
/* $NetBSD: db_command.c,v 1.20 1996/03/30 22:30:05 christos Exp $ */
/*
@@ -523,7 +523,7 @@ db_command_loop()
db_output_line = 0;
#ifdef MULTIPROCESSOR
- db_printf("ddb{%d}> ", curcpu()->ci_dev.dv_unit);
+ db_printf("ddb{%d}> ", CPU_INFO_UNIT(curcpu()));
#else
db_printf("ddb> ");
#endif
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index f79110b8cdd..0a4235942a7 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sysctl.c,v 1.115 2004/06/24 21:00:03 millert Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.116 2004/06/25 08:41:19 art Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@@ -1334,7 +1334,7 @@ fill_kproc2(struct proc *p, struct kinfo_proc2 *ki)
ki->p_cpuid = KI_NOCPU;
#ifdef MULTIPROCESSOR
if (p->p_cpu != NULL)
- ki->p_cpuid = p->p_cpu->ci_dev.dv_unit;
+ ki->p_cpuid = CPU_INFO_UNIT(p->p_cpu);
#endif
PRELE(p);
}