Go to main content

man pages section 3: Extended Library Functions, Volume 3

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

Pisprocdir (3PROC)

Name

Pisprocdir - test if a directory is the /proc directory

Synopsis

#include <libproc.h>
int Pisprocdir(ps_prochandle_t *Pr, const char *dir);

Description

The Pr argument identifies a live victim process attached to the controlling process by the create and grab interfaces. For more information, see the Pcreate(3PROC) and Pgrab(3PROC) man pages.

The Pisprocdir() function returns true (non-zero) if the specified file name string in the dir argument is the actual /proc directory.

Motivation

When controlling a victim process, it is necessary to know whether the victim has attempted to open one of its own /proc files or one of the /proc files of some other process. Since /proc can be loopback mounted with a name other than /proc, the name of the directory under which the victim opens a file can be tested for whether or not it is actually /proc by calling the Pisprocdir() function. The truss(1) command uses this interface in order to relinquish control of a process that is being controlled by another controlling process.

Return Values

The Pisprocdir() function returns non-zero or true if the specified file name is the /proc directory present under the root directory of the victim process. Else, it returns 0 or false. There are no error returns.

Attributes

See attributes(7) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Interface Stability
Committed
MT-Level
Unsafe

See Also

libproc.h(3HEAD), libproc(3LIB), Pcreate(3PROC), Pgrab(3PROC), proc(5)