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 2023 Oxide Computer Company
13.\"
14.Dd November 27, 2023
15.Dt PROC_GET_LWPSINFO 3PROC
16.Os
17.Sh NAME
18.Nm proc_get_lwpsinfo ,
19.Nm proc_get_lwpstatus
20.Nd get thread ps and status information
21.Sh LIBRARY
22.Lb libproc
23.Sh SYNOPSIS
24.In libproc.h
25.Ft int
26.Fo proc_get_lwpsinfo
27.Fa "pid_t pid"
28.Fa "uint_t thr"
29.Fa "lwpsinfo_t *lwpps"
30.Fc
31.Ft int
32.Fo proc_get_lwpstatus
33.Fa "pid_t pid"
34.Fa "uint_t thr"
35.Fa "lwpstatus_t *lwpst"
36.Fc
37.Sh DESCRIPTION
38The
39.Fn proc_get_lwpsinfo
40function is a convenient way to read the /proc lwpsinfo for the specific
41thread,
42.Fa thr ,
43found in the process
44.Fa pid .
45The information from the
46.Pa lwpsinfo
47file will be placed in
48.Fa lwpps .
49The definition of the
50.Vt lwpsinfo_t
51structure may be found in
52.Xr proc 5 .
53.Pp
54The
55.Fn proc_get_lwpstatus
56function is a convenient way to read the /proc lwpstatus for the specific
57thread,
58.Fa thr ,
59found in the process
60.Fa pid .
61The information from the
62.Pa lwpstatus
63file will be placed in
64.Fa lwpst .
65The definition of the
66.Vt lwpstatus_t
67structure may be found in
68.Xr proc 5 .
69.Pp
70The thread identifier for a thread is the same between POSIX pthreads,
71C11 threads, and the native threads API.
72It is safe to pass one of those identifiers in as
73.Fa thr
74or to use a specific number.
75.Sh RETURN VALUES
76Upon successful completion, the
77.Fn proc_get_lwpsinfo
78and
79.Fn proc_get_lwpstatus
80functions return
81.Sy 0 .
82Otherwise,
83.Sy -1
84is returned to indicate an error occurred.
85.Sh INTERFACE STABILITY
86.Sy Uncommitted
87.Sh MT-LEVEL
88.Sy MT-Safe
89.Sh SEE ALSO
90.Xr libproc 3LIB ,
91.Xr proc 5
92