2

In the lsof man page, there is the following sentence:

An open file may be a regular file, a directory, a block special file, a character special file, an executing text reference, a library, a stream or a network file (Internet socket, NFS file or UNIX domain socket.)

What is an executing text reference?

tokarev
  • 123
  • 1
    Hmmm: http://www-01.ibm.com/support/knowledgecenter/SSB27U_5.4.0/com.ibm.zvm.v54.dmsa5/hcsd2b00329.htm%23wq718 <- Read that and then click "Next topic". – goldilocks Apr 10 '15 at 13:50

1 Answers1

4

The portions of an executable file that contain the machine instructions are called the text sections, and taken together they're called the text segment. On modern Unix and Unix-like systems, the file containing the text segment is kept open while the process is running so that pages full of machine instructions can be read (paged) into memory when necessary (see Demand Paging).

$ lsof -p $$ | grep txt
bash    3117   me  txt    REG    8,1  1021112  393938 /bin/bash

If all copies of the executable file happen to get deleted (more precisely, unlinked) while the process is still running, the reference will be sufficient to ensure that the file's contents remain accessible for as long as the process is running. This is why you can (usually) install system updates and not break any running processes.

Mark Plotnick
  • 25,413
  • 3
  • 64
  • 82