摘要:
伪代码实现通过匿名管道播放网络视频、音乐等。 示例:player.c(子读父写) #include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <sys/wait.h>#include <fcn 阅读全文
摘要:
父子进程匿名管道通讯 示例:pipe.c(子读父写) #include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <sys/wait.h> #define BUFFSIZE 1024 int 阅读全文
摘要:
通过多线程实现管道通讯 头文件:mypipe.h #ifndef __PIPE_H__#define __PIPE_H__ #define PIPE_RD 0x00000001UL //只读属性#define PIPE_WR 0x00000002UL //只写属性#define MAXLENTH 1 阅读全文
摘要:
文件锁 int lockf(int fd, int cmd, off_t len); int flock(int fd, int operation); int fcntl(int fd, int cmd, ... /* arg */ ); 例程:lockf.c #include <stdio.h> 阅读全文
摘要:
使用mmap创建进程间共享内存 例程:shm.c #include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include 阅读全文
摘要:
数据中继epoll模型 示例:relay_epoll.c #include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <fcntl.h>#include <errno.h>#include < 阅读全文
摘要:
数据中继poll模型 示例:relay_poll.c #include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <fcntl.h>#include <errno.h>#include <po 阅读全文