From owner-freebsd-hackers Fri Jun 23 1:39:53 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from bluerose.windmoon.nu (c255152-a.plstn1.sfba.home.com [24.176.132.48]) by hub.freebsd.org (Postfix) with ESMTP id A72CD37C15C for ; Fri, 23 Jun 2000 01:39:50 -0700 (PDT) (envelope-from fengyue@bluerose.windmoon.nu) Received: from localhost (fengyue@localhost) by bluerose.windmoon.nu (Windmoon-Patched/8.9.3/8.9.3) with ESMTP id BAA36076 for ; Fri, 23 Jun 2000 01:50:00 -0700 (PDT) Date: Fri, 23 Jun 2000 01:49:59 -0700 (PDT) From: FengYue To: hackers@FreeBSD.ORG Subject: libc_r/_read(), should the errno be reset to 0? In-Reply-To: <200006222214.SAA85686@blackhelicopters.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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