1

What happens if you delete a file that has been loaded as a shared library by some process? Can it be deleted? Any crash?

John
  • 11
  • 2

1 Answers1

2

In UNIX-like systems, including Linux, unlinking a file (that's what rm does) removes its entry from the directory. The file is actually deleted when (1) it has no entry in any directory and (2) it is no longer open by any process. As long as the process(es) which have loaded the shared library are running the file is not deleted, even if it no longer has a directory entry. See also the answers to the questions indicated by Ulrich Schwarz and countermode.

AlexP
  • 10,217
  • 32
  • 41