Go to main content

man pages section 3: Extended Library Functions, Volume 3

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

Pctlfd (3PROC)

Name

Pasfd, Pctlfd, Pdirfd, Lctlfd - internal /proc file descriptors

Synopsis

#include <libproc.h>
int Pasfd(ps_prochandle_t *Pr);
int Pctlfd(ps_prochandle_t *Pr);
int Pdirfd(ps_prochandle_t *Pr);
int Lctlfd(ps_lwphandle_t *Lwp);

Description

The process control library maintains certain /proc file descriptors appropriate for the examination and control of a victim process. They are: the address space file descriptor, the process control file descriptor, the /proc/<pid> directory file descriptor for the process, and for each individually-controlled lwp in the process the lwp control file descriptor. These are normally used exclusively by the library for its own purposes. However, on the rare occasion that a controlling process needs access to low-level /proc interfaces, they may be fetched by the functions listed here.

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

The Lwp argument identifies a victim lwp attached to the controlling process by the Lgrab() function. For more information, see the Lgrab(3PROC) man page.

The Pasfd() function returns the process address space file descriptor. This is always a non-negative integer.

The Pctlfd() function returns the process control file descriptor. This is a non-negative integer unless the process is grabbed with the PGRAB_RDONLY flag or the controlling process grabs a core file.

The Pdirfd() function returns the process directory file descriptor, the home /proc directory for the victim process, /proc/<pid>. This is always a non-negative integer.

The Lctlfd() function returns the lwp control file descriptor. This is a non-negative integer unless the process is grabbed with the PGRAB_RDONLY flag or the controlling process grabs a core file.

Notes

Clients must neither close these file descriptors nor use them after the process is freed.

Return Values

If libproc currently has the indicated file descriptor open, the indicated file descriptor is returned. Else, -1 is returned.

Errors

There are no error returns from these functions and -1 is not an error.

Attributes

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

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Interface Stability
Committed
MT-Level
Unsafe

See Also

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