* File I/O wrapper?
@ 2005-01-24 19:55 Dan Gary
2005-01-25 5:49 ` Rafael
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Dan Gary @ 2005-01-24 19:55 UTC (permalink / raw)
To: linux-c-programming
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.
I've always been a higher level programmer, interfaces, DB
access/filtering, etc, so anything as low as throwing a hook into file
I/O is a little beyond my existing knowledge level, but I'm willing to
give it a shot.
Any help would be greatly appreciated.
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: File I/O wrapper?
2005-01-24 19:55 File I/O wrapper? Dan Gary
@ 2005-01-25 5:49 ` Rafael
[not found] ` <200501241454.21502.eric@cisu.net>
2005-01-30 11:45 ` Glynn Clements
2 siblings, 0 replies; 4+ messages in thread
From: Rafael @ 2005-01-25 5:49 UTC (permalink / raw)
To: linux-c-programming
Some ideas...
Perhaps (i d't like this word but for discussion...) a wrapper I/O 100%
trustworthy one i dont see how without kmod.
Multiple programs realizing I/O is hard, because you need to know who
read/write what and the buffer size of that operation. And it make things
come more complex because i know you got look at programs stack, monitoring
calls by I/O opetarions (eg libc routines - GDB). That is for monitoring
intentions. So a possible I/O reaction system based in logs it is another
history.
There's a tool named fuser, look at the source for some ideas, gdb source code
too.
> 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.
>
> I've always been a higher level programmer, interfaces, DB
> access/filtering, etc, so anything as low as throwing a hook into file
> I/O is a little beyond my existing knowledge level, but I'm willing to
> give it a shot.
>
> Any help would be greatly appreciated.
> -
> To unsubscribe from this list: send the line "unsubscribe
> linux-c-programming" in the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread[parent not found: <200501241454.21502.eric@cisu.net>]
* Re: File I/O wrapper?
2005-01-24 19:55 File I/O wrapper? Dan Gary
2005-01-25 5:49 ` Rafael
[not found] ` <200501241454.21502.eric@cisu.net>
@ 2005-01-30 11:45 ` Glynn Clements
2 siblings, 0 replies; 4+ messages in thread
From: Glynn Clements @ 2005-01-30 11:45 UTC (permalink / raw)
To: Dan Gary; +Cc: linux-c-programming
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>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-01-30 11:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).