diff options
author | Bryan O'Sullivan <bos@serpentine.com> | 2013-10-12 16:45:50 -0700 |
---|---|---|
committer | Bryan O'Sullivan <bos@serpentine.com> | 2013-10-12 16:45:50 -0700 |
commit | b092e35f4c99bfab12247e93c7fa478de638276a (patch) | |
tree | 20d9d9462669e76239ad122363cfe9b02cc2fc35 /System/Posix/Resource.hsc | |
parent | c8dc5f5c8b9247abd32069b0c08ef5655f81161a (diff) |
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.
Diffstat (limited to 'System/Posix/Resource.hsc')
-rw-r--r-- | System/Posix/Resource.hsc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/System/Posix/Resource.hsc b/System/Posix/Resource.hsc index a0d0d35..58cff6f 100644 --- a/System/Posix/Resource.hsc +++ b/System/Posix/Resource.hsc @@ -95,13 +95,16 @@ packResource ResourceTotalMemory = (#const RLIMIT_AS) unpackRLimit :: CRLim -> ResourceLimit unpackRLimit (#const RLIM_INFINITY) = ResourceLimitInfinity -#if defined(RLIM_SAVED_MAX) && (RLIM_SAVED_MAX != RLIM_INFINITY) -unpackRLimit (#const RLIM_SAVED_MAX) = ResourceLimitUnknown +unpackRLimit other +#if defined(RLIM_SAVED_MAX) + | (#const RLIM_SAVED_MAX) != (#const RLIM_INFINITY) && + other == (#const RLIM_SAVED_MAX) = ResourceLimitUnknown #endif -#if defined(RLIM_SAVED_CUR) && (RLIM_SAVED_CUR != RLIM_INFINITY) -unpackRLimit (#const RLIM_SAVED_CUR) = ResourceLimitUnknown +#if defined(RLIM_SAVED_CUR) + | (#const RLIM_SAVED_CUR) != (#const RLIM_INFINITY) && + other == (#const RLIM_SAVED_CUR) = ResourceLimitUnknown #endif -unpackRLimit other = ResourceLimit (fromIntegral other) + | otherwise = ResourceLimit (fromIntegral other) packRLimit :: ResourceLimit -> Bool -> CRLim packRLimit ResourceLimitInfinity _ = (#const RLIM_INFINITY) |