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 PLWP_GETPSINFO 3PROC
  16 .Os
  17 .Sh NAME
  18 .Nm Plwp_getpsinfo
  19 .Nd get thread specific ps information
  20 .Sh SYNOPSIS
  21 .Lb libproc
  22 .In libproc.h
  23 .Ft int
  24 .Fo Plwp_getpsinfo
  25 .Fa "struct ps_prochandle *P"
  26 .Fa "lwpid_t lwpid"
  27 .Fa "lwpsinfo_t *lps"
  28 .Fc
  29 .Sh DESCRIPTION
  30 The
  31 .Fn Plwp_getpsinfo
  32 function
  33 looks up the thread-specific
  34 .Xr ps 1
  35 information for the thread specified by
  36 .Fa lwpid
  37 in the process handle
  38 .Fa P .
  39 The caller should provide a pointer to an
  40 .Sy lwpsinfo_t ,
  41 .Fa lps ,
  42 whose definition can be found in
  43 .Xr proc 4 .
  44 .Fa lps
  45 will be filled in with information such as the thread's id, its current
  46 state, priority, and run-time.
  47 .Pp
  48 The
  49 .Fn Plwp_getpsinfo
  50 function only works on process handles that refer to active processes
  51 and core files, it does not work on process handles that refer to
  52 individual files.
  53 .Sh RETURN VALUES
  54 Upon successful completion, the
  55 .Fn Plwp_getpsinfo
  56 function returns
  57 .Sy 0
  58 and
  59 .Fa lps
  60 is filled in with the
  61 thread-specific
  62 .Xr ps 1
  63 information.
  64 Otherwise,
  65 .Sy -1
  66 is returned and
  67 .Sy errno
  68 is set to indicate the error.
  69 .Sh ERRORS
  70 For a full list of possible errors also see the
  71 .Sy DIAGNOSTICS
  72 section in
  73 .Xr proc 4 .
  74 .Pp
  75 The
  76 .Fn Plwp_getpsinfo
  77 function will fail if:
  78 .Bl -tag -width Er
  79 .It Er ENODATA
  80 .Fa P
  81 refers to a file handle obtained through
  82 .Xr Pgrab_file 3PROC .
  83 .It Er EINVAL
  84 The process handle
  85 .Fa P
  86 refers to a core file and the specified thread does not exist.
  87 .It Er ENOENT
  88 The process handle
  89 .Fa P
  90 refers to an active process and the specified thread does not exist.
  91 .El
  92 .Sh INTERFACE STABILITY
  93 .Sy Uncommitted
  94 .Sh MT-LEVEL
  95 See
  96 .Sy LOCKING
  97 in
  98 .Xr ps 1 ,
  99 .Xr libproc 3LIB .
 100 .Sh SEE ALSO
 101 .Xr libproc 3LIB ,
 102 .Xr proc 4