From owner-freebsd-hackers Mon Apr 12 23:57: 5 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from haldjas.folklore.ee (Haldjas.folklore.ee [193.40.6.121]) by hub.freebsd.org (Postfix) with ESMTP id B18B915202 for ; Mon, 12 Apr 1999 23:56:59 -0700 (PDT) (envelope-from narvi@haldjas.folklore.ee) Received: from haldjas.folklore.ee (haldjas.folklore.ee [172.17.2.1] (may be forged)) by haldjas.folklore.ee (8.8.8/8.8.4) with SMTP id JAA06913; Tue, 13 Apr 1999 09:54:12 +0300 (EEST) Date: Tue, 13 Apr 1999 09:54:12 +0300 (EEST) From: Narvi To: Jason Thorpe Cc: Ville-Pertti Keinonen , Matthew Dillon , hackers@FreeBSD.ORG Subject: Re: read() and pread() syscalls In-Reply-To: <199904121916.MAA07413@lestat.nas.nasa.gov> 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 On Mon, 12 Apr 1999, Jason Thorpe wrote: > On 12 Apr 1999 17:01:50 +0300 > Ville-Pertti Keinonen wrote: > > > This may come as a shock to you, but read(2)/write(2) aren't atomic in > > updating the file pointer, either. > > Then that's a bug in the FreeBSD kernel. > > > Actually, read(2) is equivalent to lseek(2)+pread(2)+lseek(2), with the > > last lseek(2) being SEEK_CUR by the read count returned by pread(2). > > The difference is that read(2) can only be pre-empted if it blocks > > doing I/O (which is not unusual). > > Geez, how did this get implemented in FreeBSD?! It's certainly not that > complicated. > I can say nothing but that you shouldn't believe everything you are told. *IF* NetBSD read in sys_generic does the same that OpenBSD read does, then all the three do the same things: a) they do permission checking b) they set up the iovec c) they call (*fp->f_ops->fo_read) d) they check for error And that's it. Anybody claiming otherwise is *STRONGLY* advised to point me to the code where I can see that it isn't so. Sander There is no love, no good, no happiness and no future - all these are just illusions. > -- Jason R. Thorpe > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message