lkml.org 
[lkml]   [2003]   [Dec]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Is there a "make hole" (truncate in middle) syscall?
Date
In article <873cc0nkgf.fsf@ceramic.fifi.org>,
Philippe Troin <phil@fifi.org> wrote:
| Peter Chubb <peter@chubb.wattle.id.au> writes:
|
| > >>>>> "Rob" == Rob Landley <rob@landley.net> writes:
| >
| > Rob> You can make a file with a hole by seeking past it and never
| > Rob> writing to that bit, but is there any way to punch a hole in a
| > Rob> file after the fact? (I mean other with lseek and write. Having
| > Rob> a sparse file as the result....)
| >
| > SVr4 has fcntl(fd, F_FREESP, flock) that frees the space covered by
| > the struct flock in the file. Linux doesn't have this, at least in
| > the baseline kernels.
|
| However most SVr4 (at least Solaris and HP-UX) only implement FREESP
| when the freed space is at the file's tail. In other words, FREESP can
| only be used to implement ftruncate().

Actually, I would thinmk that you *don't* want to do this at end of
file, turning zeros into holes is not the same as truncate, since it
will change the value of the file size, and that may not be what you
want at all.
--
bill davidsen <davidsen@tmr.com>
CTO, TMR Associates, Inc
Doing interesting things with little computers since 1979.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:59    [W:0.047 / U:35.432 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site