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