Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Apr 1999 10:02:34 +0300 (EEST)
From:      Narvi <narvi@haldjas.folklore.ee>
To:        Ville-Pertti Keinonen <will@iki.fi>
Cc:        Matthew Dillon <dillon@apollo.backplane.com>, hackers@FreeBSD.ORG
Subject:   Re: read() and pread() syscalls
Message-ID:  <Pine.BSF.3.96.990413095554.13437M-100000@haldjas.folklore.ee>
In-Reply-To: <86hfqmgcoh.fsf@not.demophon.com>

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

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




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