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
This commit is contained in:
parent
85d6f8f56c
commit
843ae548c7
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user