#include #include #include #include #include #include #include //mmap-9-cli.c int main (int argc, char *argv[]) { const char * shm_name = "mymem"; const int SIZE = 4096; int i, fd; void * ptr; fd = shm_open(shm_name, O_RDONLY, 0666); if(fd==1){ printf("Errore in shm_open\n"); exit(1); } ptr = mmap(0, SIZE, PROT_READ, MAP_SHARED, fd, 0); if (ptr == MAP_FAILED) { printf("Errore in mmap\n"); return(1); } printf("%s", (char*) ptr); if(shm_unlink(shm_name)==1){ printf("Errore in unlink %s\n", shm_name); exit(1); } return 0; }