lkml.org 
[lkml]   [1998]   [Oct]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectPOSIX and read() from tcp socket question.

I have a question about the linux kernel implementation of read() from a
TCP socket. This has to do with EINTR after data has been read into the
buffer. I am unclear both about how this functions, and how POSIX says it
*should* function. I am getting results which don't *seem* really logical
or POSIX...

Browsing the internet, I came across this:

-- BEGIN QUOTE --

ISO/IEC 9945-1: 1990 IEEE std 1003.1-1990 (aka POSIX.1)
Numbers in {braces} are POSIX line numbers from the standards document:
{132} If a read() is interrupted by a signal after it has successfully
read
some data,
{133} either it shall return -1 with errno set to [EINTR], or it shall
return the number of
{134} bytes read. A read() from a pipe or FIFO shall never return with
errno set to
{135} [EINTR] if it has transferred any data.

-- END QUOTE --

Now, is a TCP socket defined as a "pipe of FIFO" in this case? My socket
IS returning -1, with errno set to EINTR having read 1 byte into my
buffer, and having "consumed" that byte from the stream. This seems hard
to work around because it is impossible to detect AFAIK. It is also VERY
hard to reproduce, only happening about one in 350 times running my stress
test.

Kernels are 2.0.35 and 2.0.30 on libc5 (one RedHat 4.2 and one custom
patchwork system), on intel PII and PPRO.

David

Please follow up directly if possible, and cc to list if relevant.

--
/==============================\
| David Mansfield |
| david@cobite.com |
\==============================/


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:45    [W:0.031 / U:0.876 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site