Skip to content
Snippets Groups Projects
Commit b092e35f authored by bos's avatar bos
Browse files

Fix assumption that RLIM_INFINITY is a simple number

On MacOS X, it is defined as "(((__uint64_t)1 << 63) - 1)", and
hence cannot be used inside C preprocessor logic.
parent c8dc5f5c
No related branches found
No related tags found
No related merge requests found
...@@ -95,13 +95,16 @@ packResource ResourceTotalMemory = (#const RLIMIT_AS) ...@@ -95,13 +95,16 @@ packResource ResourceTotalMemory = (#const RLIMIT_AS)
unpackRLimit :: CRLim -> ResourceLimit unpackRLimit :: CRLim -> ResourceLimit
unpackRLimit (#const RLIM_INFINITY) = ResourceLimitInfinity unpackRLimit (#const RLIM_INFINITY) = ResourceLimitInfinity
#if defined(RLIM_SAVED_MAX) && (RLIM_SAVED_MAX != RLIM_INFINITY) unpackRLimit other
unpackRLimit (#const RLIM_SAVED_MAX) = ResourceLimitUnknown #if defined(RLIM_SAVED_MAX)
| (#const RLIM_SAVED_MAX) != (#const RLIM_INFINITY) &&
other == (#const RLIM_SAVED_MAX) = ResourceLimitUnknown
#endif #endif
#if defined(RLIM_SAVED_CUR) && (RLIM_SAVED_CUR != RLIM_INFINITY) #if defined(RLIM_SAVED_CUR)
unpackRLimit (#const RLIM_SAVED_CUR) = ResourceLimitUnknown | (#const RLIM_SAVED_CUR) != (#const RLIM_INFINITY) &&
other == (#const RLIM_SAVED_CUR) = ResourceLimitUnknown
#endif #endif
unpackRLimit other = ResourceLimit (fromIntegral other) | otherwise = ResourceLimit (fromIntegral other)
packRLimit :: ResourceLimit -> Bool -> CRLim packRLimit :: ResourceLimit -> Bool -> CRLim
packRLimit ResourceLimitInfinity _ = (#const RLIM_INFINITY) packRLimit ResourceLimitInfinity _ = (#const RLIM_INFINITY)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment