管道拥塞

#include <stdio.h>
#include <unistd.h>
int main(int argc, char **argv)
{
        if(argc!= 2)
        {   
                printf("pipeconf pathname\n");
                return -1
        }   
        printf("pipe_buf : %ld \n", pathconf(argv[1], _PC_PIPE_BUF));
}
查看指定路径(不同分区不一)的最大容纳的管道字节数
[dengwei@localhost tmp]$ ./pipe_buf /tmp
pipe_buf : 4096
因此要注意不能一直往管道里面写,要注意write 返回值,成功写了多少字节.
posted @ 2012-06-19 17:14  邓维  阅读(162)  评论(0编辑  收藏  举报