mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-27 04:53:28 +00:00
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
54c41bc6a6
commit
448036945e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=169838
@ -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