Commit 7344da06e8277f6b06e6df38dc20789c49c42164

Authored by malc
1 parent 06f7332a

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
Showing 1 changed file with 2 additions and 0 deletions
cache-utils.c
... ... @@ -37,6 +37,7 @@ static void ppc_init_cacheline_sizes(char **envp)
37 37 }
38 38  
39 39 #elif defined __APPLE__
  40 +#include <stdio.h>
40 41 #include <sys/types.h>
41 42 #include <sys/sysctl.h>
42 43  
... ... @@ -46,6 +47,7 @@ static void ppc_init_cacheline_sizes(void)
46 47 unsigned cacheline;
47 48 int name[2] = { CTL_HW, HW_CACHELINE };
48 49  
  50 + len = sizeof(cacheline);
49 51 if (sysctl(name, 2, &cacheline, &len, NULL, 0)) {
50 52 perror("sysctl CTL_HW HW_CACHELINE failed");
51 53 } else {
... ...