(MAP_ANONYMOUS): Use MAP_ANON, if possible.

Initialize `fd' to -1, so Solaris' mmap works with MAP_ANON.
This commit is contained in:
Jim Meyering 2003-02-16 08:59:15 +00:00
parent e58f9df1b3
commit c276ca6e49

View File

@ -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;