最近 socket 读数据老是遇到 Interrupted system call (eintr),代码改为如下解决 while (1) { select(socket+1, &readfds, NULL, NULL, &tv); if (FD_ISSET(socket, &readfds)) { printf("connection got!\n"); break; } else{ if (errno == eintr) continue; else printf("Timed out.\n"); } } 下面的列表显示常见的 Linux 系统错误代码。 ...
by skyily - Linux文档专区 - 2009-09-08 18:05:09 阅读(770) 回复(0)
最近 socket 读数据老是遇到 Interrupted system call (eintr),代码改为如下解决while (1){ select(socket+1, &readfds, NULL, NULL, &tv); if (FD_ISSET(socket, &readfds)) printf("connection got!\n"); else{ if (errno == eintr) continue; else printf("Timed out.\n"); }}下面的列表显示常见的 Linux 系统错误代码。 1 EPERMOperation not permitted操作不许可 2 ENOENTNo such file or director...
编译过程中出现错误
eintr 未声明
源代码如下:
#include
编译过程中出现错误
eintr 未声明
源代码如下:
#include
在fork出的N个子进程中使用消息队列接收数据,Socket发送数据,在某一个Socket第一次send成功后,此时消息队列会出现无法接收数据的情况,得到的代码是errno = eintr,msg = Interrupted system call!。但这种现象只会在子进程刚开始发数据的时候持续两到三次,以后不再产生!请教该问题可能产生的原因,是否需要屏蔽某信号?
UNIX网络编程中有这样一个函数,实现读取n字节。 ssize_t readn( int fd, void *vptr, size_t n ) { size_t nleft; ssize_t nread; char *ptr; ptr=vptr; nleft=n; while( nleft>0 ) { if( (nread=read(fd, ptr, nleft))<0 ) { if( eintr==errno ) nread=0; //注意这里! else return -1; }//if else if( nread==0 ) break; nleft-=nread; ptr+=nread; }//while retu...
当select被信号中断时, 我们在程序中该怎么处理呢? 最近经常在程序的debug文件中看到类似的信息: 2008/11/20/9:4:28 pty.c(00581):main DEBUG: -- @" select: Interrupted system call (4)"@ 2008/11/20/9:4:28 pty.c(00581):main DEBUG: -- @" select: Interrupted system call (4)"@ 我在程序中默认的是操作是遇到errno是eintr, 就continue, 不知道这样做对不对呢?
1、eintr中断是不是只有在阻塞模式下才会产生? 2、EWOULDBLOCK是在非阻塞模式下产生的中断,这时和eintr中断是否含义一致,也就是在非阻塞模式下,是否只需要判断EWOULDBLOCK就可以了? 3、在非阻塞模式下,调用write(int fd,void *vptr,int size)时,系统是先判断 内核缓冲区是否有足够size大小的,内核有多少缓冲区,就拷贝多少,还是如果没有size大小的内核缓冲区,就不拷贝了?(这时需要用户循环调用write)。
在什莫情况下errno会设为eintr? 和设没设信号handler有关吗? 如果设了信号handler,和发生的信号是不是要捕获信号有关吗? 和用户权限有关吗?
如题, OS : Linux localhost.localdomain 2.4.20-8 #1 Thu Mar 13 17:54:28 EST 2003 i686 i686 i386 GNU/Linux thread : getconf GNU_LIBPTHREAD_VERSION NPTL 0.29 由于是个测试工具,一个进程启动100个线程来模拟并发,当启动大概150个进程,即15000个线程的时候, pthread_create 返回 eintr, Interrupt System Call 我已经修改了系统的最大线程限制, 如下: kernel.threads-max = 30000 但是这个问题还是存在,而...