Messages in this thread | | | Date | Sun, 27 Sep 1998 09:57:14 -0700 (PDT) | From | Tim Smith <> | Subject | Re: What's wrong with MAP_SHARED|MAP_ANONYMOUS? |
| |
On 27 Sep 1998, Andi Kleen wrote: > > Would it work if you create a scratch file, open it, unlink it, fill it > > to the right size with zeros and then map it with a shared mapping? > > Yes, but you don't even need to fill it with zeros. Just use > ftruncate(fd, length). This has the advantage that unused blocks won't > be allocated.
It's probably better to lseek to the length you want and write a zero. ftruncate is not required by POSIX to allow length to be greater than the current length of the file, so using it that way is not portable.
--Tim Smith
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |