Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
0ab0232d
Commit
0ab0232d
authored
Feb 27, 2006
by
Simon Marlow
Browse files
mmap() errors on Darwin: use errorBelch/exit instead of barf()
The most likely cause is out-of-memory, not an RTS error.
parent
04c0256a
Changes
1
Hide whitespace changes
Inline
Side-by-side
ghc/rts/MBlock.c
View file @
0ab0232d
...
...
@@ -181,10 +181,14 @@ my_mmap (void *addr, lnat size)
if
(
!
addr
||
err
)
// try to allocate anywhere
err
=
vm_allocate
(
mach_task_self
(),(
vm_address_t
*
)
&
ret
,
size
,
TRUE
);
if
(
err
)
// don't know what the error codes mean exactly
barf
(
"memory allocation failed (requested %lu bytes)"
,
size
);
else
if
(
err
)
{
// don't know what the error codes mean exactly, assume it's
// not our problem though.
errorBelch
(
"memory allocation failed (requested %lu bytes)"
,
size
);
stg_exit
(
EXIT_FAILURE
);
}
else
{
vm_protect
(
mach_task_self
(),
ret
,
size
,
FALSE
,
VM_PROT_READ
|
VM_PROT_WRITE
);
}
#else
ret
=
mmap
(
addr
,
size
,
PROT_READ
|
PROT_WRITE
|
PROT_EXEC
,
MAP_ANON
|
MAP_PRIVATE
,
-
1
,
0
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment