summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2002-11-02 19:55:21 +0000
committerNeal Norwitz <nnorwitz@gmail.com>2002-11-02 19:55:21 +0000
commit39d22e569394e7ddd27a3806dab9d0fc6032e13d (patch)
tree50534beae886540eb84044a23e1b4dab5b9d357b
parente7629c85bcfd8ba023ce89f506f393fc41d5f6bf (diff)
downloadcpython-git-39d22e569394e7ddd27a3806dab9d0fc6032e13d.tar.gz
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.
-rw-r--r--Modules/socketmodule.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index bdeddea0c7..2afa69769e 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -211,8 +211,8 @@ int h_errno; /* not used */
# define offsetof(type, member) ((size_t)(&((type *)0)->member))
#endif
-#ifndef O_NDELAY
-# define O_NDELAY O_NONBLOCK /* For QNX only? */
+#ifndef O_NONBLOCK
+# define O_NONBLOCK O_NDELAY
#endif
#include "addrinfo.h"
@@ -488,9 +488,9 @@ internal_setblocking(PySocketSockObject *s, int block)
#else /* !PYOS_OS2 */
delay_flag = fcntl(s->sock_fd, F_GETFL, 0);
if (block)
- delay_flag &= (~O_NDELAY);
+ delay_flag &= (~O_NONBLOCK);
else
- delay_flag |= O_NDELAY;
+ delay_flag |= O_NONBLOCK;
fcntl(s->sock_fd, F_SETFL, delay_flag);
#endif /* !PYOS_OS2 */
#else /* MS_WINDOWS */