9fans archive / 2000 / 04 / 34 / prev next
From: Tom Duff td@pix...
Subject: [9fans] truncate syscall
Date: Mon, 10 Apr 2000 18:01:08 GMT
On Apr 10, 10:18am, Tom Duff wrote:
> Subject: Re: [9fans] truncate syscall
> > mmap(). truncate() is a bad name - it's setsize(). IOW, it can extend
> > files. Add the mmap() semantics in that respect and there you go -
> > open()/ftruncate() to set the size/mmap() the region/start working; is
> > quite common. Yes, you can kludge around it with lseek();write(); but
> > that's a kludge, unless we accept that zero-length write() changes the
> > file size. Which is not true under a lot of Unices (I seriously suspect
> > that it's explicitly prohibited by POSIX or something like that).
>
> int f=create("file", OREAD, 0666);
> if(n){
> seek(f, n-1, 0);
> write(f, "", 1);
> }
Also, Plan 9 doesn't have mmap, does it?
Certainly it's missing from ape.
--
Tom Duff. If it's in stock, we've got it.