Skip to content

Replace mem.page_size with mem.min_page_size and mem.max_page_size #4082

Closed
@andrewrk

Description

@andrewrk

Quoting @daurnimator from #3815:

This PR removes mem.page_size and replaces it with minimums and maximums. Originally I attempted to create a global variable page_size, but I realised that this would not work when zig's own startup routines are not used (e.g. when zig is used to create a static library). There is no linux syscall to get the current page size if you don't have access to the auxiliary vector, so a hacky solution would be required (e.g. using the knowledge that madvise returns EINVAL on non-page aligned arguments, and doing a search for the page size)

This PR introduces mem.bufsiz as a reasonable "default size" for buffers. The name is taken from the posix constant BUFSIZ.

Additionally, on linux we now assert that the page size in the auxiliary vector matches expectations.

This proposal solves #2564

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedThis proposal is planned.contributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.proposalThis issue suggests modifications. If it also has the "accepted" label then it is planned.standard libraryThis issue involves writing Zig code for the standard library.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions