mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: porte64@free.fr
To: linux-kernel@vger.kernel.org
Subject: on circular files and an extension to truncate()
Date: Wed, 18 Mar 2009 12:15:16 +0100 (CET)	[thread overview]
Message-ID: <1123331339.2730971237374916174.JavaMail.root@spooler8-g27.priv.proxad.net> (raw)

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

                 reply	other threads:[~2009-03-18 11:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1123331339.2730971237374916174.JavaMail.root@spooler8-g27.priv.proxad.net \
    --to=porte64@free.fr \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®