mmap - MAP_ANON ??
Hello all,
While the 'mmap(2)' manpage of my x86 2.2r2 (2.2.18 kernel)
system says "Linux also knows about MAP_DENYWRITE, MAP_EXECUTABLE
and MAP_ANON(YMOUS)", I've not been able to get 'MAP_ANON' to work.
For example the mmap call below returns an EINVAL:
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
#include <sys/mman.h>
extern int errno;
int
main(int argc, char** argv)
{
void* shared = NULL;
shared = mmap( NULL, getpagesize(), PROT_WRITE|PROT_READ,
MAP_SHARED|MAP_ANON, -1, 0 );
if( (int )shared == -1 )perror("bad mmap");
exit(0);
}
This builds cleanly using gcc version 2.95.2 and libc6
version 2.1.3-18. ( gcc -Wall -g junk.c )
Any help, pointers or suggestions will be gratefully accepted.
Lance
----------------------------------------------------------------------
Lance Heller |
Network Systems | WorldCom
email: lance.heller@wcom.com | 6929 North Lakewood Avenue
phone: (918)590-4921 | Tulsa, OK 74117
fax : (918)590-1103 | MailDrop: 3.1-309
----------------------------------------------------------------------
Reply to: