PDA

View Full Version : Is there a way to generate a temporary pseudo filesystem like procfs in the userland?



Jiraiya_sama
April 13th, 2009, 12:49 AM
I'm wanting to create a program that you assign a default directory in your /home folder. Once it starts I want it to create something like /proc in that directory where you can interact with it by changing the values in the files.

EnglishSparrow
April 13th, 2009, 12:52 AM
Why not just a folder? Or create a filesystem file that can be mounted into a directory, like a .ext3.

Jiraiya_sama
April 13th, 2009, 12:57 AM
I don't want to read and write to files on the disk at all times. I want my program to be easily extensible via bash and perl scripting via editing files while not doing unnecessary writes to the disk.

EnglishSparrow
April 13th, 2009, 01:12 AM
I don't want to read and write to files on the disk at all times. I want my program to be easily extensible via bash and perl scripting via editing files while not doing unnecessary writes to the disk.

Then do it! :D

Mount the fake filesystem, run program, then unmount it. Although this would be like running a Livecd and then removing the ram...

Jiraiya_sama
April 13th, 2009, 01:22 AM
The program needs to do it without mount. I found an example of what I'm talking about: II (http://en.wikipedia.org/wiki/Ii_(IRC_Client)). Downloading and compiling it now. Hopefully it does everything I want it to do. Then I can create my program.

jimi_hendrix
April 13th, 2009, 01:32 AM
you cant read from a file without reading from disk...

sujoy
April 13th, 2009, 01:37 AM
sounds like plan9 (the one in wmii).

EnglishSparrow
April 13th, 2009, 01:38 AM
The program needs to do it without mount. I found an example of what I'm talking about: II (http://en.wikipedia.org/wiki/Ii_(IRC_Client)). Downloading and compiling it now. Hopefully it does everything I want it to do. Then I can create my program.

You NEED a mounted filesystem for the application to reside lol.


The program can simply load into memory if thats what you want -but thats all on the program side.

Perhaps do it like I said, with a filesystem located inside a file, similar to what wubi does.

Good luck...

jpkotta
April 13th, 2009, 02:31 AM
If you don't want to write to the disk, use tmpfs.

mount -t tmpfs none /mountpoint

stroyan
April 13th, 2009, 02:57 AM
You can use "FUSE: Filesystem in Userspace" to make a program present a directory of files without any disk involved.
See http://fuse.sourceforge.net.
On ubuntu you can use "sudo apt-get install libfuse-dev"
and then look at examples and documentation in
/usr/share/doc/libfuse-dev/ .

slavik
April 13th, 2009, 02:58 AM
tmpfs that is stored in ram?

soltanis
April 13th, 2009, 04:30 AM
If you're talking about the ii program from suckless.org, they use mkfifo to create named pipes, I believe. I'm 99% sure they don't use fuse (how else could you fit all that into 500 lines of code?).

man mkfifo (http://linux.die.net/man/3/mkfifo)

Jiraiya_sama
April 13th, 2009, 04:39 AM
If you're talking about the ii program from suckless.org, they use mkfifo to create named pipes, I believe. I'm 99% sure they don't use fuse (how else could you fit all that into 500 lines of code?).

man mkfifo (http://linux.die.net/man/3/mkfifo)

That looks like what I was looking for, thanks much.

EDIT: It wasn't exactly what I was looking for, but it's still very cool and useful. Thanks.