Print this page
8158 Want named threads API
9857 proc manpages should have LIBRARY section
   1 '\" te
   2 .\" Copyright 1989 AT&T
   3 .\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved.
   4 .\" Copyright (c) 2013, Joyent, Inc. All rights reserved.
   5 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
   6 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
   7 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
   8 .TH PROC 4 "Jun 6, 2016"
   9 .SH NAME
  10 proc \- /proc, the process file system
  11 .SH DESCRIPTION
  12 .LP
  13 \fB/proc\fR is a file system that provides access to the state of each process
  14 and light-weight process (lwp) in the system. The name of each entry in the
  15 \fB/proc\fR directory is a decimal number corresponding to a process-ID. These
  16 entries are themselves subdirectories. Access to process state is provided by
  17 additional files contained within each subdirectory; the hierarchy is described
  18 more completely below. In this document, ``\fB/proc\fR file'' refers to a
  19 non-directory file within the hierarchy rooted at \fB/proc\fR. The owner of
  20 each \fB/proc\fR file and subdirectory is determined by the user-ID of the
  21 process.
  22 .sp
  23 .LP
  24 \fB/proc\fR can be mounted on any mount point, in addition to the standard
  25 \fB/proc\fR mount point, and can be mounted several places at once. Such
  26 additional mounts are allowed in order to facilitate the confinement of
  27 processes to subtrees of the file system via \fBchroot\fR(1M) and yet allow
  28 such processes access to commands like \fBps\fR(1).


 877     uid_t pr_uid;            /* real user id */
 878     uid_t pr_euid;           /* effective user id */
 879     gid_t pr_gid;            /* real group id */
 880     gid_t pr_egid;           /* effective group id */
 881     uintptr_t pr_addr;       /* address of process */
 882     size_t pr_size;          /* size of process image in Kbytes */
 883     size_t pr_rssize;        /* resident set size in Kbytes */
 884     dev_t pr_ttydev;         /* controlling tty device (or PRNODEV) */
 885     ushort_t pr_pctcpu;      /* % of recent cpu time used by all lwps */
 886     ushort_t pr_pctmem;      /* % of system memory used by process */
 887     timestruc_t pr_start;    /* process start time, from the epoch */
 888     timestruc_t pr_time;     /* cpu time for this process */
 889     timestruc_t pr_ctime;    /* cpu time for reaped children */
 890     char pr_fname[PRFNSZ];   /* name of exec'ed file */
 891     char pr_psargs[PRARGSZ]; /* initial characters of arg list */
 892     int pr_wstat;            /* if zombie, the wait() status */
 893     int pr_argc;             /* initial argument count */
 894     uintptr_t pr_argv;       /* address of initial argument vector */
 895     uintptr_t pr_envp;       /* address of initial environment vector */
 896     char pr_dmodel;          /* data model of the process */
 897     lwpsinfo_t pr_lwp;       /* information for representative lwp */
 898     taskid_t pr_taskid;      /* task id */
 899     projid_t pr_projid;      /* project id */
 900     poolid_t pr_poolid;      /* pool id */
 901     zoneid_t pr_zoneid;      /* zone id */
 902     ctid_t pr_contract;      /* process contract id */

 903 } psinfo_t;
 904 .fi
 905 .in -2
 906 
 907 .sp
 908 .LP
 909 Some of the entries in \fBpsinfo\fR, such as \fBpr_addr\fR, refer to internal
 910 kernel data structures and should not be expected to retain their meanings
 911 across different versions of the operating system.
 912 .sp
 913 .LP
 914 \fBpsinfo_t.pr_flag\fR is a deprecated interface that should no longer be used.
 915 Applications currently relying on the \fBSSYS\fR bit in \fBpr_flag\fR should
 916 migrate to checking \fBPR_ISSYS\fR in the \fBpstatus\fR structure's
 917 \fBpr_flags\fR field.
 918 .sp
 919 .LP
 920 \fBpr_pctcpu\fR and \fBpr_pctmem\fR are 16-bit binary fractions in the range
 921 0.0 to 1.0 with the binary point to the right of the high-order bit (1.0 ==
 922 0x8000). \fBpr_pctcpu\fR is the summation over all lwps in the process.


1467 once existed but no longer exist in the process). Excluding the \fBpr_lwpid\fR,
1468 \fBpr_tstamp\fR, \fBpr_create\fR, and \fBpr_term\fR entries, the entry-by-entry
1469 summation over all these structures is the definition of the process usage
1470 information obtained from the \fBusage\fR file. (See also
1471 \fB/proc/\fR\fIpid\fR\fB/lwp/\fR\fIlwpid\fR/\fBlwpusage\fR, below.)
1472 .SS "lwp"
1473 .LP
1474 A directory containing entries each of which names an active or zombie lwp
1475 within the process. These entries are themselves directories containing
1476 additional files as described below. Only the \fBlwpsinfo\fR file exists in the
1477 directory of a zombie lwp.
1478 .SH STRUCTURE OF \fB/proc/\fR\fIpid\fR\fB/lwp/\fR\fIlwpid\fR
1479 .LP
1480 A given directory \fB/proc/\fR\fIpid\fR\fB/lwp/\fR\fIlwpid\fR contains the
1481 following entries:
1482 .SS "lwpctl"
1483 .LP
1484 Write-only control file. The messages written to this file affect the specific
1485 lwp rather than the representative lwp, as is the case for the process's
1486 \fBctl\fR file.








1487 .SS "lwpstatus"
1488 .LP
1489 lwp-specific state information. This file contains the \fBlwpstatus\fR
1490 structure for the specific lwp as described above for the representative lwp in
1491 the process's \fBstatus\fR file.
1492 .SS "lwpsinfo"
1493 .LP
1494 lwp-specific \fBps\fR(1) information. This file contains the \fBlwpsinfo\fR
1495 structure for the specific lwp as described above for the representative lwp in
1496 the process's \fBpsinfo\fR file. The \fBlwpsinfo\fR file remains accessible
1497 after an lwp becomes a zombie.
1498 .SS "lwpusage"
1499 .LP
1500 This file contains the \fBprusage\fR structure for the specific lwp as
1501 described above for the process's \fBusage\fR file.
1502 .SS "gwindows"
1503 .LP
1504 This file exists only on SPARC based machines. If it is non-empty, it contains
1505 a \fBgwindows_t\fR structure, defined in \fB<sys/regset.h>\fR, with the values
1506 of those SPARC register windows that could not be stored on the stack when the


   1 '\" te
   2 .\" Copyright 1989 AT&T
   3 .\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved.
   4 .\" Copyright 2018, Joyent, Inc.
   5 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
   6 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
   7 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
   8 .TH PROC 4 "August 22, 2018"
   9 .SH NAME
  10 proc \- /proc, the process file system
  11 .SH DESCRIPTION
  12 .LP
  13 \fB/proc\fR is a file system that provides access to the state of each process
  14 and light-weight process (lwp) in the system. The name of each entry in the
  15 \fB/proc\fR directory is a decimal number corresponding to a process-ID. These
  16 entries are themselves subdirectories. Access to process state is provided by
  17 additional files contained within each subdirectory; the hierarchy is described
  18 more completely below. In this document, ``\fB/proc\fR file'' refers to a
  19 non-directory file within the hierarchy rooted at \fB/proc\fR. The owner of
  20 each \fB/proc\fR file and subdirectory is determined by the user-ID of the
  21 process.
  22 .sp
  23 .LP
  24 \fB/proc\fR can be mounted on any mount point, in addition to the standard
  25 \fB/proc\fR mount point, and can be mounted several places at once. Such
  26 additional mounts are allowed in order to facilitate the confinement of
  27 processes to subtrees of the file system via \fBchroot\fR(1M) and yet allow
  28 such processes access to commands like \fBps\fR(1).


 877     uid_t pr_uid;            /* real user id */
 878     uid_t pr_euid;           /* effective user id */
 879     gid_t pr_gid;            /* real group id */
 880     gid_t pr_egid;           /* effective group id */
 881     uintptr_t pr_addr;       /* address of process */
 882     size_t pr_size;          /* size of process image in Kbytes */
 883     size_t pr_rssize;        /* resident set size in Kbytes */
 884     dev_t pr_ttydev;         /* controlling tty device (or PRNODEV) */
 885     ushort_t pr_pctcpu;      /* % of recent cpu time used by all lwps */
 886     ushort_t pr_pctmem;      /* % of system memory used by process */
 887     timestruc_t pr_start;    /* process start time, from the epoch */
 888     timestruc_t pr_time;     /* cpu time for this process */
 889     timestruc_t pr_ctime;    /* cpu time for reaped children */
 890     char pr_fname[PRFNSZ];   /* name of exec'ed file */
 891     char pr_psargs[PRARGSZ]; /* initial characters of arg list */
 892     int pr_wstat;            /* if zombie, the wait() status */
 893     int pr_argc;             /* initial argument count */
 894     uintptr_t pr_argv;       /* address of initial argument vector */
 895     uintptr_t pr_envp;       /* address of initial environment vector */
 896     char pr_dmodel;          /* data model of the process */

 897     taskid_t pr_taskid;      /* task id */
 898     projid_t pr_projid;      /* project id */
 899     poolid_t pr_poolid;      /* pool id */
 900     zoneid_t pr_zoneid;      /* zone id */
 901     ctid_t pr_contract;      /* process contract id */
 902     lwpsinfo_t pr_lwp;       /* information for representative lwp */
 903 } psinfo_t;
 904 .fi
 905 .in -2
 906 
 907 .sp
 908 .LP
 909 Some of the entries in \fBpsinfo\fR, such as \fBpr_addr\fR, refer to internal
 910 kernel data structures and should not be expected to retain their meanings
 911 across different versions of the operating system.
 912 .sp
 913 .LP
 914 \fBpsinfo_t.pr_flag\fR is a deprecated interface that should no longer be used.
 915 Applications currently relying on the \fBSSYS\fR bit in \fBpr_flag\fR should
 916 migrate to checking \fBPR_ISSYS\fR in the \fBpstatus\fR structure's
 917 \fBpr_flags\fR field.
 918 .sp
 919 .LP
 920 \fBpr_pctcpu\fR and \fBpr_pctmem\fR are 16-bit binary fractions in the range
 921 0.0 to 1.0 with the binary point to the right of the high-order bit (1.0 ==
 922 0x8000). \fBpr_pctcpu\fR is the summation over all lwps in the process.


1467 once existed but no longer exist in the process). Excluding the \fBpr_lwpid\fR,
1468 \fBpr_tstamp\fR, \fBpr_create\fR, and \fBpr_term\fR entries, the entry-by-entry
1469 summation over all these structures is the definition of the process usage
1470 information obtained from the \fBusage\fR file. (See also
1471 \fB/proc/\fR\fIpid\fR\fB/lwp/\fR\fIlwpid\fR/\fBlwpusage\fR, below.)
1472 .SS "lwp"
1473 .LP
1474 A directory containing entries each of which names an active or zombie lwp
1475 within the process. These entries are themselves directories containing
1476 additional files as described below. Only the \fBlwpsinfo\fR file exists in the
1477 directory of a zombie lwp.
1478 .SH STRUCTURE OF \fB/proc/\fR\fIpid\fR\fB/lwp/\fR\fIlwpid\fR
1479 .LP
1480 A given directory \fB/proc/\fR\fIpid\fR\fB/lwp/\fR\fIlwpid\fR contains the
1481 following entries:
1482 .SS "lwpctl"
1483 .LP
1484 Write-only control file. The messages written to this file affect the specific
1485 lwp rather than the representative lwp, as is the case for the process's
1486 \fBctl\fR file.
1487 .SS lwpname
1488 A buffer of \fBTHREAD_NAME_MAX\fR bytes representing the LWP name; the buffer is
1489 zero-filled if the thread name is shorter than the buffer. If no thread name is
1490 set, the buffer contains the empty string. A read with a buffer shorter than
1491 \fBTHREAD_NAME_MAX\fR bytes is not guaranteed to be NUL-terminated.  Writing to
1492 this file will set the LWP name for the specific lwp.  This file may not be
1493 present in older operating system versions. \fBTHREAD_NAME_MAX\fR may increase
1494 in the future; clients should be prepared for this.
1495 .SS "lwpstatus"
1496 .LP
1497 lwp-specific state information. This file contains the \fBlwpstatus\fR
1498 structure for the specific lwp as described above for the representative lwp in
1499 the process's \fBstatus\fR file.
1500 .SS "lwpsinfo"
1501 .LP
1502 lwp-specific \fBps\fR(1) information. This file contains the \fBlwpsinfo\fR
1503 structure for the specific lwp as described above for the representative lwp in
1504 the process's \fBpsinfo\fR file. The \fBlwpsinfo\fR file remains accessible
1505 after an lwp becomes a zombie.
1506 .SS "lwpusage"
1507 .LP
1508 This file contains the \fBprusage\fR structure for the specific lwp as
1509 described above for the process's \fBusage\fR file.
1510 .SS "gwindows"
1511 .LP
1512 This file exists only on SPARC based machines. If it is non-empty, it contains
1513 a \fBgwindows_t\fR structure, defined in \fB<sys/regset.h>\fR, with the values
1514 of those SPARC register windows that could not be stored on the stack when the