mmap(2) functionality on Debian
I'm new to the list so if this has been a topic of discussion in the
past, I apologize for redundancy.
I'm trying to use mmap on Debian linux with the MAP_ANONYMOUS |
MAP_SHARED flags. I'm doing it BSD style and SVR4 style (using
/dev/zero as the fd for SVR4 and -1 as the fd for BSD).
In both situations, I'm getting an EINVAL (Invalid Argument) returned no
matter what I do.
I've looked all over the web for notes or problems with mmap and I don't
know what I'm missing.
Here's a simple piece of code that I'm using as a test - does anyone
know what's up with this?
Also, if mmap is broke for this situation, does anyone know of a really
good (efficient) means of communication between a parent and child
process other than this?
* Trying to mmap in integer as shared anonymous
int main (argc, argv)
int * ptr;
fd = open("/dev/zero", O_RDWR);
if ( (ptr=(int *)mmap(moveto, sizeof(int),
PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, fd, 0L)))
fprintf(stderr, "Error %i: %s\n", errno, strerror(errno));