-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
add an API to the standard library to learn the system page size #11308
Copy link
Copy link
Closed
Labels
contributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.This issue is limited in scope and/or knowledge of Zig internals.enhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.standard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.
Milestone
Metadata
Metadata
Assignees
Labels
contributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.This issue is limited in scope and/or knowledge of Zig internals.enhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.standard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Zig Version
0.10.0-dev.1434+676652865
Steps to Reproduce
I am running Linux on a MacBook Pro which uses 16 KiB pages; however, Zig's std lib always assumes 4 KiB pages on Linux running on aarch64.
Expected Behavior
Zig should infer/detect the correct page size.
Actual Behavior
Zig assumes 4 KiB pages, which results in errors in calls to
msyncormmap(e.g. instd.debug.captureStackTrace).#4082 is mentioned in the source code, so I'm guessing that is the long term solution. That issue also mentions a "hacky" solution of using
madviseto check for a valid page size. A short term solution could be to checkmadviseat compile time when running Linux on aarch64 to check between all possible page sizes (ARM64 can also support 64 KiB pages).If this is acceptable I can open a PR.EDIT: It looks like syscalls can't run at comptime so I don't think this would work.