summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2006-03-06 21:51:27 +0000
committersam <sam@FreeBSD.org>2006-03-06 21:51:27 +0000
commitcb3143e5c0bd9a1a6abf4bf5e694a4afe98b39f8 (patch)
tree44c46562c47782060305cdc28ed0003eef5f27f1 /tools
parentb4c5beef93c8afb096cbd9aea3f5d6a14a2c227b (diff)
downloadFreeBSD-src-cb3143e5c0bd9a1a6abf4bf5e694a4afe98b39f8.zip
FreeBSD-src-cb3143e5c0bd9a1a6abf4bf5e694a4afe98b39f8.tar.gz
fixups
Submitted by: ru MFC after: 3 days
Diffstat (limited to 'tools')
-rw-r--r--tools/tools/ncpus/Makefile3
-rw-r--r--tools/tools/ncpus/acpi.c7
-rw-r--r--tools/tools/ncpus/biosmptable.c23
-rw-r--r--tools/tools/ncpus/ncpus.c2
4 files changed, 19 insertions, 16 deletions
diff --git a/tools/tools/ncpus/Makefile b/tools/tools/ncpus/Makefile
index ccbc8f5..1852296 100644
--- a/tools/tools/ncpus/Makefile
+++ b/tools/tools/ncpus/Makefile
@@ -1,12 +1,13 @@
# $FreeBSD$
PROG= ncpus
+NO_MAN=
SRCS= ncpus.c acpi.c
.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"
SRCS+= biosmptable.c
.endif
-NO_MAN= noman
BINDIR= /usr/local/bin
+WARNS?= 6
DPADD= ${LIBDEVINFO}
LDADD= -ldevinfo
diff --git a/tools/tools/ncpus/acpi.c b/tools/tools/ncpus/acpi.c
index 9ea2d13..88ec6fc 100644
--- a/tools/tools/ncpus/acpi.c
+++ b/tools/tools/ncpus/acpi.c
@@ -38,6 +38,7 @@
#include <err.h>
#include <fcntl.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <paths.h>
@@ -56,11 +57,7 @@ static int addr_size;
static int ncpu;
-static int
-max(int a, int b)
-{
- return a < b ? b : a;
-}
+int acpi_detect(void);
static void
acpi_handle_apic(struct ACPIsdt *sdp)
diff --git a/tools/tools/ncpus/biosmptable.c b/tools/tools/ncpus/biosmptable.c
index da48700..398d0e4 100644
--- a/tools/tools/ncpus/biosmptable.c
+++ b/tools/tools/ncpus/biosmptable.c
@@ -33,12 +33,16 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include <unistd.h>
+#include <sys/types.h>
+#include <machine/mptable.h>
+
+#include <err.h>
#include <fcntl.h>
+#include <inttypes.h>
#include <paths.h>
-#include <err.h>
-
-#include <machine/mptable.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
#define MPFPS_SIG "_MP_"
#define MPCTH_SIG "PCMP"
@@ -52,12 +56,13 @@ static mpcth_t biosmptable_check_mpcth(off_t addr);
static int memopen(void);
static void memclose(void);
+int biosmptable_detect(void);
+
int
biosmptable_detect(void)
{
mpfps_t mpfps;
mpcth_t mpcth;
- char buf[16];
char *entry_type_p;
proc_entry_ptr proc;
int ncpu, i;
@@ -145,8 +150,8 @@ memclose(void)
static int
memread(off_t addr, void* entry, size_t size)
{
- if (pread(pfd, entry, size, addr) != size) {
- warn("pread (%lu @ 0x%lx)", size, addr);
+ if ((size_t)pread(pfd, entry, size, addr) != size) {
+ warn("pread (%zu @ 0x%jx)", size, (intmax_t)addr);
return 0;
}
return 1;
@@ -225,7 +230,7 @@ biosmptable_check_mpcth(off_t addr)
/* mpcth must be in the first 1MB */
if ((u_int32_t)addr >= 1024 * 1024) {
- warnx("bad mpcth address (0x%lx)\n", addr);
+ warnx("bad mpcth address (0x%jx)\n", (intmax_t)addr);
return (NULL);
}
@@ -242,7 +247,7 @@ biosmptable_check_mpcth(off_t addr)
goto bad;
}
table_length = mpcth->base_table_length;
- mpcth = (mpcth_t) realloc(mpcth, table_length);
+ mpcth = realloc(mpcth, table_length);
if (mpcth == NULL) {
warnx("unable to realloc space for mpcth (len %u)", table_length);
return (NULL);
diff --git a/tools/tools/ncpus/ncpus.c b/tools/tools/ncpus/ncpus.c
index 7c051a6..0f4498f 100644
--- a/tools/tools/ncpus/ncpus.c
+++ b/tools/tools/ncpus/ncpus.c
@@ -6,7 +6,7 @@ extern int acpi_detect(void);
extern int biosmptable_detect(void);
int
-main(int argc, char *argv[])
+main(void)
{
printf("acpi: %d\n", acpi_detect());
#if defined(__amd64__) || defined(__i386__)
OpenPOWER on IntegriCloud