```cpp int size = 4096; ftruncate(fd, size); ``` 4. 映射共享内存到进程的地址空间: ```cpp void* shared_memory = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); if(shared_memory == MAP_FAILED) { perror("mmap"); exit(1); } ``` 5. 写入共享内存: ```cpp strc...