aboutsummaryrefslogtreecommitdiff
path: root/lib/libkvm/kvm_pcpu.c
diff options
context:
space:
mode:
authorUlrich Spörlein <uqs@FreeBSD.org>2011-01-23 11:08:28 +0000
committerUlrich Spörlein <uqs@FreeBSD.org>2011-01-23 11:08:28 +0000
commitc10970dd7d7cd88f4e14743bd56f6bf010c49274 (patch)
treeaffb155452e52759603cd28ea92e941e8e5ab8a0 /lib/libkvm/kvm_pcpu.c
parent9a6a64d3c42a9b9079995ea306b243949b81dfaf (diff)
downloadsrc-c10970dd7d7cd88f4e14743bd56f6bf010c49274.tar.gz
src-c10970dd7d7cd88f4e14743bd56f6bf010c49274.zip
libkvm code janitoring
- make WARNS=6 clean for archs w/o strict alignment requirments - add const, ANSIfy, remove unused vars, cast types for comparison - thanks to differing definitions of VM_MIN_ADDRESS across our archs, we need to trick the compiler to not complain about signedness. We could either fix VM_MIN_ADDRESS to always be a simple integer or make the check conditional on $ARCH. Closes PRs: kern/42386, kern/83364 Reviewed by: bde
Notes
Notes: svn path=/head/; revision=217744
Diffstat (limited to 'lib/libkvm/kvm_pcpu.c')
-rw-r--r--lib/libkvm/kvm_pcpu.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/lib/libkvm/kvm_pcpu.c b/lib/libkvm/kvm_pcpu.c
index d896c4f036e9..fd09fc88fb1c 100644
--- a/lib/libkvm/kvm_pcpu.c
+++ b/lib/libkvm/kvm_pcpu.c
@@ -48,9 +48,9 @@ __FBSDID("$FreeBSD$");
#include "kvm_private.h"
static struct nlist kvm_pcpu_nl[] = {
- { "_cpuid_to_pcpu" },
- { "_mp_maxcpus" },
- { NULL },
+ { .n_name = "_cpuid_to_pcpu" },
+ { .n_name = "_mp_maxcpus" },
+ { .n_name = NULL },
};
/*
@@ -96,7 +96,7 @@ _kvm_pcpu_init(kvm_t *kd)
return (-1);
}
if (kvm_read(kd, kvm_pcpu_nl[NL_CPUID_TO_PCPU].n_value, data, len) !=
- len) {
+ (ssize_t)len) {
_kvm_err(kd, kd->program, "cannot read cpuid_to_pcpu array");
free(data);
return (-1);
@@ -119,7 +119,6 @@ void *
kvm_getpcpu(kvm_t *kd, int cpu)
{
char *buf;
- int i;
if (kd == NULL) {
_kvm_pcpu_clear();
@@ -197,14 +196,14 @@ _kvm_dpcpu_init(kvm_t *kd)
{
struct nlist nl[] = {
#define NLIST_START_SET_PCPU 0
- { "___start_" DPCPU_SETNAME },
+ { .n_name = "___start_" DPCPU_SETNAME },
#define NLIST_STOP_SET_PCPU 1
- { "___stop_" DPCPU_SETNAME },
+ { .n_name = "___stop_" DPCPU_SETNAME },
#define NLIST_DPCPU_OFF 2
- { "_dpcpu_off" },
+ { .n_name = "_dpcpu_off" },
#define NLIST_MP_MAXCPUS 3
- { "_mp_maxcpus" },
- { NULL },
+ { .n_name = "_mp_maxcpus" },
+ { .n_name = NULL },
};
uintptr_t *dpcpu_off_buf;
size_t len;
@@ -225,7 +224,7 @@ _kvm_dpcpu_init(kvm_t *kd)
if (dpcpu_off_buf == NULL)
return (-1);
if (kvm_read(kd, nl[NLIST_DPCPU_OFF].n_value, dpcpu_off_buf, len) !=
- len) {
+ (ssize_t)len) {
free(dpcpu_off_buf);
return (-1);
}