mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* on circular files and an extension to truncate()
@ 2009-03-18 11:15 porte64
  0 siblings, 0 replies; only message in thread
From: porte64 @ 2009-03-18 11:15 UTC (permalink / raw)
  To: linux-kernel

Hello,

How about extending the truncate() system call to enable
truncating files from the beginning also ?
This would be useful to help handle history files (logs ...).

One step further -- and i guess many people have already
thought about this:
Circular files could be introduced. I mean files whose
size remains fixed when written to, with the data wrapping
in a circular fashion. This would typically require an
additionnal position parameter ("cursor offset") in userland
stat_t structures.

So circular files would be a sub-category of regular files,
where the write() system call has special handling and updates
the cursor offset.

One advantage of such an implementation is that is would not
depend on the filesystem, and would help in many applications
in which big amounts of data is copied to another file.

I have poor knowledge of the linux kernel so i cannot see
if this suggestion has annoying side-effects and/or
poses compatibility issues.

However, the weaker idea of implementing truncate() with the
possibility to discard data at the beginning of files, then
extending the file, would help a lot.

Phil

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-03-18 11:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-18 11:15 on circular files and an extension to truncate() porte64

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®