bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: non-blocking I/O tests


From: Bruno Haible
Subject: Re: non-blocking I/O tests
Date: Sun, 17 Apr 2011 20:15:43 +0200
User-agent: KMail/1.9.9

Hi Eric,

There were indeed some mistakes in the test. Now I've debugged it and added a
test for non-blocking sockets as well.

As is, the socket test fails on Cygwin 1.5.x. After putting STDOUT_FILENO in
non-blocking mode, get_nonblocking_flag reports that it is in non-blocking mode,
but it still behaves like a blocking socket. (You can convince yourself by
setting ENABLE_DEBUGGING to 1 and doing
"make check TESTS=test-nonblocking-socket.sh".)
I don't know how to work around this, so I just put a comment in the test.

Another complication was that on Linux (and similarly on MacOS X and Windows),
a writer can send much more data to a socket than the values of SO_SNDBUF and
SO_RCVBUF indicate. These values are 128 KB or less, yet it is possible for
a write() call of 7 MB of data on a supposedly blocking socket to succeed
immediately, before the reader has requested to read this data.

Yes another complication is that on Cygwin 1.5.x, writes of more than 64 MB
fail with error ENOBUFS. While POSIX allows this failure, it is not clear to
me whether it would not be better to implement in the module 'safe-write'
or 'full-write' a logic that sends the data in pieces?

Bruno


2011-04-17  Bruno Haible  <address@hidden>

        nonblocking: Add tests for pipes.
        * tests/test-nonblocking-pipe.sh: New file.
        * tests/test-nonblocking-pipe-main.c: New file.
        * tests/test-nonblocking-pipe-child.c: New file.
        * tests/test-nonblocking-pipe.h: New file.
        * tests/test-nonblocking-writer.h: New file.
        * tests/test-nonblocking-reader.h: New file.
        * tests/test-nonblocking-misc.h: New file.
        * modules/nonblocking-pipe-tests: New file.
        * modules/nonblocking-tests (Depends-on): Add nonblocking-pipe-tests.

2011-04-17  Bruno Haible  <address@hidden>

        nonblocking: Add tests for sockets.
        * tests/test-nonblocking-socket.sh: New file.
        * tests/test-nonblocking-socket-main.c: New file.
        * tests/test-nonblocking-socket-child.c: New file.
        * tests/test-nonblocking-socket.h: New file.
        * tests/socket-server.h: New file.
        * tests/socket-client.h: New file.
        * modules/nonblocking-socket-tests: New file.
        * modules/nonblocking-tests (Depends-on): Add nonblocking-socket-tests.


-- 
In memoriam Max Josef Metzger <http://en.wikipedia.org/wiki/Max_Josef_Metzger>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]