Skip to content

Commit

Permalink
feat(runtime): Use .hsc to get _SC_PAGE_SIZE
Browse files Browse the repository at this point in the history
The numbers are different for different platforms so we now get the correct value
  • Loading branch information
symbiont-daniel-gustafsson committed Dec 28, 2021
1 parent 23a8ed8 commit 673c640
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ foreign import ccall unsafe "stdlib.h posix_memalign"
foreign import ccall unsafe "unistd.h sysconf"
c_sysconf :: CInt -> IO CLong

#include <unistd.h>
_SC_PAGE_SIZE = #const _SC_PAGE_SIZE

------------------------------------------------------------------------

mmap :: Maybe (Ptr a) -> Int -> MemoryProtection -> MemoryVisibility -> Maybe Fd
Expand Down Expand Up @@ -121,8 +124,6 @@ posixMemalign align size = do

sysconfPageSize :: IO Int
sysconfPageSize = fromIntegral <$> c_sysconf _SC_PAGE_SIZE
where
_SC_PAGE_SIZE = 30

------------------------------------------------------------------------

Expand Down

0 comments on commit 673c640

Please sign in to comment.