[Python-checkins] python/dist/src/Modules socketmodule.c,1.245,1.246

nnorwitz@users.sourceforge.net nnorwitz@users.sourceforge.net
Sat, 02 Nov 2002 11:55:23 -0800


Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv20418

Modified Files:
	socketmodule.c 
Log Message:
Use O_NONBLOCK rather than O_NDELAY, so we get POSIX non-blocking I/O.

On HPUX, Solaris, Tru64 (Dec UNIX), and IRIX (I think),
O_NONBLOCK is the POSIX version of non-blocking I/O
which is what we want.  

On Linux and FreeBSD (at least), O_NONBLOCK and O_NDELAY are the same.
So this change should have no negative effect on those platforms.

Tested on Linux, Solaris, HPUX.

Thanks to Anders Qvist for diagnosing this problem.


Index: socketmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v
retrieving revision 1.245
retrieving revision 1.246
diff -C2 -d -r1.245 -r1.246
*** socketmodule.c	19 Sep 2002 08:03:21 -0000	1.245
--- socketmodule.c	2 Nov 2002 19:55:21 -0000	1.246
***************
*** 212,217 ****
  #endif
  
! #ifndef O_NDELAY
! # define O_NDELAY O_NONBLOCK	/* For QNX only? */
  #endif
  
--- 212,217 ----
  #endif
  
! #ifndef O_NONBLOCK
! # define O_NONBLOCK O_NDELAY
  #endif
  
***************
*** 489,495 ****
  	delay_flag = fcntl(s->sock_fd, F_GETFL, 0);
  	if (block)
! 		delay_flag &= (~O_NDELAY);
  	else
! 		delay_flag |= O_NDELAY;
  	fcntl(s->sock_fd, F_SETFL, delay_flag);
  #endif /* !PYOS_OS2 */
--- 489,495 ----
  	delay_flag = fcntl(s->sock_fd, F_GETFL, 0);
  	if (block)
! 		delay_flag &= (~O_NONBLOCK);
  	else
! 		delay_flag |= O_NONBLOCK;
  	fcntl(s->sock_fd, F_SETFL, delay_flag);
  #endif /* !PYOS_OS2 */