Skip to content

Conversation

icculus
Copy link
Collaborator

@icculus icculus commented Oct 10, 2025

Fixes #14201.

@sezero
Copy link
Contributor

sezero commented Oct 10, 2025

getpagesize(2) is another alternative where others aren't available

@icculus
Copy link
Collaborator Author

icculus commented Oct 10, 2025

I avoided getpagesize because it's deprecated in POSIX (almost everything modern uses sysctl/HW_PAGESIZE), but I guess we could plug this into CMake in case Solaris or something uses it still.

@icculus icculus force-pushed the sdl3-getsystempagesize branch from 56fd8d8 to 8004931 Compare October 10, 2025 23:43
@icculus
Copy link
Collaborator Author

icculus commented Oct 10, 2025

It turns out our CMake code was already checking for getpagesize(), so I added it. I moved the hardcoded page sizes (Nintendo 3DS, PS2, etc) to be the first checks, so the compiler can optimize out any POSIX stuff those SDKs might offer, and added a check for a SDL_PLATFORM_SYSTEM_PAGE_SIZE_PRIVATE define that the console forks can implement without touching this code.

This is ready to merge whenever we're happy with it, at this point, I think.

@icculus icculus force-pushed the sdl3-getsystempagesize branch from 8004931 to 12c34bb Compare October 11, 2025 00:08
@icculus icculus force-pushed the sdl3-getsystempagesize branch from 12c34bb to 6b12bfd Compare October 11, 2025 00:34
@icculus icculus merged commit f7d5bb3 into libsdl-org:main Oct 11, 2025
43 checks passed
@icculus icculus deleted the sdl3-getsystempagesize branch October 11, 2025 01:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] SDL_GetPageSize()

4 participants