void initSharingMem()
{
/* Open the file. */
fd = open (file, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
if (fd==-1) printf("error in opening file");
lseek (fd, FILE_LENGTH+1, SEEK_SET);
write (fd, "", 1);
lseek (fd, 0, SEEK_SET);
/* Create the memory-mapping. */
file_memory = mmap (0, FILE_LENGTH, PROT_READ | PROT_WRITE,MAP_SHARED, fd, 0);
}
void initSharingMem()
{
/* Open the file. */
fd = open (file, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
if (fd==-1) printf("error in opening file");
lseek (fd, FILE_LENGTH+1, SEEK_SET);
write (fd, "", 1);
lseek (fd, 0, SEEK_SET);
/* Create the memory-mapping. */
file_memory = mmap (0, FILE_LENGTH, PROT_READ | PROT_WRITE,MAP_SHARED, fd, 0);
}
To copy to clipboard, switch view to plain text mode
Bookmarks