|
From: | Laurent Vivier |
Subject: | Re: [Qemu-trivial] [Qemu-devel] [PULL 0/3] Trivial branch patches |
Date: | Wed, 3 Jul 2019 18:12:51 +0200 |
It seems MacOS X (x86_64) needs a long: #include <stdio.h> #include <sys/types.h> #include <sys/sysctl.h> int main(void) { long size; int ret; size_t len = sizeof(size); ret = sysctlbyname("hw.cachelinesize", &size, &len, NULL, 0); printf("ret %d size 0x%lx\n", ret, size); return 0; } $ cc -o cachesize cachesize.c $ ./cachesize ret 0 size 0x40 #include <stdio.h> #include <sys/types.h> #include <sys/sysctl.h> int main(void) { int size; int ret; size_t len = sizeof(size); ret = sysctlbyname("hw.cachelinesize", &size, &len, NULL, 0); printf("ret %d size 0x%x\n", ret, size); return 0; } $ cc -o cachesize cachesize.c $ ./cachesize ret 0 size 0x1737b1d2 $ sysctl hw.cachelinesize hw.cachelinesize: 64 But man page is not up-to-date: $ uname -r 17.7.0 $ man sysctl SYSCTL(8) BSD System Manager's Manual SYSCTL(8) … The string and integer information is summarized below. For a detailed description of these variable see sysctl(3). The changeable column indicates whether a process with appropriate privi- lege can change the value. String and integer values can be set using sysctl. Name Type Changeable … hw.cachelinesize integer no … In fact, it is in sysctl(3): SYSCTL(3) BSD Library Functions Manual SYSCTL(3) … CTL_HW The string and integer information available for the CTL_HW level is detailed below. The changeable column shows whether a process with appropriate privilege may change the value. Name Type Changeable ... hw.cachelinesize int64_t no I will try to check on MacOS/X ppc and ppc64. Thanks, Laurent |
[Prev in Thread] | Current Thread | [Next in Thread] |