You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rs...@hyperreal.org on 1999/08/13 17:52:05 UTC
cvs commit: apache-2.0/mpm/src/os/unix iol_socket.c
rse 99/08/13 08:52:03
Modified: mpm/src/os/unix iol_socket.c
Log:
Hell, what a subtle problem which caused me four hours this afternoon to find.
It's not exactly specified (even POSIX does it once this time and once this
time) whether read() returns EWOULDBLOCK or EAGAIN. SysV usually returns
EAGAIN, BSD usually EWOULDBLOCK. So we have to check for _both_ errno values,
of course. This occured for me the first time after I've tried ``ab -n 1000
en1:8080/index.txt'' where index.txt is a very large file (3MB). Then the
sockets block often even for write operations and then the return value was
not recognized correctly... :-(
Revision Changes Path
1.3 +1 -1 apache-2.0/mpm/src/os/unix/iol_socket.c
Index: iol_socket.c
===================================================================
RCS file: /home/cvs/apache-2.0/mpm/src/os/unix/iol_socket.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- iol_socket.c 1999/06/28 19:00:50 1.2
+++ iol_socket.c 1999/08/13 15:52:01 1.3
@@ -176,7 +176,7 @@
if (rv >= 0) { \
return rv; \
} \
- if (errno == EWOULDBLOCK && iol->timeout != 0) { \
+ if ((errno == EWOULDBLOCK || errno == EAGAIN) && iol->timeout != 0) { \
return unix_##name##_timeout(viol, arg1, arg2); \
} \
return -1; \
Re: cvs commit: apache-2.0/mpm/src/os/unix iol_socket.c
Posted by Tony Finch <do...@dotat.at>.
Dean Gaudet <dg...@arctic.org> wrote:
>
>oh weird... what (broken) platform did you have this trouble on? linux
>(libc 4/5/6), solaris 2.6, and freebsd 2.2.x all define EAGAIN the same as
>EWOULDBLOCK... i'd think any unix would have to do that or suffer lots of
>code which considers only one of the two.
SunOS 4 has them defined differently (EAGAIN = 11, EWOULDBLOCK = 35).
Tony.
--
f.a.n.finch dot@dotat.at fanf@demon.net e pluribus unix
Re: cvs commit: apache-2.0/mpm/src/os/unix iol_socket.c
Posted by Dean Gaudet <dg...@arctic.org>.
oh weird... what (broken) platform did you have this trouble on? linux
(libc 4/5/6), solaris 2.6, and freebsd 2.2.x all define EAGAIN the same as
EWOULDBLOCK... i'd think any unix would have to do that or suffer lots of
code which considers only one of the two.
apache 1.3 uses only EAGAIN... i usually use EAGAIN, dunno why i typed
EWOULDBLOCK down there :)
Dean
On 13 Aug 1999 rse@hyperreal.org wrote:
> rse 99/08/13 08:52:03
>
> Modified: mpm/src/os/unix iol_socket.c
> Log:
> Hell, what a subtle problem which caused me four hours this afternoon to find.
> It's not exactly specified (even POSIX does it once this time and once this
> time) whether read() returns EWOULDBLOCK or EAGAIN. SysV usually returns
> EAGAIN, BSD usually EWOULDBLOCK. So we have to check for _both_ errno values,
> of course. This occured for me the first time after I've tried ``ab -n 1000
> en1:8080/index.txt'' where index.txt is a very large file (3MB). Then the
> sockets block often even for write operations and then the return value was
> not recognized correctly... :-(
>
> Revision Changes Path
> 1.3 +1 -1 apache-2.0/mpm/src/os/unix/iol_socket.c
>
> Index: iol_socket.c
> ===================================================================
> RCS file: /home/cvs/apache-2.0/mpm/src/os/unix/iol_socket.c,v
> retrieving revision 1.2
> retrieving revision 1.3
> diff -u -r1.2 -r1.3
> --- iol_socket.c 1999/06/28 19:00:50 1.2
> +++ iol_socket.c 1999/08/13 15:52:01 1.3
> @@ -176,7 +176,7 @@
> if (rv >= 0) { \
> return rv; \
> } \
> - if (errno == EWOULDBLOCK && iol->timeout != 0) { \
> + if ((errno == EWOULDBLOCK || errno == EAGAIN) && iol->timeout != 0) { \
> return unix_##name##_timeout(viol, arg1, arg2); \
> } \
> return -1; \
>
>
>
>