Mercurial > cpython-lru_cache-weakref
diff Modules/socketmodule.c @ 25994:bb813346b227 legacy-trunk
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.
| author | Neal Norwitz <nnorwitz@gmail.com> |
|---|---|
| date | Sat, 02 Nov 2002 19:55:21 +0000 |
| parents | 337fcc24985b |
| children | b9c912e2c3c0 |
line wrap: on
line diff
--- a/Modules/socketmodule.c Sat Nov 02 18:25:08 2002 +0000 +++ b/Modules/socketmodule.c Sat Nov 02 19:55:21 2002 +0000 @@ -211,8 +211,8 @@ # 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 @@ #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 */
