-
-
Notifications
You must be signed in to change notification settings - Fork 758
Update linux.Map_Flags_Bits
#5152
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
linux.Map_Flags_Bits
Fixes #5151 - Removes `SHARED_VALIDATE` from the enum and turns it into `Map_Shared_Validate :: Map_Flags{.SHARED, .PRIVATE}` so it has the proper value of 0x03. - Adds `DROPPABLE`. - Adds constants `MAP_HUGE_SHIFT` and `MAP_HUGE_MASK`. - Adds the huge page precomputed constants from `mman.h`, defined as the log2 of the size shifted left by `MAP_HUGE_SHIFT`: Map_Huge_16KB Map_Huge_64KB Map_Huge_512KB Map_Huge_1MB Map_Huge_2MB Map_Huge_8MB Map_Huge_16MB Map_Huge_32MB Map_Huge_256MB Map_Huge_512MB Map_Huge_1GB Map_Huge_2GB Map_Huge_16GB
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -371,6 +371,21 @@ Mem_Protection :: bit_set[Mem_Protection_Bits; i32] | |
*/ | ||
Map_Flags :: bit_set[Map_Flags_Bits; i32] | ||
|
||
Map_Shared_Validate :: Map_Flags{.SHARED, .PRIVATE} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are constants right? Should go into constants.odin and be in upper snake case. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's not very usable, though. Who's going to look for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And when it comes to File_Flags :: distinct bit_set[File_Flag; uint]
File_Flag :: enum {
Read,
Write,
Append,
Create,
Excl,
Sync,
Trunc,
Sparse,
Inheritable,
Unbuffered_IO,
}
O_RDONLY :: File_Flags{.Read}
O_WRONLY :: File_Flags{.Write}
O_RDWR :: File_Flags{.Read, .Write}
O_APPEND :: File_Flags{.Append}
O_CREATE :: File_Flags{.Create}
O_EXCL :: File_Flags{.Excl}
O_SYNC :: File_Flags{.Sync}
O_TRUNC :: File_Flags{.Trunc}
O_SPARSE :: File_Flags{.Sparse} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean that's how the entirety of this package is structured There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. True. The I'll make it We may at some point want to give There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, I am not saying I fully agree with the structure here but to be at least consistent on the package level is a good thing. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I made the changes and left a comment where to find it for people who expect it next to the enum or bit_set. |
||
Map_Huge_16KB :: transmute(Map_Flags)(u32(14) << MAP_HUGE_SHIFT) | ||
Map_Huge_64KB :: transmute(Map_Flags)(u32(16) << MAP_HUGE_SHIFT) | ||
Map_Huge_512KB :: transmute(Map_Flags)(u32(19) << MAP_HUGE_SHIFT) | ||
Map_Huge_1MB :: transmute(Map_Flags)(u32(20) << MAP_HUGE_SHIFT) | ||
Map_Huge_2MB :: transmute(Map_Flags)(u32(21) << MAP_HUGE_SHIFT) | ||
Map_Huge_8MB :: transmute(Map_Flags)(u32(23) << MAP_HUGE_SHIFT) | ||
Map_Huge_16MB :: transmute(Map_Flags)(u32(24) << MAP_HUGE_SHIFT) | ||
Map_Huge_32MB :: transmute(Map_Flags)(u32(25) << MAP_HUGE_SHIFT) | ||
Map_Huge_256MB :: transmute(Map_Flags)(u32(28) << MAP_HUGE_SHIFT) | ||
Map_Huge_512MB :: transmute(Map_Flags)(u32(29) << MAP_HUGE_SHIFT) | ||
Map_Huge_1GB :: transmute(Map_Flags)(u32(30) << MAP_HUGE_SHIFT) | ||
Map_Huge_2GB :: transmute(Map_Flags)(u32(31) << MAP_HUGE_SHIFT) | ||
Map_Huge_16GB :: transmute(Map_Flags)(u32(34) << MAP_HUGE_SHIFT) | ||
|
||
/* | ||
Flags for mlock(2). | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should go into constants.odin and prob good to stay consistent with the comment style used in the package.