Skip to content

Resource: Fix warning in case of no RLIM_SAVED_{CUR,MAX} #119

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

Merged
merged 1 commit into from
Aug 1, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions System/Posix/Resource.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,18 @@ unpackRLimit other

packRLimit :: ResourceLimit -> Bool -> CRLim
packRLimit ResourceLimitInfinity _ = (#const RLIM_INFINITY)
#ifdef RLIM_SAVED_CUR
#if defined(RLIM_SAVED_CUR)
packRLimit ResourceLimitUnknown True = (#const RLIM_SAVED_CUR)
#endif
#ifdef RLIM_SAVED_MAX
#if defined(RLIM_SAVED_MAX)
packRLimit ResourceLimitUnknown False = (#const RLIM_SAVED_MAX)
#endif
#if ! defined(RLIM_SAVED_MAX) && !defined(RLIM_SAVED_CUR)
packRLimit ResourceLimitUnknown _ =
error
$ "System.Posix.Resource.packRLimit: " ++
"ResourceLimitUnknown but RLIM_SAVED_MAX/RLIM_SAVED_CUR not defined by platform"
#endif
packRLimit (ResourceLimit other) _ = fromIntegral other


Expand Down