summaryrefslogtreecommitdiff
path: root/usr/src/man/man3proc/Pldt.3proc
blob: e702875c482b56688e9035f232e44ffb6b2572e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
.\"
.\" This file and its contents are supplied under the terms of the
.\" Common Development and Distribution License ("CDDL"), version 1.0.
.\" You may only use this file in accordance with the terms of version
.\" 1.0 of the CDDL.
.\"
.\" A full copy of the text of the CDDL should have accompanied this
.\" source.  A copy of the CDDL is also available via the Internet at
.\" http://www.illumos.org/license/CDDL.
.\"
.\"
.\" Copyright 2015 Joyent, Inc.
.\"
.Dd May 11, 2016
.Dt PLDT 3PROC
.Os
.Sh NAME
.Nm Pldt ,
.Nm proc_get_ldt
.Nd obtain local descriptor table of a process
.Sh LIBRARY
.Lb libproc
.Sh SYNOPSIS
.In libproc.h
.Ft int
.Fo Pldt
.Fa "struct ps_prochandle *P"
.Fa "struct ssd *pldt"
.Fa "int nldt"
.Fc
.Ft int
.Fo proc_get_ldt
.Fa "pid_t pid"
.Fa "struct ssd *pldt"
.Fa "int nldt"
.Fc
.Sh DESCRIPTION
The
.Fn Pldt
function reads the local descriptor table (LDT) of the process handle
.Fa P
into the buffer
.Fa pldt .
Up to
.Fa nldt
entries will be read.
.Pp
If either
.Fa pldt
is
.Dv NULL
or
.Fa nldt
is
.Fa 0 ,
then rather than filling in
.Fa pldt ,
only the number of entries currently in the LDT is returned.
.Pp
The buffer
.Fa pldt
should contain sufficient space for
.Fa nldt
entries.
For example, callers could allocate space as:
.Pp
.Dl pldt = malloc(sizeof (struct ssd) * nldt);
.Pp
For more information on the LDT and the
.Sy struct ssd ,
see
.Xr proc 4 .
.Pp
The
.Fn proc_get_ldt
function is similar to the
.Fn Pldt
function; however, rather than reading from a process handle, it reads
the
.Sy ldt
file from the /proc file system for the process
.Fa pid .
.Sh RETURN VALUES
Upon successful completion, the
.Fn Pldt
and
.Fn proc_get_ldt
functions return the number of LDT entries written to
.Fa pldt .
If
.Fa pldt
is
.Dv NULL
or
.Fa nldt
is zero, then no data will be written.
Otherwise,
.Sy -1
is returned.
The
.Fn Pldt
function sets
.Sy errno
to indicate the error that occurred.
.Sh ERRORS
For a full list of possible errors see the
.Sy DIAGNOSTICS
section in
.Xr proc 4 .
.Pp
The
.Fn Pldt
function will fail if:
.Bl -tag -width Er
.It Er ENODATA
No LDT information is available in the process handle
.Fa P .
.El
.Sh ARCHITECTURE
The
.Fn Pldt
and
.Fn proc_get_ldt
functions are only available on
.Sy x86
platforms.
.Sh INTERFACE STABILITY
.Sy Uncommitted
.Sh MT-LEVEL
See
.Sy LOCKING
in
.Xr libproc 3LIB .
.Sh SEE ALSO
.Xr libproc 3LIB ,
.Xr proc 4