linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Glynn Clements <glynn@gclements.plus.com>
To: Dan Gary <funkychunkymunky@gmail.com>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: File I/O wrapper?
Date: Sun, 30 Jan 2005 11:45:59 +0000	[thread overview]
Message-ID: <16892.51447.238545.617773@gargle.gargle.HOWL> (raw)
In-Reply-To: <1450f66c05012411557e328fa1@mail.gmail.com>


Dan Gary wrote:

> I'm working on a new logging system and came across the idea of using
> a program through a symbolic link instead of a file for a log.
> 
> Basically I would write a program that logs to a variety of
> configurable sources, and would act as a file when it comes to I/O,
> doing whatever processing I want in between the "actual" file and the
> calling program.
> 
> My only hang up so far is actually getting the program to emulate file
> I/O without writing to the program file itself.
> 
> So in simple terms, I want a program to act like a file, and I'm stuck on How.
> 
> A FIFO isn't quite what I need, but close, although I need a single
> point of reference to handle all I/O, exactly like a file.
> 
> And I can't/don't want to rewrite every potential calling program to
> work with this.
> 
> I've been thinking I'm going to have to do a kernel module, but I was
> hoping someone might know a way I can implement this w/o doing a kmod.

Implement a networked-filesystem (e.g. NFS, SMB) server which handles
requests by some means other than directly modifying an actual
filesystem. You can then mount the filesystem using the kernel's
existing NFS/SMB client functionality.

This is the only possible approach that doesn't involve either
extending the kernel or modifying client processes.

OTOH, you can modify client *processes* without actually modifying
client *programs* by preloading a shared library which intercepts all
relevant library functions.

-- 
Glynn Clements <glynn@gclements.plus.com>

      parent reply	other threads:[~2005-01-30 11:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-24 19:55 File I/O wrapper? Dan Gary
2005-01-25  5:49 ` Rafael
     [not found] ` <200501241454.21502.eric@cisu.net>
     [not found]   ` <1450f66c05012508457a3f123c@mail.gmail.com>
2005-01-25 19:42     ` Eric Bambach
2005-01-30 11:45 ` Glynn Clements [this message]

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=16892.51447.238545.617773@gargle.gargle.HOWL \
    --to=glynn@gclements.plus.com \
    --cc=funkychunkymunky@gmail.com \
    --cc=linux-c-programming@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;
as well as URLs for NNTP newsgroup(s).