随笔分类 - linux进程间通信
摘要:#include <stdio.h> #include <sys/shm.h> #include <unistd.h> #include <string.h> int main() { key_t key; // 用于打开指定的共享内存 int shm_id; // 共享内存id char *p;
阅读全文
摘要:#include <stdio.h> #include <unistd.h> #include <string.h> #include <errno.h> int main() { int fd[2]; char buf[1024]; memset(buf,'\0',sizeof(buf)); pi
阅读全文
摘要:共享内存-进程间通信 基本流程 创建/打开 一块共享内存空间 将共享内存映射到用户进程空间 操作 解除映射 销毁共享内存 创建共享内存源码 #include <stdio.h> #include <sys/shm.h> #include <unistd.h> #include <string.h>
阅读全文
摘要:无名管道源码 #include <stdio.h> #include <unistd.h> #include <string.h> #include <errno.h> int main() { int fd[2]; char buf[1024]; memset(buf,'\0',sizeof(bu
阅读全文