PCTFLD(3PROC) Process Control Library Functions PCTFLD(3PROC)

Pctlfd
obtain the process control file descriptor

Process Control Library (libproc, -lproc)

#include <libproc.h>
int
Pctlfd(struct ps_prochandle *P);

The Pctlfd() function returns a file descriptor to the underlying /proc file system ctl file for the process identified by the handle P. This may be used for injecting control operations manually; however, many interfaces for using it are provided by libproc(3LIB) itself.
Only live processes have a control file descriptor. Process handles that correspond to files and cores, created through Pgrab_file(3PROC) and Pgrab_core(3PROC), do not have a corresponding file descriptor.
The file descriptor is invalidated when the process handle is released through Prelease(3PROC) or if control is lost and the handle is reopened.

Upon successful completion, the Pctlfd() function returns a valid file descriptor. Otherwise, if none exists, then -1 is returned.

Uncommitted

See LOCKING in libproc(3LIB).

libproc(3LIB), Pcreate(3PROC), Pgrab(3PROC), Pgrab_core(3PROC), Pgrab_file(3PROC), Prelease(3PROC), Preopen(3PROC), proc(4)
May 11, 2016 illumos