From owner-freebsd-hackers Tue Apr 13 0:12:34 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 AB75E1501E for ; Tue, 13 Apr 1999 00:12:27 -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 KAA07019; Tue, 13 Apr 1999 10:02:34 +0300 (EEST) Date: Tue, 13 Apr 1999 10:02:34 +0300 (EEST) From: Narvi To: Ville-Pertti Keinonen Cc: Matthew Dillon , hackers@FreeBSD.ORG Subject: Re: read() and pread() syscalls In-Reply-To: <86hfqmgcoh.fsf@not.demophon.com> 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 12 Apr 1999, Ville-Pertti Keinonen wrote: > > dillon@apollo.backplane.com (Matthew Dillon) writes: > > > :> But, see above about it not being possible to emulate read() with pread() > > :> in userspace. > > : > > :You mean, without lseek(2) =) > > > > pread/pwrite + lseek is not atomic, so exact emulation is not > > possible. > > This may come as a shock to you, but read(2)/write(2) aren't atomic in > updating the file pointer, either. > How come? > 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). > I would like to hear where is the code that would back up your claims. At least in 3.1 it is not so. Sander There is no love, no good, no happiness and no future - all these are just illusions. > Of course emulating read(2) would be ugly and slow. > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message