Properly initialize len argument of sysctl and include stdio.h (perror)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6517 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
06f7332ab9
commit
7344da06e8
@ -37,6 +37,7 @@ static void ppc_init_cacheline_sizes(char **envp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#elif defined __APPLE__
|
#elif defined __APPLE__
|
||||||
|
#include <stdio.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
|
|
||||||
@ -46,6 +47,7 @@ static void ppc_init_cacheline_sizes(void)
|
|||||||
unsigned cacheline;
|
unsigned cacheline;
|
||||||
int name[2] = { CTL_HW, HW_CACHELINE };
|
int name[2] = { CTL_HW, HW_CACHELINE };
|
||||||
|
|
||||||
|
len = sizeof(cacheline);
|
||||||
if (sysctl(name, 2, &cacheline, &len, NULL, 0)) {
|
if (sysctl(name, 2, &cacheline, &len, NULL, 0)) {
|
||||||
perror("sysctl CTL_HW HW_CACHELINE failed");
|
perror("sysctl CTL_HW HW_CACHELINE failed");
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user