site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Thanks. #include <sys/types.h> #include <sys/mman.h> #include <fcntl.h> #include <stdio.h> #include <sys/stat.h> if ((fd = shm_open( id, O_RDWR | O_CREAT, 0666)) == -1) { perror( "shm_open"); return -1; } ftruncate( fd, size); // ignore return status buf = mmap( 0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); if ((int)buf == -1) { perror( "mmap"); } else { printf( "mmap returned %x\n", buf); munmap( buf, size); } shm_unlink( id); return 0; } Michael Heins AA7XY _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... I'm having trouble on my 10.3.7 system mapping more than 1 page of memory. Below is my little command line test program that illustrates the problem. I run it like this: prog abc 4096, where "abc" is the shared memory segment name, and 4096 is the segment size in bytes. On my system, the mmap succeeds for sizes between 1-4096 and fails for sizes above 4096. Is this a known bug in Darwin? Am I overlooking a problem in my code? // // Run with two arguments, the name of the shared memory segment, and the size. // int main( int argc, char **argv) { char *id = argv[1], *buf; int fd, size = atoi( argv[2]); This email sent to site_archiver@lists.apple.com
participants (1)
-
Michael Heins