From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Mon, 10 Apr 2000 10:36:30 -0700 From: Tom Duff td@pixar.com Subject: [9fans] truncate syscall Topicbox-Message-UUID: a1430482-eac8-11e9-9e20-41e7f4b1d025 Message-ID: <20000410173630.01-6AoyPfFIbDwKa1vH1drxiZcTefKjN-yrHXvHGTik@z> 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.