ChinaUnix.net
相关文章推荐:

O_NONBLOCK

写了一个小程序,先mkfifo打开一个管道,再open它。如果加上ont color="red">o_nonblockont>就失败,源代码: #include #include #includeo.h> #include #includeo.h> #include #include int main(void){ char fn[]="myfifo"; int ret=mkfifo(fn,S_IRUSR|S_IWUSR); if(ret==-1){ printf("mkfifo error:%s\n",strerror(errno)); return 1; } int fd=open(fn,o_WRoNLY|o_NoNBL...

by jeanlove - C/C++ - 2009-05-01 18:36:20 阅读(6434) 回复(5)

相关讨论

APUE 高级Io一章中的一个示例,代码如下: [code] #include o.h> #include #include #include #include o.h> int set_nonblock_flag(int fd, int value) { int oldflag = fcntl(fd, F_GETFL, 0); if(oldflag == -1) return -1; if(value != 0) oldflag |= ont color="red">o_nonblockont>; else oldflag &= ~o_...

by wzw19191 - C/C++ - 2009-02-06 20:11:41 阅读(2882) 回复(4)

apue介绍FIFo 时,提到关于open FIFoont color="red">o_nonblockont>标志位对read()系统调用的影响 When we open a FIFo, the nonblocking flag (ont color="red">o_nonblockont>) affects what happens. In the normal case (ont color="red">o_nonblockont> not specified), an open for read-only blocks until some other process opens the FIFo for writing. Similarly, an open for write-only blocks until some other process opens the FIFo for reading. If ont color="red">o_nonblockont> is spe...

by zhuhefang2006 - C/C++ - 2009-02-06 17:30:03 阅读(3445) 回复(4)
by Missex - C/C++ - 2008-03-14 16:24:05 阅读(7560) 回复(1)