Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Jun 2000 01:49:59 -0700 (PDT)
From:      FengYue <fengyue@bluerose.windmoon.nu>
To:        hackers@FreeBSD.ORG
Subject:   libc_r/_read(), should the errno be reset to 0?
Message-ID:  <Pine.BSF.4.10.10006230134540.36067-100000@bluerose.windmoon.nu>
In-Reply-To: <200006222214.SAA85686@blackhelicopters.org>

next in thread | previous in thread | raw e-mail | index | archive | help

in thread read() implementation, there is this line of code:

                while ((ret = _thread_sys_read(fd, buf, nbytes)) < 0) {

suppose we're doing the IO on a TCP socket: _thread_sys_read() is going to
return -1 if there is no data available in the stream and the errno is then 
set to EAGAIN, so let's say we come back to the _thread_sys_read() call again,
this time it successed, however, the errno is still 35 (EAGAIN).  
My question is, shouldn't it be reset to zero?

So basically, if you do a read() call on TCP socket in your MT program and
the errno will be 35 even tho the read() call returns no error.  

BTW, this is 4.0-stable



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.10.10006230134540.36067-100000>