Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add get_page_size to os module #19744

Closed
1 of 2 tasks
hk-none opened this issue Nov 2, 2023 · 2 comments · Fixed by #19770
Closed
1 of 2 tasks

Add get_page_size to os module #19744

hk-none opened this issue Nov 2, 2023 · 2 comments · Fixed by #19770
Labels
Feature Request This issue is made to request a feature.

Comments

@hk-none
Copy link

hk-none commented Nov 2, 2023

Describe the feature

Is there any way to add a function to os module to return the systems memory page size?

Use Case

Useful for low level programming

Proposed Solution

 usize(unsafe { C.syscall(C._SC_PAGESIZE) })

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

Version used

V 0.4.2 5b1b2cc

Environment details (OS name and version, etc.)

V full version: V 0.4.2 5b1b2cc
OS: macos, macOS, 14.1, 23B73
Processor: 8 cpus, 64bit, little endian, Apple M1 Pro

Git version: git version 2.39.2
Git vroot status: 4.1.18-37-ga4b4b909 (53627 commit(s) behind V master)
.git/config present: false

CC version: Apple clang version 15.0.0 (clang-1500.0.40.1)
thirdparty/tcc: N/A

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

@hk-none hk-none added the Feature Request This issue is made to request a feature. label Nov 2, 2023
@JalonSolov
Copy link
Contributor

JalonSolov commented Nov 2, 2023

From a stackoverflow question about this:

It is entirely platform dependent which address-ranges are mapped to which page-sizes.
Further the pagesize is not system-wide. You can allocate memory from different page-size
regions according to the use case. And you can even have platforms without any virtual
memory management.

So, code handling this topic must be platform specific.

Especially when you add Windows into the mix.

@hk-none
Copy link
Author

hk-none commented Nov 2, 2023

Yeah, I figured from looking at go's implementation. Is this something we will add to os?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request This issue is made to request a feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants