ramfs and XIP

I'm investigating using the 2.6.9 kernel for a diskless embedded project. I'd like to use ramfs as my rootfs so that I can take advantage of XIP ... no sense in things being in memory twice.

Does this mean the rootfs must be R/O? If it is not, what happens if I try to delete an executing program or library?

Thanks. Bill

Reply to
Bill Gutknecht
Loading thread data ...

I got onto a regular old Intel box running Linux and played around with some executables kept in a ramfs:

- Looks like when you delete the file, it removes the reference from the directory, but the process continues to execute.

- Looks like when you try to modify the file that is in use, it won't let you.

Bill

Reply to
Bill Gutknecht

Well, now I've got to wonder if XIP was taking place at all in there. Sorry ... I've been Googling for days and haveing figured this out. I opened the executable in a vim session and trashed it, without affecting the running process.

What gives?

Reply to
Bill Gutknecht

Unix file semantics around open files and deletes;

If a file is open and the file is deleted, the file is removed from the directory (unlinked) but the file itself is not deleted until the last open handle is closed. Therefore, the space for the file is not freed until the last open handle is closed.

The way editors typically work is to delete the file and create a new one with the same name and write the contents to it. They don't usually modify the original file.

MCD

Reply to
mcd

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.