rts/posix: Fail with HEAPOVERFLOW when out of memory during mmap
authorBen Gamari <bgamari.foss@gmail.com>
Sun, 17 Jan 2016 18:24:50 +0000 (19:24 +0100)
committerBen Gamari <ben@smart-cactus.org>
Sun, 17 Jan 2016 22:40:27 +0000 (23:40 +0100)
Test Plan: Validate

Reviewers: simonmar, austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1787

GHC Trac Issues: #11300

rts/posix/OSMem.c

index 60e684f..2a3c294 100644 (file)
@@ -222,7 +222,7 @@ my_mmap_or_barf (void *addr, W_ size, int operation)
             // If we request more than 3Gig, then we get EINVAL
             // instead of ENOMEM (at least on Linux).
             errorBelch("out of memory (requested %" FMT_Word " bytes)", size);
-            stg_exit(EXIT_FAILURE);
+            stg_exit(EXIT_HEAPOVERFLOW);
         } else {
             barf("getMBlock: mmap: %s", strerror(errno));
         }