> File Mapping And Pthreads, How to map file in memory?
Hello
I am trying to map a file in memory to use with pthreads (read/write blocks), but when I try to use a easy funcion to get void pointer, returned pointer is diferent each time.
The first place, the programs calls mmap with MAP_SHARED,
if ((source = mmap (0, fst1.st_size, PROT_READ | PROT_WRITE, MAP_SHARED, file, 0)) == (void *) -1)
{
perror ("Error ");
return (fail);
}
Why return different pointer each time?
Another method to easy manage of maped files like AIX file_ptr=shmat (fd, 0, SHM_MAP); ?
Thanks in advance.
|