summaryrefslogtreecommitdiffstats
path: root/lib/libmemstat
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2007-05-21 18:16:04 +0000
committerrwatson <rwatson@FreeBSD.org>2007-05-21 18:16:04 +0000
commit843ae548c7b8a408c56e2456522b876cedfa1d63 (patch)
treea46b834ae689c480210519130b1dc74449939cea /lib/libmemstat
parent85d6f8f56c91eb0760c341f8e373192e1a192a66 (diff)
downloadFreeBSD-src-843ae548c7b8a408c56e2456522b876cedfa1d63.zip
FreeBSD-src-843ae548c7b8a408c56e2456522b876cedfa1d63.tar.gz
Make pointer argument to kread_string() const since the kernel structure
field is const, and then employ __DECONST before getting into the kvm code. This eliminates a gcc 4.2 warning about losing constification. __DECONST advice from: sam
Diffstat (limited to 'lib/libmemstat')
-rw-r--r--lib/libmemstat/memstat_malloc.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libmemstat/memstat_malloc.c b/lib/libmemstat/memstat_malloc.c
index b9b686f..70320f5 100644
--- a/lib/libmemstat/memstat_malloc.c
+++ b/lib/libmemstat/memstat_malloc.c
@@ -26,6 +26,7 @@
* $FreeBSD$
*/
+#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/malloc.h>
#include <sys/sysctl.h>
@@ -253,14 +254,14 @@ kread(kvm_t *kvm, void *kvm_pointer, void *address, size_t size,
}
static int
-kread_string(kvm_t *kvm, void *kvm_pointer, char *buffer, int buflen)
+kread_string(kvm_t *kvm, const void *kvm_pointer, char *buffer, int buflen)
{
ssize_t ret;
int i;
for (i = 0; i < buflen; i++) {
- ret = kvm_read(kvm, (unsigned long)kvm_pointer + i,
- &(buffer[i]), sizeof(char));
+ ret = kvm_read(kvm, __DECONST(unsigned long, kvm_pointer) +
+ i, &(buffer[i]), sizeof(char));
if (ret < 0)
return (MEMSTAT_ERROR_KVM);
if ((size_t)ret != sizeof(char))
OpenPOWER on IntegriCloud