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:
malc 2009-02-04 20:39:09 +00:00
parent 06f7332ab9
commit 7344da06e8

View File

@ -37,6 +37,7 @@ static void ppc_init_cacheline_sizes(char **envp)
}
#elif defined __APPLE__
#include <stdio.h>
#include <sys/types.h>
#include <sys/sysctl.h>
@ -46,6 +47,7 @@ static void ppc_init_cacheline_sizes(void)
unsigned cacheline;
int name[2] = { CTL_HW, HW_CACHELINE };
len = sizeof(cacheline);
if (sysctl(name, 2, &cacheline, &len, NULL, 0)) {
perror("sysctl CTL_HW HW_CACHELINE failed");
} else {