Create variables for page size

This commit is contained in:
Justine Tunney 2024-07-18 21:02:59 -07:00
parent 23dfb79d33
commit 567d8fe32d
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
34 changed files with 137 additions and 101 deletions

View file

@ -16,22 +16,11 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
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"
/**
* Returns granularity of mmap() allocations.
*/
int getgransize(void) {
static int res;
if (!res) {
if (!IsWindows()) {
res = getpagesize();
} else {
struct NtSystemInfo si;
GetSystemInfo(&si);
res = si.dwAllocationGranularity;
}
}
return res;
return __gransize;
}