You are not logged in.

#1 2009-01-08 01:58:42

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Is it possible to trick the filesystem into using a pipe?

I think this can be done with FUSE (i.e. I think this is basically what EncFS is doing), but I'm not sure, hence the question:

How could I create a "fake" file that would pass anything written to it to a process, and call upon the process to get data whenever the file is read? This should work transparently so that the system treats the file just like any other file, thus enabling it to be used with any application.

Is there already something that can do this?


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#2 2009-01-08 04:08:40

tom5760
Member
From: Philadelphia, PA, USA
Registered: 2006-02-05
Posts: 283
Website

Re: Is it possible to trick the filesystem into using a pipe?

You could probably do something similar with "mkfifo", which makes a named pipe.  You can run something like:

mkfifo fakefile

Then you could do something like

less -f fakefile

less, cat, or any other program will block until the other end of the pipe is connected.  Then run something like:

cat > fakefile

in another terminal, and start typing.  The lines should print in the other terminal.

EDIT: Changed my example to something a bit more interesting.

Last edited by tom5760 (2009-01-08 04:10:42)

Offline

#3 2009-01-08 05:29:47

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,223
Website

Re: Is it possible to trick the filesystem into using a pipe?

The problem with fifo's is that the data has to be being read before data is put in there... That's my experience with trying to get it working with these threads:
http://bbs.archlinux.org/viewtopic.php?id=60779
http://bbs.archlinux.org/viewtopic.php?id=60684

Offline

#4 2009-01-08 08:22:42

Lord Illidan
Member
From: Malta
Registered: 2007-10-25
Posts: 248

Re: Is it possible to trick the filesystem into using a pipe?

fukawi2 wrote:

The problem with fifo's is that the data has to be being read before data is put in there... That's my experience with trying to get it working with these threads:
http://bbs.archlinux.org/viewtopic.php?id=60779
http://bbs.archlinux.org/viewtopic.php?id=60684

I'm not too sure about this, since I've just learned about pipes today from this thread tongue

But, I tried creating a pipe, then catting to it before using less...and it worked. less read the data that I had already wrote to it with cat, and continued displaying data when I wrote more to it with cat.

Offline

#5 2009-01-08 09:38:07

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,223
Website

Re: Is it possible to trick the filesystem into using a pipe?

The problems I was having might have just been related to arecord / oggenc... When I did it, i had to start oggenc first, then arecord, but when I killed oggenc to start a new instance to a new output file, arecord would detect that ogggenc had died and would die also... *shrugs*

Offline

#6 2009-01-08 10:30:07

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: Is it possible to trick the filesystem into using a pipe?

tom5760,fukawi2

Thank you, that seems to be exactly what I had in mind!

*runs off to play with mkfifo*


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

Board footer

Powered by FluxBB