mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-28 07:18:30 +00:00
Simplify memory manager
This commit is contained in:
parent
5a9a08d1cf
commit
01587de761
40 changed files with 451 additions and 311 deletions
|
@ -17,14 +17,21 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/dce.h"
|
||||
#include "libc/nt/struct/systeminfo.h"
|
||||
#include "libc/nt/systeminfo.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/sysv/consts/auxv.h"
|
||||
|
||||
int __granularity(void) {
|
||||
if (IsWindows())
|
||||
return 65536;
|
||||
static int res;
|
||||
if (!res)
|
||||
res = getauxval(AT_PAGESZ);
|
||||
if (!res) {
|
||||
if (!IsWindows()) {
|
||||
res = getpagesize();
|
||||
} else {
|
||||
struct NtSystemInfo si;
|
||||
GetSystemInfo(&si);
|
||||
res = si.dwAllocationGranularity;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue