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

Pldt, proc_get_ldt
obtain local descriptor table of a process

Process Control Library (libproc, -lproc)

#include <libproc.h>
int
Pldt(struct ps_prochandle *P, struct ssd *pldt, int nldt);
int
proc_get_ldt(pid_t pid, struct ssd *pldt, int nldt);

The Pldt() function reads the local descriptor table (LDT) of the process handle P into the buffer pldt. Up to nldt entries will be read.
If either pldt is NULL or nldt is 0, then rather than filling in pldt, only the number of entries currently in the LDT is returned.
The buffer pldt should contain sufficient space for nldt entries. For example, callers could allocate space as:
pldt = malloc(sizeof (struct ssd) * nldt);
For more information on the LDT and the struct ssd, see proc(4).
The proc_get_ldt() function is similar to the Pldt() function; however, rather than reading from a process handle, it reads the ldt file from the /proc file system for the process pid.

Upon successful completion, the Pldt() and proc_get_ldt() functions return the number of LDT entries written to pldt. If pldt is NULL or nldt is zero, then no data will be written. Otherwise, -1 is returned. The Pldt() function sets errno to indicate the error that occurred.

For a full list of possible errors see the DIAGNOSTICS section in proc(4).
The Pldt() function will fail if:
 
 
No LDT information is available in the process handle P.

The Pldt() and proc_get_ldt() functions are only available on x86 platforms.

Uncommitted

See LOCKING in libproc(3LIB).

libproc(3LIB), proc(4)
May 11, 2016 illumos