Removing an executable while it runs
Quoted 4 lines · Cyrille Beraud
I would like to remove an executable from the file-system while it is running and
get all the blocks back immediately, not after the end of the program. Is this possible ?
No. Binary runs from these blocks. Maybe you can force it to run from swap by modifying these pages through ptrace interface, but it is not supported. Just kill the app if you need these blocks.
Quoted 2 lines
From what I understand, the inode is not released until the program
ends. Do all the file-systems behave the same way ?
No. Some will refuse to unlink running app (or another opened file). Some will unlink it immediately, and app then dies when it needs page-in something. Some works as POSIX mandates.
Best regards,
Petr Vandrovec [email protected]
Quoted 11 lines · Petr Vandrovec
Quoted 4 lines · Cyrille Beraud
I would like to remove an executable from the file-system while it is running and
get all the blocks back immediately, not after the end of the program. Is this possible ?No. Binary runs from these blocks. Maybe you can force it to run from swap by modifying these pages through ptrace interface, but it is not supported. Just kill the app if you need these blocks.
Quoted 7 lines
Quoted 2 lines
From what I understand, the inode is not released until the program
ends. Do all the file-systems behave the same way ?No. Some will refuse to unlink running app (or another opened file). Some will unlink it immediately, and app then dies when it needs page-in something. Some works as POSIX mandates.
POSIX behaviour would be in ext[23], reiserfs, xfs, (and probably ffs, ntfs). Can someone verify which FSes have what behaviour?
I'd guess that vfat (fat16/28--err, 32), nfs, and hfs would delete immediately.
mf