site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... This email sent to site_archiver@lists.apple.com int fd; if(name.size()>=MAX_NAME_LEN) cerr << "*** WARNING RCRegion named " << name << " will be clipped to " << name.substr(0,MAX_NAME_LEN-2) << endl; id.key[0]='/'; //one page I read said for best portability, names should start with '/'... ? strncpy(id.key+1,name.c_str(),MAX_NAME_LEN-2); id.key[MAX_NAME_LEN-1]='\0'; cout << "Name is " << id.key << endl; if(create) { if((fd=shm_open(id.key,O_RDWR|O_CREAT|O_EXCL,0666))<0) { perror("Getting new region (shm_open)"); exit(EXIT_FAILURE); } } else { if((fd=shm_open(id.key,O_RDWR,0666))<0) { perror("Getting existing region (shm_open)"); exit(EXIT_FAILURE); } } cout << "fd is " << fd << endl; base=static_cast<char*>(mmap(NULL,sz,PROT_READ|PROT_WRITE,MAP_SHARED,fd,0)); if (base == reinterpret_cast<char*>(-1)) { perror("Attaching region (mmap)"); if(close(fd)<0) perror("Warning: Closing temporary file descriptor from shm_open"); if(shm_unlink(id.key)<0) perror("Warning: Shared memory unlink (shm_unlink)"); exit(EXIT_FAILURE); } if(close(fd)<0) { perror("Warning: Closing temporary file descriptor from shm_open"); }