Print this page
OS-3820 lxbrand ptrace(2): the next generation
OS-3685 lxbrand PTRACE_O_TRACEFORK race condition
OS-3834 lxbrand 64-bit strace(1) reports 64-bit process as using x32 ABI
OS-3794 lxbrand panic on init signal death
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Bryan Cantrill <bryan@joyent.com>
OS-3463 expose process argv through procfs
OS-3207 in lx zone, 'ps auxww' does not show full cmdline for processes
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
OS-3383 lx brand: node.js test test-setproctitle.js fails
OS-15 add procfs equivalent to prctl(PR_SET_NAME)

Split Close
Expand all
Collapse all
          --- old/usr/src/man/man4/proc.4
          +++ new/usr/src/man/man4/proc.4
   1    1  '\" te
   2    2  .\" Copyright 1989 AT&T
   3    3  .\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved.
   4      -.\" Copyright (c) 2013, Joyent, Inc. All rights reserved.
        4 +.\" Copyright 2015, Joyent, Inc.
   5    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    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    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 "Mar 31, 2013"
        8 +.TH PROC 4 "May 19, 2014"
   9    9  .SH NAME
  10   10  proc \- /proc, the process file system
  11   11  .SH DESCRIPTION
  12      -.sp
  13   12  .LP
  14   13  \fB/proc\fR is a file system that provides access to the state of each process
  15   14  and light-weight process (lwp) in the system. The name of each entry in the
  16   15  \fB/proc\fR directory is a decimal number corresponding to a process-ID. These
  17   16  entries are themselves subdirectories. Access to process state is provided by
  18   17  additional files contained within each subdirectory; the hierarchy is described
  19   18  more completely below. In this document, ``\fB/proc\fR file'' refers to a
  20   19  non-directory file within the hierarchy rooted at \fB/proc\fR. The owner of
  21   20  each \fB/proc\fR file and subdirectory is determined by the user-ID of the
  22   21  process.
↓ open down ↓ 144 lines elided ↑ open up ↑
 167  166  process. The \fBpr_dmodel\fR field of the \fBstatus\fR files indicates the
 168  167  target process's data model.
 169  168  .sp
 170  169  .LP
 171  170  To help deal with system data structures that are read from 32-bit processes, a
 172  171  64-bit controlling program can be compiled with the C preprocessor symbol
 173  172  \fB_SYSCALL32\fR defined before system header files are included. This makes
 174  173  explicit 32-bit fixed-width data structures (like \fBcstruct stat32\fR) visible
 175  174  to the 64-bit program. See \fBtypes32.h\fR(3HEAD).
 176  175  .SH DIRECTORY STRUCTURE
 177      -.sp
 178  176  .LP
 179  177  At the top level, the directory \fB/proc\fR contains entries each of which
 180  178  names an existing process in the system. These entries are themselves
 181  179  directories. Except where otherwise noted, the files described below can be
 182  180  opened for reading only. In addition, if a process becomes a \fIzombie\fR (one
 183  181  that has exited but whose parent has not yet performed a \fBwait\fR(3C) upon
 184  182  it), most of its associated \fB/proc\fR files disappear from the hierarchy;
 185  183  subsequent attempts to open them, or to read or write files opened before the
 186  184  process exited, will elicit the error \fBENOENT\fR.
 187  185  .sp
↓ open down ↓ 6 lines elided ↑ open up ↑
 194  192  addition, atomicity is not guaranteed for \fBI/O\fR applied to the \fBas\fR
 195  193  (address-space) file for a running process or for a process whose address space
 196  194  contains memory shared by another running process.
 197  195  .sp
 198  196  .LP
 199  197  A number of structure definitions are used to describe the files. These
 200  198  structures may grow by the addition of elements at the end in future releases
 201  199  of the system and it is not legitimate for a program to assume that they will
 202  200  not.
 203  201  .SH STRUCTURE OF \fB/proc/\fR\fIpid\fR
 204      -.sp
 205  202  .LP
 206  203  A given directory \fB/proc/\fR\fIpid\fR contains the following entries. A
 207  204  process can use the invisible alias \fB/proc/self\fR if it wishes to open one
 208  205  of its own \fB/proc\fR files (invisible in the sense that the name ``self''
 209  206  does not appear in a directory listing of \fB/proc\fR obtained from
 210  207  \fBls\fR(1), \fBgetdents\fR(2), or \fBreaddir\fR(3C)).
 211  208  .SS "contracts"
 212      -.sp
 213  209  .LP
 214  210  A directory containing references to the contracts held by the process. Each
 215  211  entry is a symlink to the contract's directory under \fB/system/contract\fR.
 216  212  See \fBcontract\fR(4).
 217  213  .SS "as"
 218      -.sp
 219  214  .LP
 220  215  Contains the address-space image of the process; it can be opened for both
 221  216  reading and writing. \fBlseek\fR(2) is used to position the file at the virtual
 222  217  address of interest and then the address space can be examined or changed
 223  218  through \fBread\fR(2) or \fBwrite\fR(2) (or by using \fBpread\fR(2) or
 224  219  \fBpwrite\fR(2) for the combined operation).
 225  220  .SS "ctl"
 226      -.sp
 227  221  .LP
 228  222  A write-only file to which structured messages are written directing the system
 229  223  to change some aspect of the process's state or control its behavior in some
 230  224  way. The seek offset is not relevant when writing to this file. Individual lwps
 231  225  also have associated \fBlwpctl\fR files in the lwp subdirectories. A control
 232  226  message may be written either to the process's \fBctl\fR file or to a specific
 233  227  \fBlwpctl\fR file with operation-specific effects. The effect of a control
 234  228  message is immediately reflected in the state of the process visible through
 235  229  appropriate status and information files. The types of control messages are
 236  230  described in detail later. See \fBCONTROL MESSAGES\fR.
 237  231  .SS "status"
 238      -.sp
 239  232  .LP
 240  233  Contains state information about the process and the representative lwp. The
 241  234  file contains a \fBpstatus\fR structure which contains an embedded
 242  235  \fBlwpstatus\fR structure for the representative lwp, as follows:
 243  236  .sp
 244  237  .in +2
 245  238  .nf
 246  239  typedef struct pstatus {
 247  240       int pr_flags;            /* flags (see below) */
 248  241       int pr_nlwp;             /* number of active lwps in the process */
↓ open down ↓ 416 lines elided ↑ open up ↑
 665  658  .ne 2
 666  659  .na
 667  660  \fB\fBPR_SUSPENDED\fR\fR
 668  661  .ad
 669  662  .RS 17n
 670  663  indicates that the lwp stopped due to internal synchronization of lwps within
 671  664  the process. \fBpr_what\fR is unused in this case.
 672  665  .RE
 673  666  
 674  667  .sp
      668 +.ne 2
      669 +.na
      670 +\fB\fBPR_BRAND\fR\fR
      671 +.ad
      672 +.RS 17n
      673 +indicates that the lwp stopped for a brand-specific reason.  Interpretation
      674 +of the value of \fBpr_what\fR depends on which zone brand is in use.  It is
      675 +not generally expected that an lwp stopped in this state will be restarted
      676 +by native \fBproc\fR(4) consumers.
      677 +.RE
      678 +
      679 +.sp
 675  680  .LP
 676  681  \fBpr_cursig\fR names the current signal, that is, the next signal to be
 677  682  delivered to the lwp, if any. \fBpr_info\fR, when the lwp is in a
 678  683  \fBPR_SIGNALLED\fR or \fBPR_FAULTED\fR stop, contains additional information
 679  684  pertinent to the particular signal or fault (see \fB<sys/siginfo.h>\fR).
 680  685  .sp
 681  686  .LP
 682  687  \fBpr_lwppend\fR identifies any synchronous or directed signals pending for the
 683  688  lwp. \fBpr_lwphold\fR identifies those signals whose delivery is being blocked
 684  689  by the lwp (the signal mask).
↓ open down ↓ 172 lines elided ↑ open up ↑
 857  862  .sp
 858  863  .LP
 859  864  SPARC registers, both general and floating-point, as seen by a 64-bit
 860  865  controlling process are the V9 versions of the registers, even if the target
 861  866  process is a 32-bit (V8) process. V8 registers are a subset of the V9
 862  867  registers.
 863  868  .sp
 864  869  .LP
 865  870  If the lwp is not stopped, all register values are undefined.
 866  871  .SS "psinfo"
 867      -.sp
 868  872  .LP
 869  873  Contains miscellaneous information about the process and the representative lwp
 870  874  needed by the \fBps\fR(1) command. \fBpsinfo\fR remains accessible after a
 871  875  process becomes a \fIzombie\fR. The file contains a \fBpsinfo\fR structure
 872  876  which contains an embedded \fBlwpsinfo\fR structure for the representative lwp,
 873  877  as follows:
 874  878  .sp
 875  879  .in +2
 876  880  .nf
 877  881  typedef struct psinfo {
↓ open down ↓ 45 lines elided ↑ open up ↑
 923  927  Applications currently relying on the \fBSSYS\fR bit in \fBpr_flag\fR should
 924  928  migrate to checking \fBPR_ISSYS\fR in the \fBpstatus\fR structure's
 925  929  \fBpr_flags\fR field.
 926  930  .sp
 927  931  .LP
 928  932  \fBpr_pctcpu\fR and \fBpr_pctmem\fR are 16-bit binary fractions in the range
 929  933  0.0 to 1.0 with the binary point to the right of the high-order bit (1.0 ==
 930  934  0x8000). \fBpr_pctcpu\fR is the summation over all lwps in the process.
 931  935  .sp
 932  936  .LP
      937 +The \fBpr_fname\fR and \fBpr_psargs\fR are writable by the owner of the
      938 +process. To write to them, the \fBpsinfo\fR file should be open for writing
      939 +and the desired value for the field should be written at the file offset
      940 +that corresponds to the member of structure.  No other entry may be written
      941 +to; if a write is attempted to an offset that does not represent one of
      942 +these two memers, or if the size of the write is not exactly the size of
      943 +the member being written, no bytes will be written and zero will be returned.
      944 +.sp
      945 +.LP
 933  946  \fBpr_lwp\fR contains the \fBps\fR(1) information for the representative lwp.
 934  947  If the process is a \fIzombie\fR, \fBpr_nlwp\fR, \fBpr_nzomb\fR, and
 935  948  \fBpr_lwp.pr_lwpid\fR are zero and the other fields of \fBpr_lwp\fR are
 936  949  undefined:
 937  950  .sp
 938  951  .in +2
 939  952  .nf
 940  953  typedef struct lwpsinfo {
 941  954      int pr_flag;             /* lwp flags (DEPRECATED: see below) */
 942  955      id_t pr_lwpid;           /* lwp id */
↓ open down ↓ 33 lines elided ↑ open up ↑
 976  989  .sp
 977  990  .LP
 978  991  \fBpr_pctcpu\fR is a 16-bit binary fraction, as described above. It represents
 979  992  the \fBCPU\fR time used by the specific lwp. On a multi-processor machine, the
 980  993  maximum value is 1/N, where N is the number of \fBCPU\fRs.
 981  994  .sp
 982  995  .LP
 983  996  \fBpr_contract\fR is the id of the process contract of which the process is a
 984  997  member. See \fBcontract\fR(4) and \fBprocess\fR(4).
 985  998  .SS "cred"
 986      -.sp
 987  999  .LP
 988 1000  Contains a description of the credentials associated with the process:
 989 1001  .sp
 990 1002  .in +2
 991 1003  .nf
 992 1004  typedef struct prcred {
 993 1005          uid_t pr_euid;      /* effective user id */
 994 1006          uid_t pr_ruid;      /* real user id */
 995 1007          uid_t pr_suid;      /* saved user id (from exec) */
 996 1008          gid_t pr_egid;      /* effective group id */
↓ open down ↓ 6 lines elided ↑ open up ↑
1003 1015  .in -2
1004 1016  .sp
1005 1017  
1006 1018  .sp
1007 1019  .LP
1008 1020  The array of associated supplementary groups in \fBpr_groups\fR is of variable
1009 1021  length; the \fBcred\fR file contains all of the supplementary groups.
1010 1022  \fBpr_ngroups\fR indicates the number of supplementary groups. (See also the
1011 1023  \fBPCSCRED\fR and \fBPCSCREDX\fR control operations.)
1012 1024  .SS "priv"
1013      -.sp
1014 1025  .LP
1015 1026  Contains a description of the privileges associated with the process:
1016 1027  .sp
1017 1028  .in +2
1018 1029  .nf
1019 1030  typedef struct prpriv {
1020 1031       uint32_t        pr_nsets;      /* number of privilege set */
1021 1032       uint32_t        pr_setsize;    /* size of privilege set */
1022 1033       uint32_t        pr_infosize;   /* size of supplementary data */
1023 1034       priv_chunk_t    pr_sets[1];    /* array of sets */
↓ open down ↓ 13 lines elided ↑ open up ↑
1037 1048  
1038 1049  .sp
1039 1050  .LP
1040 1051  which is followed by additional information about the process state
1041 1052  \fBpr_infosize\fR bytes in size.
1042 1053  .sp
1043 1054  .LP
1044 1055  The full size of the structure can be computed using
1045 1056  \fBPRIV_PRPRIV_SIZE\fR(\fBprpriv_t *\fR).
1046 1057  .SS "sigact"
1047      -.sp
1048 1058  .LP
1049 1059  Contains an array of \fBsigaction structures\fR describing the current
1050 1060  dispositions of all signals associated with the traced process (see
1051 1061  \fBsigaction\fR(2)). Signal numbers are displaced by 1 from array indices, so
1052 1062  that the action for signal number \fIn\fR appears in position \fIn\fR-1 of the
1053 1063  array.
1054 1064  .SS "auxv"
1055      -.sp
1056 1065  .LP
1057 1066  Contains the initial values of the process's aux vector in an array of
1058 1067  \fBauxv_t\fR structures (see \fB<sys/auxv.h>\fR). The values are those that
1059 1068  were passed by the operating system as startup information to the dynamic
1060 1069  linker.
     1070 +.SS "argv"
     1071 +.LP
     1072 +Contains the concatenation of each of the argument strings, including their
     1073 +\fBNUL\fR terminators, in the argument vector (\fBargv\fR) for the process. If
     1074 +the process has modified either its argument vector, or the contents of any of
     1075 +the strings referenced by that vector, those changes will be visible here.
1061 1076  .SS "ldt"
1062      -.sp
1063 1077  .LP
1064 1078  This file exists only on x86-based machines. It is non-empty only if the
1065 1079  process has established a local descriptor table (\fBLDT\fR). If non-empty, the
1066 1080  file contains the array of currently active \fBLDT\fR entries in an array of
1067 1081  elements of type \fBstruct ssd\fR, defined in \fB<sys/sysi86.h>\fR, one element
1068 1082  for each active \fBLDT\fR entry.
1069 1083  .SS "map, xmap"
1070      -.sp
1071 1084  .LP
1072 1085  Contain information about the virtual address map of the process. The map file
1073 1086  contains an array of \fBprmap\fR structures while the xmap file contains an
1074 1087  array of \fBprxmap\fR structures. Each structure describes a contiguous virtual
1075 1088  address region in the address space of the traced process:
1076 1089  .sp
1077 1090  .in +2
1078 1091  .nf
1079 1092  typedef struct prmap {
1080 1093          uintptr_tpr_vaddr;         /* virtual address of mapping */
↓ open down ↓ 147 lines elided ↑ open up ↑
1228 1241  .LP
1229 1242  \fBpr_locked\fR is the number of locked pages for the mapping. Pages which are
1230 1243  locked are always resident in memory.
1231 1244  .sp
1232 1245  .LP
1233 1246  \fBpr_hatpagesize\fR is the size, in bytes, of the \fBHAT\fR (\fBMMU\fR)
1234 1247  translation for the mapping. \fBpr_hatpagesize\fR may be different than
1235 1248  \fBpr_pagesize.\fR The possible values are hardware architecture specific, and
1236 1249  may change over a mapping's lifetime.
1237 1250  .SS "rmap"
1238      -.sp
1239 1251  .LP
1240 1252  Contains information about the reserved address ranges of the process. The file
1241 1253  contains an array of \fBprmap\fR structures, as defined above for the \fBmap\fR
1242 1254  file. Each structure describes a contiguous virtual address region in the
1243 1255  address space of the traced process that is reserved by the system in the sense
1244 1256  that an \fBmmap\fR(2) system call that does not specify \fBMAP_FIXED\fR will
1245 1257  not use any part of it for the new mapping. Examples of such reservations
1246 1258  include the address ranges reserved for the process stack and the individual
1247 1259  thread stacks of a multi-threaded process.
1248 1260  .SS "cwd"
1249      -.sp
1250 1261  .LP
1251 1262  A symbolic link to the process's current working directory. See \fBchdir\fR(2).
1252 1263  A \fBreadlink\fR(2) of \fB/proc/\fIpid\fR/cwd\fR yields a null string. However,
1253 1264  it can be opened, listed, and searched as a directory, and can be the target of
1254 1265  \fBchdir\fR(2).
1255 1266  .SS "root"
1256      -.sp
1257 1267  .LP
1258 1268  A symbolic link to the process's root directory.
1259 1269  \fB/proc/\fR\fIpid\fR\fB/root\fR can differ from the system root directory if
1260 1270  the process or one of its ancestors executed \fBchroot\fR(2) as super user. It
1261 1271  has the same semantics as \fB/proc/\fR\fIpid\fR\fB/cwd\fR.
1262 1272  .SS "fd"
1263      -.sp
1264 1273  .LP
1265 1274  A directory containing references to the open files of the process. Each entry
1266 1275  is a decimal number corresponding to an open file descriptor in the process.
1267 1276  .sp
1268 1277  .LP
1269 1278  If an entry refers to a regular file, it can be opened with normal file system
1270 1279  semantics but, to ensure that the controlling process cannot gain greater
1271 1280  access than the controlled process, with no file access modes other than its
1272 1281  read/write open modes in the controlled process. If an entry refers to a
1273 1282  directory, it can be accessed with the same semantics as
1274 1283  \fB/proc/\fIpid\fR/cwd\fR. An attempt to open any other type of entry fails
1275 1284  with \fBEACCES\fR.
1276 1285  .SS "object"
1277      -.sp
1278 1286  .LP
1279 1287  A directory containing read-only files with names corresponding to the
1280 1288  \fBpr_mapname\fR entries in the \fBmap\fR and \fBpagedata\fR files. Opening
1281 1289  such a file yields a file descriptor for the underlying mapped file associated
1282 1290  with an address-space mapping in the process. The file name \fBa.out\fR appears
1283 1291  in the directory as an alias for the process's executable file.
1284 1292  .sp
1285 1293  .LP
1286 1294  The \fBobject\fR directory makes it possible for a controlling process to gain
1287 1295  access to the object file and any shared libraries (and consequently the symbol
1288 1296  tables) without having to know the actual path names of the executable files.
1289 1297  .SS "path"
1290      -.sp
1291 1298  .LP
1292 1299  A directory containing symbolic links to files opened by the process. The
1293 1300  directory includes one entry for \fBcwd\fR and \fBroot\fR. The directory also
1294 1301  contains a numerical entry for each file descriptor in the \fBfd\fR directory,
1295 1302  and entries matching those in the \fBobject\fR directory. If this information
1296 1303  is not available, any attempt to read the contents of the symbolic link will
1297 1304  fail. This is most common for files that do not exist in the filesystem
1298 1305  namespace (such as \fBFIFO\fRs and sockets), but can also happen for regular
1299 1306  files. For the file descriptor entries, the path may be different from the one
1300 1307  used by the process to open the file.
1301 1308  .SS "pagedata"
1302      -.sp
1303 1309  .LP
1304 1310  Opening the page data file enables tracking of address space references and
1305 1311  modifications on a per-page basis.
1306 1312  .sp
1307 1313  .LP
1308 1314  A \fBread\fR(2) of the page data file descriptor returns structured page data
1309 1315  and atomically clears the page data maintained for the file by the system. That
1310 1316  is to say, each read returns data collected since the last read; the first read
1311 1317  returns data collected since the file was opened. When the call completes, the
1312 1318  read buffer contains the following structure as its header and thereafter
↓ open down ↓ 61 lines elided ↑ open up ↑
1374 1380  \fBlseek\fR(2) to the page data file descriptor is ineffective; every read
1375 1381  starts from the beginning of the file. Closing the page data file descriptor
1376 1382  terminates the system overhead associated with collecting the data.
1377 1383  .sp
1378 1384  .LP
1379 1385  More than one page data file descriptor for the same process can be opened, up
1380 1386  to a system-imposed limit per traced process. A read of one does not affect the
1381 1387  data being collected by the system for the others. An open of the page data
1382 1388  file will fail with \fBENOMEM\fR if the system-imposed limit would be exceeded.
1383 1389  .SS "watch"
1384      -.sp
1385 1390  .LP
1386 1391  Contains an array of \fBprwatch\fR structures, one for each watched area
1387 1392  established by the \fBPCWATCH\fR control operation. See \fBPCWATCH\fR for
1388 1393  details.
1389 1394  .SS "usage"
1390      -.sp
1391 1395  .LP
1392 1396  Contains process usage information described by a \fBprusage\fR structure which
1393 1397  contains at least the following fields:
1394 1398  .sp
1395 1399  .in +2
1396 1400  .nf
1397 1401  typedef struct prusage {
1398 1402      id_t pr_lwpid;           /* lwp id.  0: process or defunct */
1399 1403      int pr_count;            /* number of contributing lwps */
1400 1404      timestruc_t pr_tstamp;   /* real time stamp, time of read() */
↓ open down ↓ 26 lines elided ↑ open up ↑
1427 1431  .fi
1428 1432  .in -2
1429 1433  
1430 1434  .sp
1431 1435  .LP
1432 1436  Microstate accounting is now continuously enabled. While this information was
1433 1437  previously an estimate, if microstate accounting were not enabled, the current
1434 1438  information is now never an estimate represents time the process has spent in
1435 1439  various states.
1436 1440  .SS "lstatus"
1437      -.sp
1438 1441  .LP
1439 1442  Contains a \fBprheader\fR structure followed by an array of \fBlwpstatus\fR
1440 1443  structures, one for each active lwp in the process (see also
1441 1444  \fB/proc/\fR\fIpid\fR\fB/lwp/\fR\fIlwpid\fR/\fBlwpstatus\fR, below). The
1442 1445  \fBprheader\fR structure describes the number and size of the array entries
1443 1446  that follow.
1444 1447  .sp
1445 1448  .in +2
1446 1449  .nf
1447 1450  typedef struct prheader {
↓ open down ↓ 4 lines elided ↑ open up ↑
1452 1455  .in -2
1453 1456  
1454 1457  .sp
1455 1458  .LP
1456 1459  The \fBlwpstatus\fR structure may grow by the addition of elements at the end
1457 1460  in future releases of the system. Programs must use \fBpr_entsize\fR in the
1458 1461  file header to index through the array. These comments apply to all \fB/proc\fR
1459 1462  files that include a \fBprheader\fR structure (\fBlpsinfo\fR and \fBlusage\fR,
1460 1463  below).
1461 1464  .SS "lpsinfo"
1462      -.sp
1463 1465  .LP
1464 1466  Contains a \fBprheader\fR structure followed by an array of \fBlwpsinfo\fR
1465 1467  structures, one for eachactive and zombie lwp in the process. See also
1466 1468  \fB/proc/\fR\fIpid\fR\fB/lwp/\fR\fIlwpid\fR/\fBlwpsinfo\fR, below.
1467 1469  .SS "lusage"
1468      -.sp
1469 1470  .LP
1470 1471  Contains a \fBprheader\fR structure followed by an array of \fBprusage\fR
1471 1472  structures, one for each active lwp in the process, plus an additional element
1472 1473  at the beginning that contains the summation over all defunct lwps (lwps that
1473 1474  once existed but no longer exist in the process). Excluding the \fBpr_lwpid\fR,
1474 1475  \fBpr_tstamp\fR, \fBpr_create\fR, and \fBpr_term\fR entries, the entry-by-entry
1475 1476  summation over all these structures is the definition of the process usage
1476 1477  information obtained from the \fBusage\fR file. (See also
1477 1478  \fB/proc/\fR\fIpid\fR\fB/lwp/\fR\fIlwpid\fR/\fBlwpusage\fR, below.)
1478 1479  .SS "lwp"
1479      -.sp
1480 1480  .LP
1481 1481  A directory containing entries each of which names an active or zombie lwp
1482 1482  within the process. These entries are themselves directories containing
1483 1483  additional files as described below. Only the \fBlwpsinfo\fR file exists in the
1484 1484  directory of a zombie lwp.
1485 1485  .SH STRUCTURE OF \fB/proc/\fR\fIpid\fR\fB/lwp/\fR\fIlwpid\fR
1486      -.sp
1487 1486  .LP
1488 1487  A given directory \fB/proc/\fR\fIpid\fR\fB/lwp/\fR\fIlwpid\fR contains the
1489 1488  following entries:
1490 1489  .SS "lwpctl"
1491      -.sp
1492 1490  .LP
1493 1491  Write-only control file. The messages written to this file affect the specific
1494 1492  lwp rather than the representative lwp, as is the case for the process's
1495 1493  \fBctl\fR file.
1496 1494  .SS "lwpstatus"
1497      -.sp
1498 1495  .LP
1499 1496  lwp-specific state information. This file contains the \fBlwpstatus\fR
1500 1497  structure for the specific lwp as described above for the representative lwp in
1501 1498  the process's \fBstatus\fR file.
1502 1499  .SS "lwpsinfo"
1503      -.sp
1504 1500  .LP
1505 1501  lwp-specific \fBps\fR(1) information. This file contains the \fBlwpsinfo\fR
1506 1502  structure for the specific lwp as described above for the representative lwp in
1507 1503  the process's \fBpsinfo\fR file. The \fBlwpsinfo\fR file remains accessible
1508 1504  after an lwp becomes a zombie.
1509 1505  .SS "lwpusage"
1510      -.sp
1511 1506  .LP
1512 1507  This file contains the \fBprusage\fR structure for the specific lwp as
1513 1508  described above for the process's \fBusage\fR file.
1514 1509  .SS "gwindows"
1515      -.sp
1516 1510  .LP
1517 1511  This file exists only on SPARC based machines. If it is non-empty, it contains
1518 1512  a \fBgwindows_t\fR structure, defined in \fB<sys/regset.h>\fR, with the values
1519 1513  of those SPARC register windows that could not be stored on the stack when the
1520 1514  lwp stopped. Conditions under which register windows are not stored on the
1521 1515  stack are: the stack pointer refers to nonexistent process memory or the stack
1522 1516  pointer is improperly aligned. If the lwp is not stopped or if there are no
1523 1517  register windows that could not be stored on the stack, the file is empty (the
1524 1518  usual case).
1525 1519  .SS "xregs"
1526      -.sp
1527 1520  .LP
1528 1521  Extra state registers. The extra state register set is architecture dependent;
1529 1522  this file is empty if the system does not support extra state registers. If the
1530 1523  file is non-empty, it contains an architecture dependent structure of type
1531 1524  \fBprxregset_t\fR, defined in \fB<procfs.h>\fR, with the values of the lwp's
1532 1525  extra state registers. If the lwp is not stopped, all register values are
1533 1526  undefined. See also the \fBPCSXREG\fR control operation, below.
1534 1527  .SS "asrs"
1535      -.sp
1536 1528  .LP
1537 1529  This file exists only for 64-bit SPARC V9 processes. It contains an
1538 1530  \fBasrset_t\fR structure, defined in <\fBsys/regset.h\fR>, containing the
1539 1531  values of the lwp's platform-dependent ancillary state registers. If the lwp is
1540 1532  not stopped, all register values are undefined. See also the \fBPCSASRS\fR
1541 1533  control operation, below.
1542 1534  .SS "spymaster"
1543      -.sp
1544 1535  .LP
1545 1536  For an agent lwp (see \fBPCAGENT\fR), this file contains a \fBpsinfo_t\fR
1546 1537  structure that corresponds to the process that created the agent lwp at the
1547 1538  time the agent was created. This structure is identical to that retrieved via
1548 1539  the \fBpsinfo\fR file, with one modification: the \fBpr_time\fR field does not
1549 1540  correspond to the CPU time for the process, but rather to the creation time of
1550 1541  the agent lwp.
1551 1542  .SS "templates"
1552      -.sp
1553 1543  .LP
1554 1544  A directory which contains references to the active templates for the lwp,
1555 1545  named by the contract type. Changes made to an active template descriptor do
1556 1546  not affect the original template which was activated, though they do affect the
1557 1547  active template. It is not possible to activate an active template descriptor.
1558 1548  See \fBcontract\fR(4).
1559 1549  .SH CONTROL MESSAGES
1560      -.sp
1561 1550  .LP
1562 1551  Process state changes are effected through messages written to a process's
1563 1552  \fBctl\fR file or to an individual lwp's \fBlwpctl\fR file. All control
1564 1553  messages consist of a \fBlong\fR that names the specific operation followed by
1565 1554  additional data containing the operand, if any.
1566 1555  .sp
1567 1556  .LP
1568 1557  Multiple control messages may be combined in a single \fBwrite\fR(2) (or
1569 1558  \fBwritev\fR(2)) to a control file, but no partial writes are permitted. That
1570 1559  is, each control message, operation code plus operand, if any, must be
1571 1560  presented in its entirety to the \fBwrite\fR(2) and not in pieces over several
1572 1561  system calls. If a control operation fails, no subsequent operations contained
1573 1562  in the same \fBwrite\fR(2) are attempted.
1574 1563  .sp
1575 1564  .LP
1576 1565  Descriptions of the allowable control messages follow. In all cases, writing a
1577 1566  message to a control file for a process or lwp that has terminated elicits the
1578 1567  error \fBENOENT\fR.
1579 1568  .SS "PCSTOP PCDSTOP PCWSTOP PCTWSTOP"
1580      -.sp
1581 1569  .LP
1582 1570  When applied to the process control file, \fBPCSTOP\fR directs all lwps to stop
1583 1571  and waits for them to stop, \fBPCDSTOP\fR directs all lwps to stop without
1584 1572  waiting for them to stop, and \fBPCWSTOP\fR simply waits for all lwps to stop.
1585 1573  When applied to an lwp control file, \fBPCSTOP\fR directs the specific lwp to
1586 1574  stop and waits until it has stopped, \fBPCDSTOP\fR directs the specific lwp to
1587 1575  stop without waiting for it to stop, and \fBPCWSTOP\fR simply waits for the
1588 1576  specific lwp to stop. When applied to an lwp control file, \fBPCSTOP\fR and
1589 1577  \fBPCWSTOP\fR complete when the lwp stops on an event of interest, immediately
1590 1578  if already so stopped; when applied to the process control file, they complete
↓ open down ↓ 28 lines elided ↑ open up ↑
1619 1607  interrupted, the lwp stop directives remain in effect even though the
1620 1608  \fBwrite\fR(2) returns an error. (Use of \fBPCTWSTOP\fR with a non-zero timeout
1621 1609  is recommended over \fBPCWSTOP\fR with an \fBalarm\fR(2).)
1622 1610  .sp
1623 1611  .LP
1624 1612  A system process (indicated by the \fBPR_ISSYS\fR flag) never executes at user
1625 1613  level, has no user-level address space visible through \fB/proc\fR, and cannot
1626 1614  be stopped. Applying one of these operations to a system process or any of its
1627 1615  lwps elicits the error \fBEBUSY\fR.
1628 1616  .SS "PCRUN"
1629      -.sp
1630 1617  .LP
1631 1618  Make an lwp runnable again after a stop. This operation takes a \fBlong\fR
1632 1619  operand containing zero or more of the following flags:
1633 1620  .sp
1634 1621  .ne 2
1635 1622  .na
1636 1623  \fB\fBPRCSIG\fR\fR
1637 1624  .ad
1638 1625  .RS 12n
1639 1626  clears the current signal, if any (see \fBPCCSIG\fR).
↓ open down ↓ 60 lines elided ↑ open up ↑
1700 1687  the operation as described for \fB/proc/\fR\fIpid\fR\fB/status\fR. The
1701 1688  operation fails with \fBEBUSY\fR if the representative lwp is not stopped on an
1702 1689  event of interest or has not been directed to stop or if the agent lwp exists.
1703 1690  If \fBPRSTEP\fR or \fBPRSTOP\fR was requested, the representative lwp is made
1704 1691  runnable and its outstanding directed-stop request is cleared; otherwise all
1705 1692  outstanding directed-stop requests are cleared and, if it was stopped on an
1706 1693  event of interest, the representative lwp is marked \fBPR_REQUESTED\fR. If, as
1707 1694  a consequence, all lwps are in the \fBPR_REQUESTED\fR or \fBPR_SUSPENDED\fR
1708 1695  stop state, all lwps showing \fBPR_REQUESTED\fR are made runnable.
1709 1696  .SS "PCSTRACE"
1710      -.sp
1711 1697  .LP
1712 1698  Define a set of signals to be traced in the process. The receipt of one of
1713 1699  these signals by an lwp causes the lwp to stop. The set of signals is defined
1714 1700  using an operand \fBsigset_t\fR contained in the control message. Receipt of
1715 1701  \fBSIGKILL\fR cannot be traced; if specified, it is silently ignored.
1716 1702  .sp
1717 1703  .LP
1718 1704  If a signal that is included in an lwp's held signal set (the signal mask) is
1719 1705  sent to the lwp, the signal is not received and does not cause a stop until it
1720 1706  is removed from the held signal set, either by the lwp itself or by setting the
1721 1707  held signal set with \fBPCSHOLD\fR.
1722 1708  .SS "PCCSIG"
1723      -.sp
1724 1709  .LP
1725 1710  The current signal, if any, is cleared from the specific or representative lwp.
1726 1711  .SS "PCSSIG"
1727      -.sp
1728 1712  .LP
1729 1713  The current signal and its associated signal information for the specific or
1730 1714  representative lwp are set according to the contents of the operand
1731 1715  \fBsiginfo\fR structure (see \fB<sys/siginfo.h>\fR). If the specified signal
1732 1716  number is zero, the current signal is cleared. The semantics of this operation
1733 1717  are different from those of \fBkill\fR(2) in that the signal is delivered to
1734 1718  the lwp immediately after execution is resumed (even if it is being blocked)
1735 1719  and an additional \fBPR_SIGNALLED\fR stop does not intervene even if the signal
1736 1720  is traced. Setting the current signal to \fBSIGKILL\fR terminates the process
1737 1721  immediately.
1738 1722  .SS "PCKILL"
1739      -.sp
1740 1723  .LP
1741 1724  If applied to the process control file, a signal is sent to the process with
1742 1725  semantics identical to those of \fBkill\fR(2). If applied to an lwp control
1743 1726  file, a directed signal is sent to the specific lwp. The signal is named in a
1744 1727  \fBlong\fR operand contained in the message. Sending \fBSIGKILL\fR terminates
1745 1728  the process immediately.
1746 1729  .SS "PCUNKILL"
1747      -.sp
1748 1730  .LP
1749 1731  A signal is deleted, that is, it is removed from the set of pending signals. If
1750 1732  applied to the process control file, the signal is deleted from the process's
1751 1733  pending signals. If applied to an lwp control file, the signal is deleted from
1752 1734  the lwp's pending signals. The current signal (if any) is unaffected. The
1753 1735  signal is named in a \fBlong\fR operand in the control message. It is an error
1754 1736  (\fBEINVAL\fR) to attempt to delete \fBSIGKILL\fR.
1755 1737  .SS "PCSHOLD"
1756      -.sp
1757 1738  .LP
1758 1739  Set the set of held signals for the specific or representative lwp (signals
1759 1740  whose delivery will be blocked if sent to the lwp). The set of signals is
1760 1741  specified with a \fBsigset_t\fR operand. \fBSIGKILL\fR and \fBSIGSTOP\fR cannot
1761 1742  be held; if specified, they are silently ignored.
1762 1743  .SS "PCSFAULT"
1763      -.sp
1764 1744  .LP
1765 1745  Define a set of hardware faults to be traced in the process. On incurring one
1766 1746  of these faults, an lwp stops. The set is defined via the operand
1767 1747  \fBfltset_t\fR structure. Fault names are defined in \fB<sys/fault.h>\fR and
1768 1748  include the following. Some of these may not occur on all processors; there may
1769 1749  be processor-specific faults in addition to these.
1770 1750  .sp
1771 1751  .ne 2
1772 1752  .na
1773 1753  \fB\fBFLTILL\fR\fR
↓ open down ↓ 104 lines elided ↑ open up ↑
1878 1858  .sp
1879 1859  .LP
1880 1860  When not traced, a fault normally results in the posting of a signal to the lwp
1881 1861  that incurred the fault. If an lwp stops on a fault, the signal is posted to
1882 1862  the lwp when execution is resumed unless the fault is cleared by \fBPCCFAULT\fR
1883 1863  or by the \fBPRCFAULT\fR option of \fBPCRUN\fR. \fBFLTPAGE\fR is an exception;
1884 1864  no signal is posted. The \fBpr_info\fR field in the \fBlwpstatus\fR structure
1885 1865  identifies the signal to be sent and contains machine-specific information
1886 1866  about the fault.
1887 1867  .SS "PCCFAULT"
1888      -.sp
1889 1868  .LP
1890 1869  The current fault, if any, is cleared; the associated signal will not be sent
1891 1870  to the specific or representative lwp.
1892 1871  .SS "PCSENTRY PCSEXIT"
1893      -.sp
1894 1872  .LP
1895 1873  These control operations instruct the process's lwps to stop on entry to or
1896 1874  exit from specified system calls. The set of system calls to be traced is
1897 1875  defined via an operand \fBsysset_t\fR structure.
1898 1876  .sp
1899 1877  .LP
1900 1878  When entry to a system call is being traced, an lwp stops after having begun
1901 1879  the call to the system but before the system call arguments have been fetched
1902 1880  from the lwp. When exit from a system call is being traced, an lwp stops on
1903 1881  completion of the system call just prior to checking for signals and returning
1904 1882  to user level. At this point, all return values have been stored into the lwp's
1905 1883  registers.
1906 1884  .sp
1907 1885  .LP
1908 1886  If an lwp is stopped on entry to a system call (\fBPR_SYSENTRY\fR) or when
1909 1887  sleeping in an interruptible system call (\fBPR_ASLEEP\fR is set), it may be
1910 1888  instructed to go directly to system call exit by specifying the \fBPRSABORT\fR
1911 1889  flag in a \fBPCRUN\fR control message. Unless exit from the system call is
1912 1890  being traced, the lwp returns to user level showing \fBEINTR\fR.
1913 1891  .SS "PCWATCH"
1914      -.sp
1915 1892  .LP
1916 1893  Set or clear a watched area in the controlled process from a \fBprwatch\fR
1917 1894  structure operand:
1918 1895  .sp
1919 1896  .in +2
1920 1897  .nf
1921 1898  typedef struct prwatch {
1922 1899      uintptr_t pr_vaddr;  /* virtual address of watched area */
1923 1900      size_t pr_size;      /* size of watched area in bytes */
1924 1901      int pr_wflags;       /* watch type flags */
↓ open down ↓ 128 lines elided ↑ open up ↑
2053 2030  entered, watchpoint traps occur normally. On SPARC based machines, register
2054 2031  window overflow and underflow will not trigger watchpoint traps, even if the
2055 2032  register window save areas cover watched areas of the stack.
2056 2033  .sp
2057 2034  .LP
2058 2035  Watched areas are not inherited by child processes, even if the traced
2059 2036  process's inherit-on-fork mode, \fBPR_FORK\fR, is set (see \fBPCSET\fR, below).
2060 2037  All watched areas are cancelled when the traced process performs a successful
2061 2038  \fBexec\fR(2).
2062 2039  .SS "PCSET PCUNSET"
2063      -.sp
2064 2040  .LP
2065 2041  \fBPCSET\fR sets one or more modes of operation for the traced process.
2066 2042  \fBPCUNSET\fR unsets these modes. The modes to be set or unset are specified by
2067 2043  flags in an operand \fBlong\fR in the control message:
2068 2044  .sp
2069 2045  .ne 2
2070 2046  .na
2071 2047  \fB\fBPR_FORK\fR\fR
2072 2048  .ad
2073 2049  .RS 13n
↓ open down ↓ 95 lines elided ↑ open up ↑
2169 2145  function using \fB/proc\fR.
2170 2146  .RE
2171 2147  
2172 2148  .sp
2173 2149  .LP
2174 2150  It is an error (\fBEINVAL\fR) to specify flags other than those described above
2175 2151  or to apply these operations to a system process. The current modes are
2176 2152  reported in the \fBpr_flags\fR field of \fB/proc/\fR\fIpid\fR\fB/status\fR and
2177 2153  \fB/proc/\fR\fIpid\fR\fB/lwp/\fR\fIlwp\fR\fB/lwpstatus\fR.
2178 2154  .SS "PCSREG"
2179      -.sp
2180 2155  .LP
2181 2156  Set the general registers for the specific or representative lwp according to
2182 2157  the operand \fBprgregset_t\fR structure.
2183 2158  .sp
2184 2159  .LP
2185 2160  On SPARC based systems, only the condition-code bits of the processor-status
2186 2161  register (R_PSR) of SPARC V8 (32-bit) processes can be modified by
2187 2162  \fBPCSREG\fR. Other privileged registers cannot be modified at all.
2188 2163  .sp
2189 2164  .LP
2190 2165  On x86-based systems, only certain bits of the flags register (EFL) can be
2191 2166  modified by \fBPCSREG\fR: these include the condition codes, direction-bit, and
2192 2167  overflow-bit.
2193 2168  .sp
2194 2169  .LP
2195 2170  \fBPCSREG\fR fails with \fBEBUSY\fR if the lwp is not stopped on an event of
2196 2171  interest.
2197 2172  .SS "PCSVADDR"
2198      -.sp
2199 2173  .LP
2200 2174  Set the address at which execution will resume for the specific or
2201 2175  representative lwp from the operand \fBlong\fR. On SPARC based systems, both
2202 2176  %pc and %npc are set, with %npc set to the instruction following the virtual
2203 2177  address. On x86-based systems, only %eip is set. \fBPCSVADDR\fR fails with
2204 2178  \fBEBUSY\fR if the lwp is not stopped on an event of interest.
2205 2179  .SS "PCSFPREG"
2206      -.sp
2207 2180  .LP
2208 2181  Set the floating-point registers for the specific or representative lwp
2209 2182  according to the operand \fBprfpregset_t\fR structure. An error (\fBEINVAL\fR)
2210 2183  is returned if the system does not support floating-point operations (no
2211 2184  floating-point hardware and the system does not emulate floating-point machine
2212 2185  instructions). \fBPCSFPREG\fR fails with \fBEBUSY\fR if the lwp is not stopped
2213 2186  on an event of interest.
2214 2187  .SS "PCSXREG"
2215      -.sp
2216 2188  .LP
2217 2189  Set the extra state registers for the specific or representative lwp according
2218 2190  to the architecture-dependent operand \fBprxregset_t\fR structure. An error
2219 2191  (\fBEINVAL\fR) is returned if the system does not support extra state
2220 2192  registers. \fBPCSXREG\fR fails with \fBEBUSY\fR if the lwp is not stopped on an
2221 2193  event of interest.
2222 2194  .SS "PCSASRS"
2223      -.sp
2224 2195  .LP
2225 2196  Set the ancillary state registers for the specific or representative lwp
2226 2197  according to the SPARC V9 platform-dependent operand \fBasrset_t\fR structure.
2227 2198  An error (\fBEINVAL\fR) is returned if either the target process or the
2228 2199  controlling process is not a 64-bit SPARC V9 process. Most of the ancillary
2229 2200  state registers are privileged registers that cannot be modified. Only those
2230 2201  that can be modified are set; all others are silently ignored. \fBPCSASRS\fR
2231 2202  fails with \fBEBUSY\fR if the lwp is not stopped on an event of interest.
2232 2203  .SS "PCAGENT"
2233      -.sp
2234 2204  .LP
2235 2205  Create an agent lwp in the controlled process with register values from the
2236 2206  operand \fBprgregset_t\fR structure (see \fBPCSREG\fR, above). The agent lwp is
2237 2207  created in the stopped state showing \fBPR_REQUESTED\fR and with its held
2238 2208  signal set (the signal mask) having all signals except \fBSIGKILL\fR and
2239 2209  \fBSIGSTOP\fR blocked.
2240 2210  .sp
2241 2211  .LP
2242 2212  The \fBPCAGENT\fR operation fails with \fBEBUSY\fR unless the process is fully
2243 2213  stopped via \fB/proc\fR, that is, unless all of the lwps in the process are
↓ open down ↓ 40 lines elided ↑ open up ↑
2284 2254  .sp
2285 2255  .LP
2286 2256  The agent lwp is not allowed to execute any variation of the \fBSYS_fork\fR or
2287 2257  \fBSYS_exec\fR system call traps. Attempts to do so yield \fBENOTSUP\fR to the
2288 2258  agent lwp.
2289 2259  .sp
2290 2260  .LP
2291 2261  Symbolic constants for system call trap numbers like \fBSYS_lwp_exit\fR and
2292 2262  \fBSYS_lwp_create\fR can be found in the header file <\fBsys/syscall.h\fR>.
2293 2263  .SS "PCREAD PCWRITE"
2294      -.sp
2295 2264  .LP
2296 2265  Read or write the target process's address space via a \fBpriovec\fR structure
2297 2266  operand:
2298 2267  .sp
2299 2268  .in +2
2300 2269  .nf
2301 2270  typedef struct priovec {
2302 2271      void *pio_base;      /* buffer in controlling process */
2303 2272      size_t pio_len;      /* size of read/write request in bytes */
2304 2273      off_t pio_offset;    /* virtual address in target process */
↓ open down ↓ 6 lines elided ↑ open up ↑
2311 2280  These operations have the same effect as \fBpread\fR(2) and \fBpwrite\fR(2),
2312 2281  respectively, of the target process's address space file. The difference is
2313 2282  that more than one \fBPCREAD\fR or \fBPCWRITE\fR control operation can be
2314 2283  written to the control file at once, and they can be interspersed with other
2315 2284  control operations in a single write to the control file. This is useful, for
2316 2285  example, when planting many breakpoint instructions in the process's address
2317 2286  space, or when stepping over a breakpointed instruction. Unlike \fBpread\fR(2)
2318 2287  and \fBpwrite\fR(2), no provision is made for partial reads or writes; if the
2319 2288  operation cannot be performed completely, it fails with \fBEIO\fR.
2320 2289  .SS "PCNICE"
2321      -.sp
2322 2290  .LP
2323 2291  The traced process's \fBnice\fR(2) value is incremented by the amount in the
2324 2292  operand \fBlong\fR. Only a process with the {\fBPRIV_PROC_PRIOCNTL\fR}
2325 2293  privilege asserted in its effective set can better a process's priority in this
2326 2294  way, but any user may lower the priority. This operation is not meaningful for
2327 2295  all scheduling classes.
2328 2296  .SS "PCSCRED"
2329      -.sp
2330 2297  .LP
2331 2298  Set the target process credentials to the values contained in the
2332 2299  \fBprcred_t\fR structure operand (see \fB/proc/\fR\fIpid\fR\fB/cred\fR). The
2333 2300  effective, real, and saved user-IDs and group-IDs of the target process are
2334 2301  set. The target process's supplementary groups are not changed; the
2335 2302  \fBpr_ngroups\fR and \fBpr_groups\fR members of the structure operand are
2336 2303  ignored. Only the privileged processes can perform this operation; for all
2337 2304  others it fails with \fBEPERM\fR.
2338 2305  .SS "PCSCREDX"
2339      -.sp
2340 2306  .LP
2341 2307  Operates like \fBPCSCRED\fR but also sets the supplementary groups; the length
2342 2308  of the data written with this control operation should be "sizeof
2343 2309  (\fBprcred_t\fR) + sizeof (\fBgid_t)\fR * (#groups - 1)".
2344 2310  .SS "PCSPRIV"
2345      -.sp
2346 2311  .LP
2347 2312  Set the target process privilege to the values contained in the \fBprpriv_t\fR
2348 2313  operand (see \fB/proc/pid/priv\fR). The effective, permitted, inheritable, and
2349 2314  limit sets are all changed. Privilege flags can also be set. The process is
2350 2315  made privilege aware unless it can relinquish privilege awareness. See
2351 2316  \fBprivileges\fR(5).
2352 2317  .sp
2353 2318  .LP
2354 2319  The limit set of the target process cannot be grown. The other privilege sets
2355 2320  must be subsets of the intersection of the effective set of the calling process
2356 2321  with the new limit set of the target process or subsets of the original values
2357 2322  of the sets in the target process.
2358 2323  .sp
2359 2324  .LP
2360 2325  If any of the above restrictions are not met, \fBEPERM\fR is returned. If the
2361 2326  structure written is improperly formatted, \fBEINVAL\fR is returned.
2362 2327  .SH PROGRAMMING NOTES
2363      -.sp
2364 2328  .LP
2365 2329  For security reasons, except for the \fBpsinfo\fR, \fBusage\fR, \fBlpsinfo\fR,
2366 2330  \fBlusage\fR, \fBlwpsinfo\fR, and \fBlwpusage\fR files, which are
2367 2331  world-readable, and except for privileged processes, an open of a \fB/proc\fR
2368 2332  file fails unless both the user-ID and group-ID of the caller match those of
2369 2333  the traced process and the process's object file is readable by the caller. The
2370 2334  effective set of the caller is a superset of both the inheritable and the
2371 2335  permitted set of the target process. The limit set of the caller is a superset
2372 2336  of the limit set of the target process. Except for the world-readable files
2373 2337  just mentioned, files corresponding to setuid and setgid processes can be
↓ open down ↓ 38 lines elided ↑ open up ↑
2412 2376  requested and returned, either of the polling events \fBPOLLPRI\fR or
2413 2377  \fBPOLLWRNORM\fR indicates that the process or lwp stopped on an event of
2414 2378  interest. Although they cannot be requested, the polling events \fBPOLLHUP\fR,
2415 2379  \fBPOLLERR\fR, and \fBPOLLNVAL\fR may be returned. \fBPOLLHUP\fR indicates that
2416 2380  the process or lwp has terminated. \fBPOLLERR\fR indicates that the file
2417 2381  descriptor has become invalid. \fBPOLLNVAL\fR is returned immediately if
2418 2382  \fBPOLLPRI\fR or \fBPOLLWRNORM\fR is requested on a file descriptor referring
2419 2383  to a system process (see \fBPCSTOP\fR). The requested events may be empty to
2420 2384  wait simply for termination.
2421 2385  .SH FILES
2422      -.sp
2423 2386  .ne 2
2424 2387  .na
2425 2388  \fB\fB/proc\fR\fR
2426 2389  .ad
2427 2390  .sp .6
2428 2391  .RS 4n
2429 2392  directory (list of processes)
2430 2393  .RE
2431 2394  
2432 2395  .sp
↓ open down ↓ 142 lines elided ↑ open up ↑
2575 2538  \fB\fB/proc/\fIpid\fR/auxv\fR\fR
2576 2539  .ad
2577 2540  .sp .6
2578 2541  .RS 4n
2579 2542  process aux vector
2580 2543  .RE
2581 2544  
2582 2545  .sp
2583 2546  .ne 2
2584 2547  .na
     2548 +\fB\fB/proc/\fIpid\fR/argv\fR\fR
     2549 +.ad
     2550 +.sp .6
     2551 +.RS 4n
     2552 +process argument vector
     2553 +.RE
     2554 +
     2555 +.sp
     2556 +.ne 2
     2557 +.na
2585 2558  \fB\fB/proc/\fIpid\fR/ldt\fR\fR
2586 2559  .ad
2587 2560  .sp .6
2588 2561  .RS 4n
2589 2562  process \fBLDT\fR (x86 only)
2590 2563  .RE
2591 2564  
2592 2565  .sp
2593 2566  .ne 2
2594 2567  .na
↓ open down ↓ 218 lines elided ↑ open up ↑
2813 2786  .ne 2
2814 2787  .na
2815 2788  \fB\fB/proc/\fIpid\fR/lwp/\fIlwpid\fR/spymaster\fR\fR
2816 2789  .ad
2817 2790  .sp .6
2818 2791  .RS 4n
2819 2792  For an agent LWP, the controlling process
2820 2793  .RE
2821 2794  
2822 2795  .SH SEE ALSO
2823      -.sp
2824 2796  .LP
2825 2797  \fBls\fR(1), \fBps\fR(1), \fBchroot\fR(1M), \fBalarm\fR(2), \fBbrk\fR(2),
2826 2798  \fBchdir\fR(2), \fBchroot\fR(2), \fBclose\fR(2), \fBcreat\fR(2), \fBdup\fR(2),
2827 2799  \fBexec\fR(2), \fBfcntl\fR(2), \fBfork\fR(2), \fBfork1\fR(2), \fBfstat\fR(2),
2828 2800  \fBgetdents\fR(2), \fBgetustack\fR(2), \fBkill\fR(2), \fBlseek\fR(2),
2829 2801  \fBmmap\fR(2), \fBnice\fR(2), \fBopen\fR(2), \fBpoll\fR(2), \fBpread\fR(2),
2830 2802  \fBptrace\fR(3C), \fBpwrite\fR(2), \fBread\fR(2), \fBreadlink\fR(2),
2831 2803  \fBreadv\fR(2), \fBshmget\fR(2), \fBsigaction\fR(2), \fBsigaltstack\fR(2),
2832 2804  \fBvfork\fR(2), \fBwrite\fR(2), \fBwritev\fR(2), \fB_stack_grow\fR(3C),
2833 2805  \fBreaddir\fR(3C), \fBpthread_create\fR(3C), \fBpthread_join\fR(3C),
2834 2806  \fBsiginfo.h\fR(3HEAD), \fBsignal.h\fR(3HEAD), \fBthr_create\fR(3C),
2835 2807  \fBthr_join\fR(3C), \fBtypes32.h\fR(3HEAD), \fBucontext.h\fR(3HEAD),
2836 2808  \fBwait\fR(3C), \fBcontract\fR(4), \fBcore\fR(4), \fBprocess\fR(4),
2837 2809  \fBlfcompile\fR(5), \fBprivileges\fR(5)
2838 2810  .SH DIAGNOSTICS
2839      -.sp
2840 2811  .LP
2841 2812  Errors that can occur in addition to the errors normally associated with file
2842 2813  system access:
2843 2814  .sp
2844 2815  .ne 2
2845 2816  .na
2846 2817  \fB\fBE2BIG\fR\fR
2847 2818  .ad
2848 2819  .RS 13n
2849 2820  Data to be returned in a \fBread\fR(2) of the page data file exceeds the size
↓ open down ↓ 134 lines elided ↑ open up ↑
2984 2955  sets were not a subset of the effective set of the controlling process or the
2985 2956  limit set of the controlling process is not a superset of limit set of the
2986 2957  controlled process.
2987 2958  .sp
2988 2959  Any of the uids of the target process are 0 or an attempt was made to change
2989 2960  any of the uids to 0 using PCSCRED and the security policy imposed additional
2990 2961  restrictions. See \fBprivileges\fR(5).
2991 2962  .RE
2992 2963  
2993 2964  .SH NOTES
2994      -.sp
2995 2965  .LP
2996 2966  Descriptions of structures in this document include only interesting structure
2997 2967  elements, not filler and padding fields, and may show elements out of order for
2998 2968  descriptive clarity. The actual structure definitions are contained in
2999 2969  \fB<procfs.h>\fR\&.
3000 2970  .SH BUGS
3001      -.sp
3002 2971  .LP
3003 2972  Because the old \fBioctl\fR(2)-based version of \fB/proc\fR is currently
3004 2973  supported for binary compatibility with old applications, the top-level
3005 2974  directory for a process, \fB/proc/\fR\fIpid\fR, is not world-readable, but it
3006 2975  is world-searchable. Thus, anyone can open \fB/proc/\fR\fIpid\fR\fB/psinfo\fR
3007 2976  even though \fBls\fR(1) applied to \fB/proc/\fR\fIpid\fR will fail for anyone
3008 2977  but the owner or an appropriately privileged process. Support for the old
3009 2978  \fBioctl\fR(2)-based version of \fB/proc\fR will be dropped in a future
3010 2979  release, at which time the top-level directory for a process will be made
3011 2980  world-readable.
3012 2981  .sp
3013 2982  .LP
3014 2983  On SPARC based machines, the types \fBgregset_t\fR and \fBfpregset_t\fR defined
3015 2984  in <\fBsys/regset.h\fR> are similar to but not the same as the types
3016 2985  \fBprgregset_t\fR and \fBprfpregset_t\fR defined in <\fBprocfs.h\fR>.
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX