#include #include #include #include #include #include int main() { const char msg[] = "hello world"; size_t msglen = strlen(msg); int shmd = shm_open("/shm", O_RDWR | O_CREAT | O_TRUNC, 0755); ftruncate(shmd, msglen); char* memory = mmap(NULL, msglen, PROT_WRITE, MAP_SHARED, shmd, 0); strncpy(memory, msg, msglen); munmap(memory, msglen); close(shmd); return 0; }