mirror of
https://github.com/coreutils/coreutils.git
synced 2025-01-03 14:43:22 +08:00
(MAP_ANONYMOUS): Use MAP_ANON, if possible.
Initialize `fd' to -1, so Solaris' mmap works with MAP_ANON.
This commit is contained in:
parent
e58f9df1b3
commit
c276ca6e49
@ -36,7 +36,11 @@
|
||||
#include "mmap-stack.h"
|
||||
|
||||
#ifndef MAP_ANONYMOUS
|
||||
# define MAP_ANONYMOUS 0
|
||||
# ifdef MAP_ANON
|
||||
# define MAP_ANONYMOUS MAP_ANON
|
||||
# else
|
||||
# define MAP_ANONYMOUS 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Set up context, *CTX, so that it may be used via makecontext,
|
||||
@ -46,7 +50,7 @@ static int
|
||||
get_context (ucontext_t *ctx, size_t size)
|
||||
{
|
||||
void *stack;
|
||||
int fd = 0;
|
||||
int fd = -1; /* This must be -1 in order for Solaris' MAP_ANON to work. */
|
||||
|
||||
if (getcontext (ctx))
|
||||
return 1;
|
||||
|
Loading…
Reference in New Issue
Block a user