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 "Mar 31, 2013"
9 .SH NAME
10 proc \- /proc, the process file system
11 .SH DESCRIPTION
12 .sp
13 .LP
14 \fB/proc\fR is a file system that provides access to the state of each process
15 and light-weight process (lwp) in the system. The name of each entry in the
16 \fB/proc\fR directory is a decimal number corresponding to a process-ID. These
17 entries are themselves subdirectories. Access to process state is provided by
18 additional files contained within each subdirectory; the hierarchy is described
19 more completely below. In this document, ``\fB/proc\fR file'' refers to a
20 non-directory file within the hierarchy rooted at \fB/proc\fR. The owner of
21 each \fB/proc\fR file and subdirectory is determined by the user-ID of the
22 process.
23 .sp
24 .LP
25 \fB/proc\fR can be mounted on any mount point, in addition to the standard
26 \fB/proc\fR mount point, and can be mounted several places at once. Such
27 additional mounts are allowed in order to facilitate the confinement of
28 processes to subtrees of the file system via \fBchroot\fR(1M) and yet allow
29 such processes access to commands like \fBps\fR(1).
30 .sp
31 .LP
32 Standard system calls are used to access \fB/proc\fR files: \fBopen\fR(2),
157 writing the address space, reading the address-map files, and setting the
158 target process's registers. There is no restriction on operations applied by a
159 64-bit process to either a 32-bit or a 64-bit target processes.
160 .sp
161 .LP
162 The format of the contents of any \fB/proc\fR file depends on the data model of
163 the observer (the controlling process), not on the data model of the target
164 process. A 64-bit debugger does not have to translate the information it reads
165 from a \fB/proc\fR file for a 32-bit process from 32-bit format to 64-bit
166 format. However, it usually has to be aware of the data model of the target
167 process. The \fBpr_dmodel\fR field of the \fBstatus\fR files indicates the
168 target process's data model.
169 .sp
170 .LP
171 To help deal with system data structures that are read from 32-bit processes, a
172 64-bit controlling program can be compiled with the C preprocessor symbol
173 \fB_SYSCALL32\fR defined before system header files are included. This makes
174 explicit 32-bit fixed-width data structures (like \fBcstruct stat32\fR) visible
175 to the 64-bit program. See \fBtypes32.h\fR(3HEAD).
176 .SH DIRECTORY STRUCTURE
177 .sp
178 .LP
179 At the top level, the directory \fB/proc\fR contains entries each of which
180 names an existing process in the system. These entries are themselves
181 directories. Except where otherwise noted, the files described below can be
182 opened for reading only. In addition, if a process becomes a \fIzombie\fR (one
183 that has exited but whose parent has not yet performed a \fBwait\fR(3C) upon
184 it), most of its associated \fB/proc\fR files disappear from the hierarchy;
185 subsequent attempts to open them, or to read or write files opened before the
186 process exited, will elicit the error \fBENOENT\fR.
187 .sp
188 .LP
189 Although process state and consequently the contents of \fB/proc\fR files can
190 change from instant to instant, a single \fBread\fR(2) of a \fB/proc\fR file is
191 guaranteed to return a sane representation of state; that is, the read will be
192 atomic with respect to the state of the process. No such guarantee applies to
193 successive reads applied to a \fB/proc\fR file for a running process. In
194 addition, atomicity is not guaranteed for \fBI/O\fR applied to the \fBas\fR
195 (address-space) file for a running process or for a process whose address space
196 contains memory shared by another running process.
197 .sp
198 .LP
199 A number of structure definitions are used to describe the files. These
200 structures may grow by the addition of elements at the end in future releases
201 of the system and it is not legitimate for a program to assume that they will
202 not.
203 .SH STRUCTURE OF \fB/proc/\fR\fIpid\fR
204 .sp
205 .LP
206 A given directory \fB/proc/\fR\fIpid\fR contains the following entries. A
207 process can use the invisible alias \fB/proc/self\fR if it wishes to open one
208 of its own \fB/proc\fR files (invisible in the sense that the name ``self''
209 does not appear in a directory listing of \fB/proc\fR obtained from
210 \fBls\fR(1), \fBgetdents\fR(2), or \fBreaddir\fR(3C)).
211 .SS "contracts"
212 .sp
213 .LP
214 A directory containing references to the contracts held by the process. Each
215 entry is a symlink to the contract's directory under \fB/system/contract\fR.
216 See \fBcontract\fR(4).
217 .SS "as"
218 .sp
219 .LP
220 Contains the address-space image of the process; it can be opened for both
221 reading and writing. \fBlseek\fR(2) is used to position the file at the virtual
222 address of interest and then the address space can be examined or changed
223 through \fBread\fR(2) or \fBwrite\fR(2) (or by using \fBpread\fR(2) or
224 \fBpwrite\fR(2) for the combined operation).
225 .SS "ctl"
226 .sp
227 .LP
228 A write-only file to which structured messages are written directing the system
229 to change some aspect of the process's state or control its behavior in some
230 way. The seek offset is not relevant when writing to this file. Individual lwps
231 also have associated \fBlwpctl\fR files in the lwp subdirectories. A control
232 message may be written either to the process's \fBctl\fR file or to a specific
233 \fBlwpctl\fR file with operation-specific effects. The effect of a control
234 message is immediately reflected in the state of the process visible through
235 appropriate status and information files. The types of control messages are
236 described in detail later. See \fBCONTROL MESSAGES\fR.
237 .SS "status"
238 .sp
239 .LP
240 Contains state information about the process and the representative lwp. The
241 file contains a \fBpstatus\fR structure which contains an embedded
242 \fBlwpstatus\fR structure for the representative lwp, as follows:
243 .sp
244 .in +2
245 .nf
246 typedef struct pstatus {
247 int pr_flags; /* flags (see below) */
248 int pr_nlwp; /* number of active lwps in the process */
249 int pr_nzomb; /* number of zombie lwps in the process */
250 pid_tpr_pid; /* process id */
251 pid_tpr_ppid; /* parent process id */
252 pid_tpr_pgid; /* process group id */
253 pid_tpr_sid; /* session id */
254 id_t pr_aslwpid; /* obsolete */
255 id_t pr_agentid; /* lwp-id of the agent lwp, if any */
256 sigset_t pr_sigpend; /* set of process pending signals */
257 uintptr_t pr_brkbase; /* virtual address of the process heap */
258 size_t pr_brksize; /* size of the process heap, in bytes */
655 .na
656 \fB\fBPR_JOBCONTROL\fR\fR
657 .ad
658 .RS 17n
659 indicates that the lwp stopped due to the default action of a job control stop
660 signal (see \fBsigaction\fR(2)); \fBpr_what\fR holds the stopping signal
661 number.
662 .RE
663
664 .sp
665 .ne 2
666 .na
667 \fB\fBPR_SUSPENDED\fR\fR
668 .ad
669 .RS 17n
670 indicates that the lwp stopped due to internal synchronization of lwps within
671 the process. \fBpr_what\fR is unused in this case.
672 .RE
673
674 .sp
675 .LP
676 \fBpr_cursig\fR names the current signal, that is, the next signal to be
677 delivered to the lwp, if any. \fBpr_info\fR, when the lwp is in a
678 \fBPR_SIGNALLED\fR or \fBPR_FAULTED\fR stop, contains additional information
679 pertinent to the particular signal or fault (see \fB<sys/siginfo.h>\fR).
680 .sp
681 .LP
682 \fBpr_lwppend\fR identifies any synchronous or directed signals pending for the
683 lwp. \fBpr_lwphold\fR identifies those signals whose delivery is being blocked
684 by the lwp (the signal mask).
685 .sp
686 .LP
687 \fBpr_action\fR contains the signal action information pertaining to the
688 current signal (see \fBsigaction\fR(2)); it is undefined if \fBpr_cursig\fR is
689 zero. \fBpr_altstack\fR contains the alternate signal stack information for the
690 lwp (see \fBsigaltstack\fR(2)).
691 .sp
692 .LP
693 \fBpr_oldcontext\fR, if not zero, contains the address on the lwp stack of a
694 \fBucontext\fR structure describing the previous user-level context (see
847 .fi
848 .in -2
849
850 The preceding constants are listed in \fB<sys/regset.h>\fR\&.
851 .RE
852
853 .sp
854 .LP
855 \fBpr_fpreg\fR is a structure holding the contents of the floating-point
856 registers.
857 .sp
858 .LP
859 SPARC registers, both general and floating-point, as seen by a 64-bit
860 controlling process are the V9 versions of the registers, even if the target
861 process is a 32-bit (V8) process. V8 registers are a subset of the V9
862 registers.
863 .sp
864 .LP
865 If the lwp is not stopped, all register values are undefined.
866 .SS "psinfo"
867 .sp
868 .LP
869 Contains miscellaneous information about the process and the representative lwp
870 needed by the \fBps\fR(1) command. \fBpsinfo\fR remains accessible after a
871 process becomes a \fIzombie\fR. The file contains a \fBpsinfo\fR structure
872 which contains an embedded \fBlwpsinfo\fR structure for the representative lwp,
873 as follows:
874 .sp
875 .in +2
876 .nf
877 typedef struct psinfo {
878 int pr_flag; /* process flags (DEPRECATED: see below) */
879 int pr_nlwp; /* number of active lwps in the process */
880 int pr_nzomb; /* number of zombie lwps in the process */
881 pid_t pr_pid; /* process id */
882 pid_t pr_ppid; /* process id of parent */
883 pid_t pr_pgid; /* process id of process group leader */
884 pid_t pr_sid; /* session id */
885 uid_t pr_uid; /* real user id */
886 uid_t pr_euid; /* effective user id */
887 gid_t pr_gid; /* real group id */
913 .in -2
914
915 .sp
916 .LP
917 Some of the entries in \fBpsinfo\fR, such as \fBpr_addr\fR, refer to internal
918 kernel data structures and should not be expected to retain their meanings
919 across different versions of the operating system.
920 .sp
921 .LP
922 \fBpsinfo_t.pr_flag\fR is a deprecated interface that should no longer be used.
923 Applications currently relying on the \fBSSYS\fR bit in \fBpr_flag\fR should
924 migrate to checking \fBPR_ISSYS\fR in the \fBpstatus\fR structure's
925 \fBpr_flags\fR field.
926 .sp
927 .LP
928 \fBpr_pctcpu\fR and \fBpr_pctmem\fR are 16-bit binary fractions in the range
929 0.0 to 1.0 with the binary point to the right of the high-order bit (1.0 ==
930 0x8000). \fBpr_pctcpu\fR is the summation over all lwps in the process.
931 .sp
932 .LP
933 \fBpr_lwp\fR contains the \fBps\fR(1) information for the representative lwp.
934 If the process is a \fIzombie\fR, \fBpr_nlwp\fR, \fBpr_nzomb\fR, and
935 \fBpr_lwp.pr_lwpid\fR are zero and the other fields of \fBpr_lwp\fR are
936 undefined:
937 .sp
938 .in +2
939 .nf
940 typedef struct lwpsinfo {
941 int pr_flag; /* lwp flags (DEPRECATED: see below) */
942 id_t pr_lwpid; /* lwp id */
943 uintptr_t pr_addr; /* internal address of lwp */
944 uintptr_t pr_wchan; /* wait addr for sleeping lwp */
945 char pr_stype; /* synchronization event type */
946 char pr_state; /* numeric lwp state */
947 char pr_sname; /* printable character for pr_state */
948 char pr_nice; /* nice for cpu usage */
949 short pr_syscall; /* system call number (if in syscall) */
950 char pr_oldpri; /* pre-SVR4, low value is high priority */
951 char pr_cpu; /* pre-SVR4, cpu usage for scheduling */
952 int pr_pri; /* priority, high value = high priority */
966 .sp
967 .LP
968 Some of the entries in \fBlwpsinfo\fR, such as \fBpr_addr\fR, \fBpr_wchan\fR,
969 \fBpr_stype\fR, \fBpr_state\fR, and \fBpr_name\fR, refer to internal kernel
970 data structures and should not be expected to retain their meanings across
971 different versions of the operating system.
972 .sp
973 .LP
974 \fBlwpsinfo_t.pr_flag\fR is a deprecated interface that should no longer be
975 used.
976 .sp
977 .LP
978 \fBpr_pctcpu\fR is a 16-bit binary fraction, as described above. It represents
979 the \fBCPU\fR time used by the specific lwp. On a multi-processor machine, the
980 maximum value is 1/N, where N is the number of \fBCPU\fRs.
981 .sp
982 .LP
983 \fBpr_contract\fR is the id of the process contract of which the process is a
984 member. See \fBcontract\fR(4) and \fBprocess\fR(4).
985 .SS "cred"
986 .sp
987 .LP
988 Contains a description of the credentials associated with the process:
989 .sp
990 .in +2
991 .nf
992 typedef struct prcred {
993 uid_t pr_euid; /* effective user id */
994 uid_t pr_ruid; /* real user id */
995 uid_t pr_suid; /* saved user id (from exec) */
996 gid_t pr_egid; /* effective group id */
997 gid_t pr_rgid; /* real group id */
998 gid_t pr_sgid; /* saved group id (from exec) */
999 int pr_ngroups; /* number of supplementary groups */
1000 gid_t pr_groups[1]; /* array of supplementary groups */
1001 } prcred_t;
1002 .fi
1003 .in -2
1004 .sp
1005
1006 .sp
1007 .LP
1008 The array of associated supplementary groups in \fBpr_groups\fR is of variable
1009 length; the \fBcred\fR file contains all of the supplementary groups.
1010 \fBpr_ngroups\fR indicates the number of supplementary groups. (See also the
1011 \fBPCSCRED\fR and \fBPCSCREDX\fR control operations.)
1012 .SS "priv"
1013 .sp
1014 .LP
1015 Contains a description of the privileges associated with the process:
1016 .sp
1017 .in +2
1018 .nf
1019 typedef struct prpriv {
1020 uint32_t pr_nsets; /* number of privilege set */
1021 uint32_t pr_setsize; /* size of privilege set */
1022 uint32_t pr_infosize; /* size of supplementary data */
1023 priv_chunk_t pr_sets[1]; /* array of sets */
1024 } prpriv_t;
1025 .fi
1026 .in -2
1027
1028 .sp
1029 .LP
1030 The actual dimension of the \fBpr_sets\fR[] field is
1031 .sp
1032 .in +2
1033 .nf
1034 pr_sets[pr_nsets][pr_setsize]
1035 .fi
1036 .in -2
1037
1038 .sp
1039 .LP
1040 which is followed by additional information about the process state
1041 \fBpr_infosize\fR bytes in size.
1042 .sp
1043 .LP
1044 The full size of the structure can be computed using
1045 \fBPRIV_PRPRIV_SIZE\fR(\fBprpriv_t *\fR).
1046 .SS "sigact"
1047 .sp
1048 .LP
1049 Contains an array of \fBsigaction structures\fR describing the current
1050 dispositions of all signals associated with the traced process (see
1051 \fBsigaction\fR(2)). Signal numbers are displaced by 1 from array indices, so
1052 that the action for signal number \fIn\fR appears in position \fIn\fR-1 of the
1053 array.
1054 .SS "auxv"
1055 .sp
1056 .LP
1057 Contains the initial values of the process's aux vector in an array of
1058 \fBauxv_t\fR structures (see \fB<sys/auxv.h>\fR). The values are those that
1059 were passed by the operating system as startup information to the dynamic
1060 linker.
1061 .SS "ldt"
1062 .sp
1063 .LP
1064 This file exists only on x86-based machines. It is non-empty only if the
1065 process has established a local descriptor table (\fBLDT\fR). If non-empty, the
1066 file contains the array of currently active \fBLDT\fR entries in an array of
1067 elements of type \fBstruct ssd\fR, defined in \fB<sys/sysi86.h>\fR, one element
1068 for each active \fBLDT\fR entry.
1069 .SS "map, xmap"
1070 .sp
1071 .LP
1072 Contain information about the virtual address map of the process. The map file
1073 contains an array of \fBprmap\fR structures while the xmap file contains an
1074 array of \fBprxmap\fR structures. Each structure describes a contiguous virtual
1075 address region in the address space of the traced process:
1076 .sp
1077 .in +2
1078 .nf
1079 typedef struct prmap {
1080 uintptr_tpr_vaddr; /* virtual address of mapping */
1081 size_t pr_size; /* size of mapping in bytes */
1082 char pr_mapname[PRMAPSZ]; /* name in /proc/pid/object */
1083 offset_t pr_offset; /* offset into mapped object, if any */
1084 int pr_mflags; /* protection and attribute flags */
1085 int pr_pagesize; /* pagesize for this mapping in bytes */
1086 int pr_shmid; /* SysV shared memory identifier */
1087 } prmap_t;
1088 .fi
1089 .in -2
1090 .sp
1218 .sp
1219 .LP
1220 \fBpr_rss\fR is the number of resident pages of memory for the mapping. The
1221 number of resident bytes for the mapping may be determined by multiplying
1222 \fBpr_rss\fR by the page size given by \fBpr_pagesize.\fR
1223 .sp
1224 .LP
1225 \fBpr_anon\fR is the number of resident anonymous memory pages (pages which are
1226 private to this process) for the mapping.
1227 .sp
1228 .LP
1229 \fBpr_locked\fR is the number of locked pages for the mapping. Pages which are
1230 locked are always resident in memory.
1231 .sp
1232 .LP
1233 \fBpr_hatpagesize\fR is the size, in bytes, of the \fBHAT\fR (\fBMMU\fR)
1234 translation for the mapping. \fBpr_hatpagesize\fR may be different than
1235 \fBpr_pagesize.\fR The possible values are hardware architecture specific, and
1236 may change over a mapping's lifetime.
1237 .SS "rmap"
1238 .sp
1239 .LP
1240 Contains information about the reserved address ranges of the process. The file
1241 contains an array of \fBprmap\fR structures, as defined above for the \fBmap\fR
1242 file. Each structure describes a contiguous virtual address region in the
1243 address space of the traced process that is reserved by the system in the sense
1244 that an \fBmmap\fR(2) system call that does not specify \fBMAP_FIXED\fR will
1245 not use any part of it for the new mapping. Examples of such reservations
1246 include the address ranges reserved for the process stack and the individual
1247 thread stacks of a multi-threaded process.
1248 .SS "cwd"
1249 .sp
1250 .LP
1251 A symbolic link to the process's current working directory. See \fBchdir\fR(2).
1252 A \fBreadlink\fR(2) of \fB/proc/\fIpid\fR/cwd\fR yields a null string. However,
1253 it can be opened, listed, and searched as a directory, and can be the target of
1254 \fBchdir\fR(2).
1255 .SS "root"
1256 .sp
1257 .LP
1258 A symbolic link to the process's root directory.
1259 \fB/proc/\fR\fIpid\fR\fB/root\fR can differ from the system root directory if
1260 the process or one of its ancestors executed \fBchroot\fR(2) as super user. It
1261 has the same semantics as \fB/proc/\fR\fIpid\fR\fB/cwd\fR.
1262 .SS "fd"
1263 .sp
1264 .LP
1265 A directory containing references to the open files of the process. Each entry
1266 is a decimal number corresponding to an open file descriptor in the process.
1267 .sp
1268 .LP
1269 If an entry refers to a regular file, it can be opened with normal file system
1270 semantics but, to ensure that the controlling process cannot gain greater
1271 access than the controlled process, with no file access modes other than its
1272 read/write open modes in the controlled process. If an entry refers to a
1273 directory, it can be accessed with the same semantics as
1274 \fB/proc/\fIpid\fR/cwd\fR. An attempt to open any other type of entry fails
1275 with \fBEACCES\fR.
1276 .SS "object"
1277 .sp
1278 .LP
1279 A directory containing read-only files with names corresponding to the
1280 \fBpr_mapname\fR entries in the \fBmap\fR and \fBpagedata\fR files. Opening
1281 such a file yields a file descriptor for the underlying mapped file associated
1282 with an address-space mapping in the process. The file name \fBa.out\fR appears
1283 in the directory as an alias for the process's executable file.
1284 .sp
1285 .LP
1286 The \fBobject\fR directory makes it possible for a controlling process to gain
1287 access to the object file and any shared libraries (and consequently the symbol
1288 tables) without having to know the actual path names of the executable files.
1289 .SS "path"
1290 .sp
1291 .LP
1292 A directory containing symbolic links to files opened by the process. The
1293 directory includes one entry for \fBcwd\fR and \fBroot\fR. The directory also
1294 contains a numerical entry for each file descriptor in the \fBfd\fR directory,
1295 and entries matching those in the \fBobject\fR directory. If this information
1296 is not available, any attempt to read the contents of the symbolic link will
1297 fail. This is most common for files that do not exist in the filesystem
1298 namespace (such as \fBFIFO\fRs and sockets), but can also happen for regular
1299 files. For the file descriptor entries, the path may be different from the one
1300 used by the process to open the file.
1301 .SS "pagedata"
1302 .sp
1303 .LP
1304 Opening the page data file enables tracking of address space references and
1305 modifications on a per-page basis.
1306 .sp
1307 .LP
1308 A \fBread\fR(2) of the page data file descriptor returns structured page data
1309 and atomically clears the page data maintained for the file by the system. That
1310 is to say, each read returns data collected since the last read; the first read
1311 returns data collected since the file was opened. When the call completes, the
1312 read buffer contains the following structure as its header and thereafter
1313 contains a number of section header structures and associated byte arrays that
1314 must be accessed by walking linearly through the buffer.
1315 .sp
1316 .in +2
1317 .nf
1318 typedef struct prpageheader {
1319 timestruc_t pr_tstamp; /* real time stamp, time of read() */
1320 ulong_t pr_nmap; /* number of address space mappings */
1321 ulong_t pr_npage; /* total number of pages */
1322 } prpageheader_t;
1364 .ad
1365 .RS 17n
1366 page has been modified.
1367 .RE
1368
1369 .sp
1370 .LP
1371 If the read buffer is not large enough to contain all of the page data, the
1372 read fails with \fBE2BIG\fR and the page data is not cleared. The required size
1373 of the read buffer can be determined through \fBfstat\fR(2). Application of
1374 \fBlseek\fR(2) to the page data file descriptor is ineffective; every read
1375 starts from the beginning of the file. Closing the page data file descriptor
1376 terminates the system overhead associated with collecting the data.
1377 .sp
1378 .LP
1379 More than one page data file descriptor for the same process can be opened, up
1380 to a system-imposed limit per traced process. A read of one does not affect the
1381 data being collected by the system for the others. An open of the page data
1382 file will fail with \fBENOMEM\fR if the system-imposed limit would be exceeded.
1383 .SS "watch"
1384 .sp
1385 .LP
1386 Contains an array of \fBprwatch\fR structures, one for each watched area
1387 established by the \fBPCWATCH\fR control operation. See \fBPCWATCH\fR for
1388 details.
1389 .SS "usage"
1390 .sp
1391 .LP
1392 Contains process usage information described by a \fBprusage\fR structure which
1393 contains at least the following fields:
1394 .sp
1395 .in +2
1396 .nf
1397 typedef struct prusage {
1398 id_t pr_lwpid; /* lwp id. 0: process or defunct */
1399 int pr_count; /* number of contributing lwps */
1400 timestruc_t pr_tstamp; /* real time stamp, time of read() */
1401 timestruc_t pr_create; /* process/lwp creation time stamp */
1402 timestruc_t pr_term; /* process/lwp termination time stamp */
1403 timestruc_t pr_rtime; /* total lwp real (elapsed) time */
1404 timestruc_t pr_utime; /* user level CPU time */
1405 timestruc_t pr_stime; /* system call CPU time */
1406 timestruc_t pr_ttime; /* other system trap CPU time */
1407 timestruc_t pr_tftime; /* text page fault sleep time */
1408 timestruc_t pr_dftime; /* data page fault sleep time */
1409 timestruc_t pr_kftime; /* kernel page fault sleep time */
1410 timestruc_t pr_ltime; /* user lock wait sleep time */
1417 ulong_t pr_inblk; /* input blocks */
1418 ulong_t pr_oublk; /* output blocks */
1419 ulong_t pr_msnd; /* messages sent */
1420 ulong_t pr_mrcv; /* messages received */
1421 ulong_t pr_sigs; /* signals received */
1422 ulong_t pr_vctx; /* voluntary context switches */
1423 ulong_t pr_ictx; /* involuntary context switches */
1424 ulong_t pr_sysc; /* system calls */
1425 ulong_t pr_ioch; /* chars read and written */
1426 } prusage_t;
1427 .fi
1428 .in -2
1429
1430 .sp
1431 .LP
1432 Microstate accounting is now continuously enabled. While this information was
1433 previously an estimate, if microstate accounting were not enabled, the current
1434 information is now never an estimate represents time the process has spent in
1435 various states.
1436 .SS "lstatus"
1437 .sp
1438 .LP
1439 Contains a \fBprheader\fR structure followed by an array of \fBlwpstatus\fR
1440 structures, one for each active lwp in the process (see also
1441 \fB/proc/\fR\fIpid\fR\fB/lwp/\fR\fIlwpid\fR/\fBlwpstatus\fR, below). The
1442 \fBprheader\fR structure describes the number and size of the array entries
1443 that follow.
1444 .sp
1445 .in +2
1446 .nf
1447 typedef struct prheader {
1448 long pr_nent; /* number of entries */
1449 size_t pr_entsize; /* size of each entry, in bytes */
1450 } prheader_t;
1451 .fi
1452 .in -2
1453
1454 .sp
1455 .LP
1456 The \fBlwpstatus\fR structure may grow by the addition of elements at the end
1457 in future releases of the system. Programs must use \fBpr_entsize\fR in the
1458 file header to index through the array. These comments apply to all \fB/proc\fR
1459 files that include a \fBprheader\fR structure (\fBlpsinfo\fR and \fBlusage\fR,
1460 below).
1461 .SS "lpsinfo"
1462 .sp
1463 .LP
1464 Contains a \fBprheader\fR structure followed by an array of \fBlwpsinfo\fR
1465 structures, one for eachactive and zombie lwp in the process. See also
1466 \fB/proc/\fR\fIpid\fR\fB/lwp/\fR\fIlwpid\fR/\fBlwpsinfo\fR, below.
1467 .SS "lusage"
1468 .sp
1469 .LP
1470 Contains a \fBprheader\fR structure followed by an array of \fBprusage\fR
1471 structures, one for each active lwp in the process, plus an additional element
1472 at the beginning that contains the summation over all defunct lwps (lwps that
1473 once existed but no longer exist in the process). Excluding the \fBpr_lwpid\fR,
1474 \fBpr_tstamp\fR, \fBpr_create\fR, and \fBpr_term\fR entries, the entry-by-entry
1475 summation over all these structures is the definition of the process usage
1476 information obtained from the \fBusage\fR file. (See also
1477 \fB/proc/\fR\fIpid\fR\fB/lwp/\fR\fIlwpid\fR/\fBlwpusage\fR, below.)
1478 .SS "lwp"
1479 .sp
1480 .LP
1481 A directory containing entries each of which names an active or zombie lwp
1482 within the process. These entries are themselves directories containing
1483 additional files as described below. Only the \fBlwpsinfo\fR file exists in the
1484 directory of a zombie lwp.
1485 .SH STRUCTURE OF \fB/proc/\fR\fIpid\fR\fB/lwp/\fR\fIlwpid\fR
1486 .sp
1487 .LP
1488 A given directory \fB/proc/\fR\fIpid\fR\fB/lwp/\fR\fIlwpid\fR contains the
1489 following entries:
1490 .SS "lwpctl"
1491 .sp
1492 .LP
1493 Write-only control file. The messages written to this file affect the specific
1494 lwp rather than the representative lwp, as is the case for the process's
1495 \fBctl\fR file.
1496 .SS "lwpstatus"
1497 .sp
1498 .LP
1499 lwp-specific state information. This file contains the \fBlwpstatus\fR
1500 structure for the specific lwp as described above for the representative lwp in
1501 the process's \fBstatus\fR file.
1502 .SS "lwpsinfo"
1503 .sp
1504 .LP
1505 lwp-specific \fBps\fR(1) information. This file contains the \fBlwpsinfo\fR
1506 structure for the specific lwp as described above for the representative lwp in
1507 the process's \fBpsinfo\fR file. The \fBlwpsinfo\fR file remains accessible
1508 after an lwp becomes a zombie.
1509 .SS "lwpusage"
1510 .sp
1511 .LP
1512 This file contains the \fBprusage\fR structure for the specific lwp as
1513 described above for the process's \fBusage\fR file.
1514 .SS "gwindows"
1515 .sp
1516 .LP
1517 This file exists only on SPARC based machines. If it is non-empty, it contains
1518 a \fBgwindows_t\fR structure, defined in \fB<sys/regset.h>\fR, with the values
1519 of those SPARC register windows that could not be stored on the stack when the
1520 lwp stopped. Conditions under which register windows are not stored on the
1521 stack are: the stack pointer refers to nonexistent process memory or the stack
1522 pointer is improperly aligned. If the lwp is not stopped or if there are no
1523 register windows that could not be stored on the stack, the file is empty (the
1524 usual case).
1525 .SS "xregs"
1526 .sp
1527 .LP
1528 Extra state registers. The extra state register set is architecture dependent;
1529 this file is empty if the system does not support extra state registers. If the
1530 file is non-empty, it contains an architecture dependent structure of type
1531 \fBprxregset_t\fR, defined in \fB<procfs.h>\fR, with the values of the lwp's
1532 extra state registers. If the lwp is not stopped, all register values are
1533 undefined. See also the \fBPCSXREG\fR control operation, below.
1534 .SS "asrs"
1535 .sp
1536 .LP
1537 This file exists only for 64-bit SPARC V9 processes. It contains an
1538 \fBasrset_t\fR structure, defined in <\fBsys/regset.h\fR>, containing the
1539 values of the lwp's platform-dependent ancillary state registers. If the lwp is
1540 not stopped, all register values are undefined. See also the \fBPCSASRS\fR
1541 control operation, below.
1542 .SS "spymaster"
1543 .sp
1544 .LP
1545 For an agent lwp (see \fBPCAGENT\fR), this file contains a \fBpsinfo_t\fR
1546 structure that corresponds to the process that created the agent lwp at the
1547 time the agent was created. This structure is identical to that retrieved via
1548 the \fBpsinfo\fR file, with one modification: the \fBpr_time\fR field does not
1549 correspond to the CPU time for the process, but rather to the creation time of
1550 the agent lwp.
1551 .SS "templates"
1552 .sp
1553 .LP
1554 A directory which contains references to the active templates for the lwp,
1555 named by the contract type. Changes made to an active template descriptor do
1556 not affect the original template which was activated, though they do affect the
1557 active template. It is not possible to activate an active template descriptor.
1558 See \fBcontract\fR(4).
1559 .SH CONTROL MESSAGES
1560 .sp
1561 .LP
1562 Process state changes are effected through messages written to a process's
1563 \fBctl\fR file or to an individual lwp's \fBlwpctl\fR file. All control
1564 messages consist of a \fBlong\fR that names the specific operation followed by
1565 additional data containing the operand, if any.
1566 .sp
1567 .LP
1568 Multiple control messages may be combined in a single \fBwrite\fR(2) (or
1569 \fBwritev\fR(2)) to a control file, but no partial writes are permitted. That
1570 is, each control message, operation code plus operand, if any, must be
1571 presented in its entirety to the \fBwrite\fR(2) and not in pieces over several
1572 system calls. If a control operation fails, no subsequent operations contained
1573 in the same \fBwrite\fR(2) are attempted.
1574 .sp
1575 .LP
1576 Descriptions of the allowable control messages follow. In all cases, writing a
1577 message to a control file for a process or lwp that has terminated elicits the
1578 error \fBENOENT\fR.
1579 .SS "PCSTOP PCDSTOP PCWSTOP PCTWSTOP"
1580 .sp
1581 .LP
1582 When applied to the process control file, \fBPCSTOP\fR directs all lwps to stop
1583 and waits for them to stop, \fBPCDSTOP\fR directs all lwps to stop without
1584 waiting for them to stop, and \fBPCWSTOP\fR simply waits for all lwps to stop.
1585 When applied to an lwp control file, \fBPCSTOP\fR directs the specific lwp to
1586 stop and waits until it has stopped, \fBPCDSTOP\fR directs the specific lwp to
1587 stop without waiting for it to stop, and \fBPCWSTOP\fR simply waits for the
1588 specific lwp to stop. When applied to an lwp control file, \fBPCSTOP\fR and
1589 \fBPCWSTOP\fR complete when the lwp stops on an event of interest, immediately
1590 if already so stopped; when applied to the process control file, they complete
1591 when every lwp has stopped either on an event of interest or on a
1592 \fBPR_SUSPENDED\fR stop.
1593 .sp
1594 .LP
1595 \fBPCTWSTOP\fR is identical to \fBPCWSTOP\fR except that it enables the
1596 operation to time out, to avoid waiting forever for a process or lwp that may
1597 never stop on an event of interest. \fBPCTWSTOP\fR takes a \fBlong\fR operand
1598 specifying a number of milliseconds; the wait will terminate successfully after
1599 the specified number of milliseconds even if the process or lwp has not
1600 stopped; a timeout value of zero makes the operation identical to
1609 is traced and again showing \fBPR_JOBCONTROL\fR if the lwp is set running
1610 without clearing the signal.) If \fBPCSTOP\fR or \fBPCDSTOP\fR is applied to an
1611 lwp that is stopped, but not on an event of interest, the stop directive takes
1612 effect when the lwp is restarted by the competing mechanism. At that time, the
1613 lwp enters a \fBPR_REQUESTED\fR stop before executing any user-level code.
1614 .sp
1615 .LP
1616 A write of a control message that blocks is interruptible by a signal so that,
1617 for example, an \fBalarm\fR(2) can be set to avoid waiting forever for a
1618 process or lwp that may never stop on an event of interest. If \fBPCSTOP\fR is
1619 interrupted, the lwp stop directives remain in effect even though the
1620 \fBwrite\fR(2) returns an error. (Use of \fBPCTWSTOP\fR with a non-zero timeout
1621 is recommended over \fBPCWSTOP\fR with an \fBalarm\fR(2).)
1622 .sp
1623 .LP
1624 A system process (indicated by the \fBPR_ISSYS\fR flag) never executes at user
1625 level, has no user-level address space visible through \fB/proc\fR, and cannot
1626 be stopped. Applying one of these operations to a system process or any of its
1627 lwps elicits the error \fBEBUSY\fR.
1628 .SS "PCRUN"
1629 .sp
1630 .LP
1631 Make an lwp runnable again after a stop. This operation takes a \fBlong\fR
1632 operand containing zero or more of the following flags:
1633 .sp
1634 .ne 2
1635 .na
1636 \fB\fBPRCSIG\fR\fR
1637 .ad
1638 .RS 12n
1639 clears the current signal, if any (see \fBPCCSIG\fR).
1640 .RE
1641
1642 .sp
1643 .ne 2
1644 .na
1645 \fB\fBPRCFAULT\fR\fR
1646 .ad
1647 .RS 12n
1648 clears the current fault, if any (see \fBPCCFAULT\fR).
1649 .RE
1690 .sp
1691 .LP
1692 When applied to an lwp control file, \fBPCRUN\fR clears any outstanding
1693 directed-stop request and makes the specific lwp runnable. The operation fails
1694 with \fBEBUSY\fR if the specific lwp is not stopped on an event of interest or
1695 has not been directed to stop or if the agent lwp exists and this is not the
1696 agent lwp (see \fBPCAGENT\fR).
1697 .sp
1698 .LP
1699 When applied to the process control file, a representative lwp is chosen for
1700 the operation as described for \fB/proc/\fR\fIpid\fR\fB/status\fR. The
1701 operation fails with \fBEBUSY\fR if the representative lwp is not stopped on an
1702 event of interest or has not been directed to stop or if the agent lwp exists.
1703 If \fBPRSTEP\fR or \fBPRSTOP\fR was requested, the representative lwp is made
1704 runnable and its outstanding directed-stop request is cleared; otherwise all
1705 outstanding directed-stop requests are cleared and, if it was stopped on an
1706 event of interest, the representative lwp is marked \fBPR_REQUESTED\fR. If, as
1707 a consequence, all lwps are in the \fBPR_REQUESTED\fR or \fBPR_SUSPENDED\fR
1708 stop state, all lwps showing \fBPR_REQUESTED\fR are made runnable.
1709 .SS "PCSTRACE"
1710 .sp
1711 .LP
1712 Define a set of signals to be traced in the process. The receipt of one of
1713 these signals by an lwp causes the lwp to stop. The set of signals is defined
1714 using an operand \fBsigset_t\fR contained in the control message. Receipt of
1715 \fBSIGKILL\fR cannot be traced; if specified, it is silently ignored.
1716 .sp
1717 .LP
1718 If a signal that is included in an lwp's held signal set (the signal mask) is
1719 sent to the lwp, the signal is not received and does not cause a stop until it
1720 is removed from the held signal set, either by the lwp itself or by setting the
1721 held signal set with \fBPCSHOLD\fR.
1722 .SS "PCCSIG"
1723 .sp
1724 .LP
1725 The current signal, if any, is cleared from the specific or representative lwp.
1726 .SS "PCSSIG"
1727 .sp
1728 .LP
1729 The current signal and its associated signal information for the specific or
1730 representative lwp are set according to the contents of the operand
1731 \fBsiginfo\fR structure (see \fB<sys/siginfo.h>\fR). If the specified signal
1732 number is zero, the current signal is cleared. The semantics of this operation
1733 are different from those of \fBkill\fR(2) in that the signal is delivered to
1734 the lwp immediately after execution is resumed (even if it is being blocked)
1735 and an additional \fBPR_SIGNALLED\fR stop does not intervene even if the signal
1736 is traced. Setting the current signal to \fBSIGKILL\fR terminates the process
1737 immediately.
1738 .SS "PCKILL"
1739 .sp
1740 .LP
1741 If applied to the process control file, a signal is sent to the process with
1742 semantics identical to those of \fBkill\fR(2). If applied to an lwp control
1743 file, a directed signal is sent to the specific lwp. The signal is named in a
1744 \fBlong\fR operand contained in the message. Sending \fBSIGKILL\fR terminates
1745 the process immediately.
1746 .SS "PCUNKILL"
1747 .sp
1748 .LP
1749 A signal is deleted, that is, it is removed from the set of pending signals. If
1750 applied to the process control file, the signal is deleted from the process's
1751 pending signals. If applied to an lwp control file, the signal is deleted from
1752 the lwp's pending signals. The current signal (if any) is unaffected. The
1753 signal is named in a \fBlong\fR operand in the control message. It is an error
1754 (\fBEINVAL\fR) to attempt to delete \fBSIGKILL\fR.
1755 .SS "PCSHOLD"
1756 .sp
1757 .LP
1758 Set the set of held signals for the specific or representative lwp (signals
1759 whose delivery will be blocked if sent to the lwp). The set of signals is
1760 specified with a \fBsigset_t\fR operand. \fBSIGKILL\fR and \fBSIGSTOP\fR cannot
1761 be held; if specified, they are silently ignored.
1762 .SS "PCSFAULT"
1763 .sp
1764 .LP
1765 Define a set of hardware faults to be traced in the process. On incurring one
1766 of these faults, an lwp stops. The set is defined via the operand
1767 \fBfltset_t\fR structure. Fault names are defined in \fB<sys/fault.h>\fR and
1768 include the following. Some of these may not occur on all processors; there may
1769 be processor-specific faults in addition to these.
1770 .sp
1771 .ne 2
1772 .na
1773 \fB\fBFLTILL\fR\fR
1774 .ad
1775 .RS 13n
1776 illegal instruction
1777 .RE
1778
1779 .sp
1780 .ne 2
1781 .na
1782 \fB\fBFLTPRIV\fR\fR
1783 .ad
1868
1869 .sp
1870 .ne 2
1871 .na
1872 \fB\fBFLTPAGE\fR\fR
1873 .ad
1874 .RS 13n
1875 recoverable page fault
1876 .RE
1877
1878 .sp
1879 .LP
1880 When not traced, a fault normally results in the posting of a signal to the lwp
1881 that incurred the fault. If an lwp stops on a fault, the signal is posted to
1882 the lwp when execution is resumed unless the fault is cleared by \fBPCCFAULT\fR
1883 or by the \fBPRCFAULT\fR option of \fBPCRUN\fR. \fBFLTPAGE\fR is an exception;
1884 no signal is posted. The \fBpr_info\fR field in the \fBlwpstatus\fR structure
1885 identifies the signal to be sent and contains machine-specific information
1886 about the fault.
1887 .SS "PCCFAULT"
1888 .sp
1889 .LP
1890 The current fault, if any, is cleared; the associated signal will not be sent
1891 to the specific or representative lwp.
1892 .SS "PCSENTRY PCSEXIT"
1893 .sp
1894 .LP
1895 These control operations instruct the process's lwps to stop on entry to or
1896 exit from specified system calls. The set of system calls to be traced is
1897 defined via an operand \fBsysset_t\fR structure.
1898 .sp
1899 .LP
1900 When entry to a system call is being traced, an lwp stops after having begun
1901 the call to the system but before the system call arguments have been fetched
1902 from the lwp. When exit from a system call is being traced, an lwp stops on
1903 completion of the system call just prior to checking for signals and returning
1904 to user level. At this point, all return values have been stored into the lwp's
1905 registers.
1906 .sp
1907 .LP
1908 If an lwp is stopped on entry to a system call (\fBPR_SYSENTRY\fR) or when
1909 sleeping in an interruptible system call (\fBPR_ASLEEP\fR is set), it may be
1910 instructed to go directly to system call exit by specifying the \fBPRSABORT\fR
1911 flag in a \fBPCRUN\fR control message. Unless exit from the system call is
1912 being traced, the lwp returns to user level showing \fBEINTR\fR.
1913 .SS "PCWATCH"
1914 .sp
1915 .LP
1916 Set or clear a watched area in the controlled process from a \fBprwatch\fR
1917 structure operand:
1918 .sp
1919 .in +2
1920 .nf
1921 typedef struct prwatch {
1922 uintptr_t pr_vaddr; /* virtual address of watched area */
1923 size_t pr_size; /* size of watched area in bytes */
1924 int pr_wflags; /* watch type flags */
1925 } prwatch_t;
1926 .fi
1927 .in -2
1928
1929 .sp
1930 .LP
1931 \fBpr_vaddr\fR specifies the virtual address of an area of memory to be watched
1932 in the controlled process. \fBpr_size\fR specifies the size of the area, in
1933 bytes. \fBpr_wflags\fR specifies the type of memory access to be monitored as a
1934 bit-mask of the following flags:
2043 \fBexec\fR(2). \fBPCWATCH\fR fails with \fBEBUSY\fR if applied to the parent of
2044 a \fBvfork\fR(2) before the child has terminated or performed an \fBexec\fR(2).
2045 The \fBPR_VFORKP\fR flag is set in the \fBpstatus\fR structure for such a
2046 parent process.
2047 .sp
2048 .LP
2049 Certain accesses of the traced process's address space by the operating system
2050 are immune to watchpoints. The initial construction of a signal stack frame
2051 when a signal is delivered to an lwp will not trigger a watchpoint trap even if
2052 the new frame covers watched areas of the stack. Once the signal handler is
2053 entered, watchpoint traps occur normally. On SPARC based machines, register
2054 window overflow and underflow will not trigger watchpoint traps, even if the
2055 register window save areas cover watched areas of the stack.
2056 .sp
2057 .LP
2058 Watched areas are not inherited by child processes, even if the traced
2059 process's inherit-on-fork mode, \fBPR_FORK\fR, is set (see \fBPCSET\fR, below).
2060 All watched areas are cancelled when the traced process performs a successful
2061 \fBexec\fR(2).
2062 .SS "PCSET PCUNSET"
2063 .sp
2064 .LP
2065 \fBPCSET\fR sets one or more modes of operation for the traced process.
2066 \fBPCUNSET\fR unsets these modes. The modes to be set or unset are specified by
2067 flags in an operand \fBlong\fR in the control message:
2068 .sp
2069 .ne 2
2070 .na
2071 \fB\fBPR_FORK\fR\fR
2072 .ad
2073 .RS 13n
2074 (inherit-on-fork): When set, the process's tracing flags and its
2075 inherit-on-fork mode are inherited by the child of a \fBfork\fR(2),
2076 \fBfork1\fR(2), or \fBvfork\fR(2). When unset, child processes start with all
2077 tracing flags cleared.
2078 .RE
2079
2080 .sp
2081 .ne 2
2082 .na
2083 \fB\fBPR_RLC\fR\fR
2159 \fB\fBPR_PTRACE\fR\fR
2160 .ad
2161 .RS 13n
2162 (ptrace-compatibility): When set, a stop on an event of interest by the traced
2163 process is reported to the parent of the traced process by \fBwait\fR(3C),
2164 \fBSIGTRAP\fR is sent to the traced process when it executes a successful
2165 \fBexec\fR(2), setuid/setgid flags are not honored for execs performed by the
2166 traced process, any exec of an object file that the traced process cannot read
2167 fails, and the process dies when its parent dies. This mode is deprecated; it
2168 is provided only to allow \fBptrace\fR(3C) to be implemented as a library
2169 function using \fB/proc\fR.
2170 .RE
2171
2172 .sp
2173 .LP
2174 It is an error (\fBEINVAL\fR) to specify flags other than those described above
2175 or to apply these operations to a system process. The current modes are
2176 reported in the \fBpr_flags\fR field of \fB/proc/\fR\fIpid\fR\fB/status\fR and
2177 \fB/proc/\fR\fIpid\fR\fB/lwp/\fR\fIlwp\fR\fB/lwpstatus\fR.
2178 .SS "PCSREG"
2179 .sp
2180 .LP
2181 Set the general registers for the specific or representative lwp according to
2182 the operand \fBprgregset_t\fR structure.
2183 .sp
2184 .LP
2185 On SPARC based systems, only the condition-code bits of the processor-status
2186 register (R_PSR) of SPARC V8 (32-bit) processes can be modified by
2187 \fBPCSREG\fR. Other privileged registers cannot be modified at all.
2188 .sp
2189 .LP
2190 On x86-based systems, only certain bits of the flags register (EFL) can be
2191 modified by \fBPCSREG\fR: these include the condition codes, direction-bit, and
2192 overflow-bit.
2193 .sp
2194 .LP
2195 \fBPCSREG\fR fails with \fBEBUSY\fR if the lwp is not stopped on an event of
2196 interest.
2197 .SS "PCSVADDR"
2198 .sp
2199 .LP
2200 Set the address at which execution will resume for the specific or
2201 representative lwp from the operand \fBlong\fR. On SPARC based systems, both
2202 %pc and %npc are set, with %npc set to the instruction following the virtual
2203 address. On x86-based systems, only %eip is set. \fBPCSVADDR\fR fails with
2204 \fBEBUSY\fR if the lwp is not stopped on an event of interest.
2205 .SS "PCSFPREG"
2206 .sp
2207 .LP
2208 Set the floating-point registers for the specific or representative lwp
2209 according to the operand \fBprfpregset_t\fR structure. An error (\fBEINVAL\fR)
2210 is returned if the system does not support floating-point operations (no
2211 floating-point hardware and the system does not emulate floating-point machine
2212 instructions). \fBPCSFPREG\fR fails with \fBEBUSY\fR if the lwp is not stopped
2213 on an event of interest.
2214 .SS "PCSXREG"
2215 .sp
2216 .LP
2217 Set the extra state registers for the specific or representative lwp according
2218 to the architecture-dependent operand \fBprxregset_t\fR structure. An error
2219 (\fBEINVAL\fR) is returned if the system does not support extra state
2220 registers. \fBPCSXREG\fR fails with \fBEBUSY\fR if the lwp is not stopped on an
2221 event of interest.
2222 .SS "PCSASRS"
2223 .sp
2224 .LP
2225 Set the ancillary state registers for the specific or representative lwp
2226 according to the SPARC V9 platform-dependent operand \fBasrset_t\fR structure.
2227 An error (\fBEINVAL\fR) is returned if either the target process or the
2228 controlling process is not a 64-bit SPARC V9 process. Most of the ancillary
2229 state registers are privileged registers that cannot be modified. Only those
2230 that can be modified are set; all others are silently ignored. \fBPCSASRS\fR
2231 fails with \fBEBUSY\fR if the lwp is not stopped on an event of interest.
2232 .SS "PCAGENT"
2233 .sp
2234 .LP
2235 Create an agent lwp in the controlled process with register values from the
2236 operand \fBprgregset_t\fR structure (see \fBPCSREG\fR, above). The agent lwp is
2237 created in the stopped state showing \fBPR_REQUESTED\fR and with its held
2238 signal set (the signal mask) having all signals except \fBSIGKILL\fR and
2239 \fBSIGSTOP\fR blocked.
2240 .sp
2241 .LP
2242 The \fBPCAGENT\fR operation fails with \fBEBUSY\fR unless the process is fully
2243 stopped via \fB/proc\fR, that is, unless all of the lwps in the process are
2244 stopped either on events of interest or on \fBPR_SUSPENDED\fR, or are stopped
2245 on \fBPR_JOBCONTROL\fR and have been directed to stop via \fBPCDSTOP\fR. It
2246 fails with \fBEBUSY\fR if an agent lwp already exists. It fails with
2247 \fBENOMEM\fR if system resources for creating new lwps have been exhausted.
2248 .sp
2249 .LP
2250 Any \fBPCRUN\fR operation applied to the process control file or to the control
2251 file of an lwp other than the agent lwp fails with \fBEBUSY\fR as long as the
2252 agent lwp exists. The agent lwp must be caused to terminate by executing the
2253 \fBSYS_lwp_exit\fR system call trap before the process can be restarted.
2274 .sp
2275 .LP
2276 If the controlling process neglects to force the agent lwp to execute the
2277 \fBSYS_lwp_exit\fR system call (due to either logic error or fatal failure on
2278 the part of the controlling process), the agent lwp will remain in the target
2279 process. For purposes of being able to debug these otherwise rogue agents,
2280 information as to the creator of the agent lwp is reflected in that lwp's
2281 \fBspymaster\fR file in \fB/proc\fR. Should the target process generate a core
2282 dump with the agent lwp in place, this information will be available via the
2283 \fBNT_SPYMASTER\fR note in the core file (see \fBcore\fR(4)).
2284 .sp
2285 .LP
2286 The agent lwp is not allowed to execute any variation of the \fBSYS_fork\fR or
2287 \fBSYS_exec\fR system call traps. Attempts to do so yield \fBENOTSUP\fR to the
2288 agent lwp.
2289 .sp
2290 .LP
2291 Symbolic constants for system call trap numbers like \fBSYS_lwp_exit\fR and
2292 \fBSYS_lwp_create\fR can be found in the header file <\fBsys/syscall.h\fR>.
2293 .SS "PCREAD PCWRITE"
2294 .sp
2295 .LP
2296 Read or write the target process's address space via a \fBpriovec\fR structure
2297 operand:
2298 .sp
2299 .in +2
2300 .nf
2301 typedef struct priovec {
2302 void *pio_base; /* buffer in controlling process */
2303 size_t pio_len; /* size of read/write request in bytes */
2304 off_t pio_offset; /* virtual address in target process */
2305 } priovec_t;
2306 .fi
2307 .in -2
2308
2309 .sp
2310 .LP
2311 These operations have the same effect as \fBpread\fR(2) and \fBpwrite\fR(2),
2312 respectively, of the target process's address space file. The difference is
2313 that more than one \fBPCREAD\fR or \fBPCWRITE\fR control operation can be
2314 written to the control file at once, and they can be interspersed with other
2315 control operations in a single write to the control file. This is useful, for
2316 example, when planting many breakpoint instructions in the process's address
2317 space, or when stepping over a breakpointed instruction. Unlike \fBpread\fR(2)
2318 and \fBpwrite\fR(2), no provision is made for partial reads or writes; if the
2319 operation cannot be performed completely, it fails with \fBEIO\fR.
2320 .SS "PCNICE"
2321 .sp
2322 .LP
2323 The traced process's \fBnice\fR(2) value is incremented by the amount in the
2324 operand \fBlong\fR. Only a process with the {\fBPRIV_PROC_PRIOCNTL\fR}
2325 privilege asserted in its effective set can better a process's priority in this
2326 way, but any user may lower the priority. This operation is not meaningful for
2327 all scheduling classes.
2328 .SS "PCSCRED"
2329 .sp
2330 .LP
2331 Set the target process credentials to the values contained in the
2332 \fBprcred_t\fR structure operand (see \fB/proc/\fR\fIpid\fR\fB/cred\fR). The
2333 effective, real, and saved user-IDs and group-IDs of the target process are
2334 set. The target process's supplementary groups are not changed; the
2335 \fBpr_ngroups\fR and \fBpr_groups\fR members of the structure operand are
2336 ignored. Only the privileged processes can perform this operation; for all
2337 others it fails with \fBEPERM\fR.
2338 .SS "PCSCREDX"
2339 .sp
2340 .LP
2341 Operates like \fBPCSCRED\fR but also sets the supplementary groups; the length
2342 of the data written with this control operation should be "sizeof
2343 (\fBprcred_t\fR) + sizeof (\fBgid_t)\fR * (#groups - 1)".
2344 .SS "PCSPRIV"
2345 .sp
2346 .LP
2347 Set the target process privilege to the values contained in the \fBprpriv_t\fR
2348 operand (see \fB/proc/pid/priv\fR). The effective, permitted, inheritable, and
2349 limit sets are all changed. Privilege flags can also be set. The process is
2350 made privilege aware unless it can relinquish privilege awareness. See
2351 \fBprivileges\fR(5).
2352 .sp
2353 .LP
2354 The limit set of the target process cannot be grown. The other privilege sets
2355 must be subsets of the intersection of the effective set of the calling process
2356 with the new limit set of the target process or subsets of the original values
2357 of the sets in the target process.
2358 .sp
2359 .LP
2360 If any of the above restrictions are not met, \fBEPERM\fR is returned. If the
2361 structure written is improperly formatted, \fBEINVAL\fR is returned.
2362 .SH PROGRAMMING NOTES
2363 .sp
2364 .LP
2365 For security reasons, except for the \fBpsinfo\fR, \fBusage\fR, \fBlpsinfo\fR,
2366 \fBlusage\fR, \fBlwpsinfo\fR, and \fBlwpusage\fR files, which are
2367 world-readable, and except for privileged processes, an open of a \fB/proc\fR
2368 file fails unless both the user-ID and group-ID of the caller match those of
2369 the traced process and the process's object file is readable by the caller. The
2370 effective set of the caller is a superset of both the inheritable and the
2371 permitted set of the target process. The limit set of the caller is a superset
2372 of the limit set of the target process. Except for the world-readable files
2373 just mentioned, files corresponding to setuid and setgid processes can be
2374 opened only by the appropriately privileged process.
2375 .sp
2376 .LP
2377 A process that is missing the basic privilege {\fBPRIV_PROC_INFO\fR} cannot see
2378 any processes under \fB/proc\fR that it cannot send a signal to.
2379 .sp
2380 .LP
2381 A process that has {\fBPRIV_PROC_OWNER\fR} asserted in its effective set can
2382 open any file for reading. To manipulate or control a process, the controlling
2383 process must have at least as many privileges in its effective set as the
2402 flags cleared. Any process not currently open for writing via \fB/proc\fR, but
2403 that has left-over tracing flags from a previous open, and that executes a
2404 setuid/setgid or unreadable object file, will not be stopped but will have all
2405 its tracing flags cleared.
2406 .sp
2407 .LP
2408 To wait for one or more of a set of processes or lwps to stop or terminate,
2409 \fB/proc\fR file descriptors (other than those obtained by opening the
2410 \fBcwd\fR or \fBroot\fR directories or by opening files in the \fBfd\fR or
2411 \fBobject\fR directories) can be used in a \fBpoll\fR(2) system call. When
2412 requested and returned, either of the polling events \fBPOLLPRI\fR or
2413 \fBPOLLWRNORM\fR indicates that the process or lwp stopped on an event of
2414 interest. Although they cannot be requested, the polling events \fBPOLLHUP\fR,
2415 \fBPOLLERR\fR, and \fBPOLLNVAL\fR may be returned. \fBPOLLHUP\fR indicates that
2416 the process or lwp has terminated. \fBPOLLERR\fR indicates that the file
2417 descriptor has become invalid. \fBPOLLNVAL\fR is returned immediately if
2418 \fBPOLLPRI\fR or \fBPOLLWRNORM\fR is requested on a file descriptor referring
2419 to a system process (see \fBPCSTOP\fR). The requested events may be empty to
2420 wait simply for termination.
2421 .SH FILES
2422 .sp
2423 .ne 2
2424 .na
2425 \fB\fB/proc\fR\fR
2426 .ad
2427 .sp .6
2428 .RS 4n
2429 directory (list of processes)
2430 .RE
2431
2432 .sp
2433 .ne 2
2434 .na
2435 \fB\fB/proc/\fIpid\fR\fR\fR
2436 .ad
2437 .sp .6
2438 .RS 4n
2439 specific process directory
2440 .RE
2441
2442 .sp
2565 \fB\fB/proc/\fIpid\fR/sigact\fR\fR
2566 .ad
2567 .sp .6
2568 .RS 4n
2569 process signal actions
2570 .RE
2571
2572 .sp
2573 .ne 2
2574 .na
2575 \fB\fB/proc/\fIpid\fR/auxv\fR\fR
2576 .ad
2577 .sp .6
2578 .RS 4n
2579 process aux vector
2580 .RE
2581
2582 .sp
2583 .ne 2
2584 .na
2585 \fB\fB/proc/\fIpid\fR/ldt\fR\fR
2586 .ad
2587 .sp .6
2588 .RS 4n
2589 process \fBLDT\fR (x86 only)
2590 .RE
2591
2592 .sp
2593 .ne 2
2594 .na
2595 \fB\fB/proc/\fIpid\fR/usage\fR\fR
2596 .ad
2597 .sp .6
2598 .RS 4n
2599 process usage
2600 .RE
2601
2602 .sp
2603 .ne 2
2604 .na
2803 .ne 2
2804 .na
2805 \fB\fB/proc/\fIpid\fR/lwp/\fIlwpid\fR/asrs\fR\fR
2806 .ad
2807 .sp .6
2808 .RS 4n
2809 ancillary state registers (SPARC V9 only)
2810 .RE
2811
2812 .sp
2813 .ne 2
2814 .na
2815 \fB\fB/proc/\fIpid\fR/lwp/\fIlwpid\fR/spymaster\fR\fR
2816 .ad
2817 .sp .6
2818 .RS 4n
2819 For an agent LWP, the controlling process
2820 .RE
2821
2822 .SH SEE ALSO
2823 .sp
2824 .LP
2825 \fBls\fR(1), \fBps\fR(1), \fBchroot\fR(1M), \fBalarm\fR(2), \fBbrk\fR(2),
2826 \fBchdir\fR(2), \fBchroot\fR(2), \fBclose\fR(2), \fBcreat\fR(2), \fBdup\fR(2),
2827 \fBexec\fR(2), \fBfcntl\fR(2), \fBfork\fR(2), \fBfork1\fR(2), \fBfstat\fR(2),
2828 \fBgetdents\fR(2), \fBgetustack\fR(2), \fBkill\fR(2), \fBlseek\fR(2),
2829 \fBmmap\fR(2), \fBnice\fR(2), \fBopen\fR(2), \fBpoll\fR(2), \fBpread\fR(2),
2830 \fBptrace\fR(3C), \fBpwrite\fR(2), \fBread\fR(2), \fBreadlink\fR(2),
2831 \fBreadv\fR(2), \fBshmget\fR(2), \fBsigaction\fR(2), \fBsigaltstack\fR(2),
2832 \fBvfork\fR(2), \fBwrite\fR(2), \fBwritev\fR(2), \fB_stack_grow\fR(3C),
2833 \fBreaddir\fR(3C), \fBpthread_create\fR(3C), \fBpthread_join\fR(3C),
2834 \fBsiginfo.h\fR(3HEAD), \fBsignal.h\fR(3HEAD), \fBthr_create\fR(3C),
2835 \fBthr_join\fR(3C), \fBtypes32.h\fR(3HEAD), \fBucontext.h\fR(3HEAD),
2836 \fBwait\fR(3C), \fBcontract\fR(4), \fBcore\fR(4), \fBprocess\fR(4),
2837 \fBlfcompile\fR(5), \fBprivileges\fR(5)
2838 .SH DIAGNOSTICS
2839 .sp
2840 .LP
2841 Errors that can occur in addition to the errors normally associated with file
2842 system access:
2843 .sp
2844 .ne 2
2845 .na
2846 \fB\fBE2BIG\fR\fR
2847 .ad
2848 .RS 13n
2849 Data to be returned in a \fBread\fR(2) of the page data file exceeds the size
2850 of the read buffer provided by the caller.
2851 .RE
2852
2853 .sp
2854 .ne 2
2855 .na
2856 \fB\fBEACCES\fR\fR
2857 .ad
2858 .RS 13n
2859 An attempt was made to examine a process that ran under a different uid than
2974 .na
2975 \fB\fBEPERM\fR\fR
2976 .ad
2977 .RS 13n
2978 The process that issued the \fBPCSCRED\fR or \fBPCSCREDX\fR operation did not
2979 have the {\fBPRIV_PROC_SETID\fR} privilege asserted in its effective set, or
2980 the process that issued the \fBPCNICE\fR operation did not have the
2981 {\fBPRIV_PROC_PRIOCNTL\fR} in its effective set.
2982 .sp
2983 An attempt was made to control a process of which the E, P, and I privilege
2984 sets were not a subset of the effective set of the controlling process or the
2985 limit set of the controlling process is not a superset of limit set of the
2986 controlled process.
2987 .sp
2988 Any of the uids of the target process are 0 or an attempt was made to change
2989 any of the uids to 0 using PCSCRED and the security policy imposed additional
2990 restrictions. See \fBprivileges\fR(5).
2991 .RE
2992
2993 .SH NOTES
2994 .sp
2995 .LP
2996 Descriptions of structures in this document include only interesting structure
2997 elements, not filler and padding fields, and may show elements out of order for
2998 descriptive clarity. The actual structure definitions are contained in
2999 \fB<procfs.h>\fR\&.
3000 .SH BUGS
3001 .sp
3002 .LP
3003 Because the old \fBioctl\fR(2)-based version of \fB/proc\fR is currently
3004 supported for binary compatibility with old applications, the top-level
3005 directory for a process, \fB/proc/\fR\fIpid\fR, is not world-readable, but it
3006 is world-searchable. Thus, anyone can open \fB/proc/\fR\fIpid\fR\fB/psinfo\fR
3007 even though \fBls\fR(1) applied to \fB/proc/\fR\fIpid\fR will fail for anyone
3008 but the owner or an appropriately privileged process. Support for the old
3009 \fBioctl\fR(2)-based version of \fB/proc\fR will be dropped in a future
3010 release, at which time the top-level directory for a process will be made
3011 world-readable.
3012 .sp
3013 .LP
3014 On SPARC based machines, the types \fBgregset_t\fR and \fBfpregset_t\fR defined
3015 in <\fBsys/regset.h\fR> are similar to but not the same as the types
3016 \fBprgregset_t\fR and \fBprfpregset_t\fR defined in <\fBprocfs.h\fR>.
|
1 '\" te
2 .\" Copyright 1989 AT&T
3 .\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved.
4 .\" Copyright 2015, 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 "May 19, 2014"
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).
29 .sp
30 .LP
31 Standard system calls are used to access \fB/proc\fR files: \fBopen\fR(2),
156 writing the address space, reading the address-map files, and setting the
157 target process's registers. There is no restriction on operations applied by a
158 64-bit process to either a 32-bit or a 64-bit target processes.
159 .sp
160 .LP
161 The format of the contents of any \fB/proc\fR file depends on the data model of
162 the observer (the controlling process), not on the data model of the target
163 process. A 64-bit debugger does not have to translate the information it reads
164 from a \fB/proc\fR file for a 32-bit process from 32-bit format to 64-bit
165 format. However, it usually has to be aware of the data model of the target
166 process. The \fBpr_dmodel\fR field of the \fBstatus\fR files indicates the
167 target process's data model.
168 .sp
169 .LP
170 To help deal with system data structures that are read from 32-bit processes, a
171 64-bit controlling program can be compiled with the C preprocessor symbol
172 \fB_SYSCALL32\fR defined before system header files are included. This makes
173 explicit 32-bit fixed-width data structures (like \fBcstruct stat32\fR) visible
174 to the 64-bit program. See \fBtypes32.h\fR(3HEAD).
175 .SH DIRECTORY STRUCTURE
176 .LP
177 At the top level, the directory \fB/proc\fR contains entries each of which
178 names an existing process in the system. These entries are themselves
179 directories. Except where otherwise noted, the files described below can be
180 opened for reading only. In addition, if a process becomes a \fIzombie\fR (one
181 that has exited but whose parent has not yet performed a \fBwait\fR(3C) upon
182 it), most of its associated \fB/proc\fR files disappear from the hierarchy;
183 subsequent attempts to open them, or to read or write files opened before the
184 process exited, will elicit the error \fBENOENT\fR.
185 .sp
186 .LP
187 Although process state and consequently the contents of \fB/proc\fR files can
188 change from instant to instant, a single \fBread\fR(2) of a \fB/proc\fR file is
189 guaranteed to return a sane representation of state; that is, the read will be
190 atomic with respect to the state of the process. No such guarantee applies to
191 successive reads applied to a \fB/proc\fR file for a running process. In
192 addition, atomicity is not guaranteed for \fBI/O\fR applied to the \fBas\fR
193 (address-space) file for a running process or for a process whose address space
194 contains memory shared by another running process.
195 .sp
196 .LP
197 A number of structure definitions are used to describe the files. These
198 structures may grow by the addition of elements at the end in future releases
199 of the system and it is not legitimate for a program to assume that they will
200 not.
201 .SH STRUCTURE OF \fB/proc/\fR\fIpid\fR
202 .LP
203 A given directory \fB/proc/\fR\fIpid\fR contains the following entries. A
204 process can use the invisible alias \fB/proc/self\fR if it wishes to open one
205 of its own \fB/proc\fR files (invisible in the sense that the name ``self''
206 does not appear in a directory listing of \fB/proc\fR obtained from
207 \fBls\fR(1), \fBgetdents\fR(2), or \fBreaddir\fR(3C)).
208 .SS "contracts"
209 .LP
210 A directory containing references to the contracts held by the process. Each
211 entry is a symlink to the contract's directory under \fB/system/contract\fR.
212 See \fBcontract\fR(4).
213 .SS "as"
214 .LP
215 Contains the address-space image of the process; it can be opened for both
216 reading and writing. \fBlseek\fR(2) is used to position the file at the virtual
217 address of interest and then the address space can be examined or changed
218 through \fBread\fR(2) or \fBwrite\fR(2) (or by using \fBpread\fR(2) or
219 \fBpwrite\fR(2) for the combined operation).
220 .SS "ctl"
221 .LP
222 A write-only file to which structured messages are written directing the system
223 to change some aspect of the process's state or control its behavior in some
224 way. The seek offset is not relevant when writing to this file. Individual lwps
225 also have associated \fBlwpctl\fR files in the lwp subdirectories. A control
226 message may be written either to the process's \fBctl\fR file or to a specific
227 \fBlwpctl\fR file with operation-specific effects. The effect of a control
228 message is immediately reflected in the state of the process visible through
229 appropriate status and information files. The types of control messages are
230 described in detail later. See \fBCONTROL MESSAGES\fR.
231 .SS "status"
232 .LP
233 Contains state information about the process and the representative lwp. The
234 file contains a \fBpstatus\fR structure which contains an embedded
235 \fBlwpstatus\fR structure for the representative lwp, as follows:
236 .sp
237 .in +2
238 .nf
239 typedef struct pstatus {
240 int pr_flags; /* flags (see below) */
241 int pr_nlwp; /* number of active lwps in the process */
242 int pr_nzomb; /* number of zombie lwps in the process */
243 pid_tpr_pid; /* process id */
244 pid_tpr_ppid; /* parent process id */
245 pid_tpr_pgid; /* process group id */
246 pid_tpr_sid; /* session id */
247 id_t pr_aslwpid; /* obsolete */
248 id_t pr_agentid; /* lwp-id of the agent lwp, if any */
249 sigset_t pr_sigpend; /* set of process pending signals */
250 uintptr_t pr_brkbase; /* virtual address of the process heap */
251 size_t pr_brksize; /* size of the process heap, in bytes */
648 .na
649 \fB\fBPR_JOBCONTROL\fR\fR
650 .ad
651 .RS 17n
652 indicates that the lwp stopped due to the default action of a job control stop
653 signal (see \fBsigaction\fR(2)); \fBpr_what\fR holds the stopping signal
654 number.
655 .RE
656
657 .sp
658 .ne 2
659 .na
660 \fB\fBPR_SUSPENDED\fR\fR
661 .ad
662 .RS 17n
663 indicates that the lwp stopped due to internal synchronization of lwps within
664 the process. \fBpr_what\fR is unused in this case.
665 .RE
666
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
680 .LP
681 \fBpr_cursig\fR names the current signal, that is, the next signal to be
682 delivered to the lwp, if any. \fBpr_info\fR, when the lwp is in a
683 \fBPR_SIGNALLED\fR or \fBPR_FAULTED\fR stop, contains additional information
684 pertinent to the particular signal or fault (see \fB<sys/siginfo.h>\fR).
685 .sp
686 .LP
687 \fBpr_lwppend\fR identifies any synchronous or directed signals pending for the
688 lwp. \fBpr_lwphold\fR identifies those signals whose delivery is being blocked
689 by the lwp (the signal mask).
690 .sp
691 .LP
692 \fBpr_action\fR contains the signal action information pertaining to the
693 current signal (see \fBsigaction\fR(2)); it is undefined if \fBpr_cursig\fR is
694 zero. \fBpr_altstack\fR contains the alternate signal stack information for the
695 lwp (see \fBsigaltstack\fR(2)).
696 .sp
697 .LP
698 \fBpr_oldcontext\fR, if not zero, contains the address on the lwp stack of a
699 \fBucontext\fR structure describing the previous user-level context (see
852 .fi
853 .in -2
854
855 The preceding constants are listed in \fB<sys/regset.h>\fR\&.
856 .RE
857
858 .sp
859 .LP
860 \fBpr_fpreg\fR is a structure holding the contents of the floating-point
861 registers.
862 .sp
863 .LP
864 SPARC registers, both general and floating-point, as seen by a 64-bit
865 controlling process are the V9 versions of the registers, even if the target
866 process is a 32-bit (V8) process. V8 registers are a subset of the V9
867 registers.
868 .sp
869 .LP
870 If the lwp is not stopped, all register values are undefined.
871 .SS "psinfo"
872 .LP
873 Contains miscellaneous information about the process and the representative lwp
874 needed by the \fBps\fR(1) command. \fBpsinfo\fR remains accessible after a
875 process becomes a \fIzombie\fR. The file contains a \fBpsinfo\fR structure
876 which contains an embedded \fBlwpsinfo\fR structure for the representative lwp,
877 as follows:
878 .sp
879 .in +2
880 .nf
881 typedef struct psinfo {
882 int pr_flag; /* process flags (DEPRECATED: see below) */
883 int pr_nlwp; /* number of active lwps in the process */
884 int pr_nzomb; /* number of zombie lwps in the process */
885 pid_t pr_pid; /* process id */
886 pid_t pr_ppid; /* process id of parent */
887 pid_t pr_pgid; /* process id of process group leader */
888 pid_t pr_sid; /* session id */
889 uid_t pr_uid; /* real user id */
890 uid_t pr_euid; /* effective user id */
891 gid_t pr_gid; /* real group id */
917 .in -2
918
919 .sp
920 .LP
921 Some of the entries in \fBpsinfo\fR, such as \fBpr_addr\fR, refer to internal
922 kernel data structures and should not be expected to retain their meanings
923 across different versions of the operating system.
924 .sp
925 .LP
926 \fBpsinfo_t.pr_flag\fR is a deprecated interface that should no longer be used.
927 Applications currently relying on the \fBSSYS\fR bit in \fBpr_flag\fR should
928 migrate to checking \fBPR_ISSYS\fR in the \fBpstatus\fR structure's
929 \fBpr_flags\fR field.
930 .sp
931 .LP
932 \fBpr_pctcpu\fR and \fBpr_pctmem\fR are 16-bit binary fractions in the range
933 0.0 to 1.0 with the binary point to the right of the high-order bit (1.0 ==
934 0x8000). \fBpr_pctcpu\fR is the summation over all lwps in the process.
935 .sp
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
946 \fBpr_lwp\fR contains the \fBps\fR(1) information for the representative lwp.
947 If the process is a \fIzombie\fR, \fBpr_nlwp\fR, \fBpr_nzomb\fR, and
948 \fBpr_lwp.pr_lwpid\fR are zero and the other fields of \fBpr_lwp\fR are
949 undefined:
950 .sp
951 .in +2
952 .nf
953 typedef struct lwpsinfo {
954 int pr_flag; /* lwp flags (DEPRECATED: see below) */
955 id_t pr_lwpid; /* lwp id */
956 uintptr_t pr_addr; /* internal address of lwp */
957 uintptr_t pr_wchan; /* wait addr for sleeping lwp */
958 char pr_stype; /* synchronization event type */
959 char pr_state; /* numeric lwp state */
960 char pr_sname; /* printable character for pr_state */
961 char pr_nice; /* nice for cpu usage */
962 short pr_syscall; /* system call number (if in syscall) */
963 char pr_oldpri; /* pre-SVR4, low value is high priority */
964 char pr_cpu; /* pre-SVR4, cpu usage for scheduling */
965 int pr_pri; /* priority, high value = high priority */
979 .sp
980 .LP
981 Some of the entries in \fBlwpsinfo\fR, such as \fBpr_addr\fR, \fBpr_wchan\fR,
982 \fBpr_stype\fR, \fBpr_state\fR, and \fBpr_name\fR, refer to internal kernel
983 data structures and should not be expected to retain their meanings across
984 different versions of the operating system.
985 .sp
986 .LP
987 \fBlwpsinfo_t.pr_flag\fR is a deprecated interface that should no longer be
988 used.
989 .sp
990 .LP
991 \fBpr_pctcpu\fR is a 16-bit binary fraction, as described above. It represents
992 the \fBCPU\fR time used by the specific lwp. On a multi-processor machine, the
993 maximum value is 1/N, where N is the number of \fBCPU\fRs.
994 .sp
995 .LP
996 \fBpr_contract\fR is the id of the process contract of which the process is a
997 member. See \fBcontract\fR(4) and \fBprocess\fR(4).
998 .SS "cred"
999 .LP
1000 Contains a description of the credentials associated with the process:
1001 .sp
1002 .in +2
1003 .nf
1004 typedef struct prcred {
1005 uid_t pr_euid; /* effective user id */
1006 uid_t pr_ruid; /* real user id */
1007 uid_t pr_suid; /* saved user id (from exec) */
1008 gid_t pr_egid; /* effective group id */
1009 gid_t pr_rgid; /* real group id */
1010 gid_t pr_sgid; /* saved group id (from exec) */
1011 int pr_ngroups; /* number of supplementary groups */
1012 gid_t pr_groups[1]; /* array of supplementary groups */
1013 } prcred_t;
1014 .fi
1015 .in -2
1016 .sp
1017
1018 .sp
1019 .LP
1020 The array of associated supplementary groups in \fBpr_groups\fR is of variable
1021 length; the \fBcred\fR file contains all of the supplementary groups.
1022 \fBpr_ngroups\fR indicates the number of supplementary groups. (See also the
1023 \fBPCSCRED\fR and \fBPCSCREDX\fR control operations.)
1024 .SS "priv"
1025 .LP
1026 Contains a description of the privileges associated with the process:
1027 .sp
1028 .in +2
1029 .nf
1030 typedef struct prpriv {
1031 uint32_t pr_nsets; /* number of privilege set */
1032 uint32_t pr_setsize; /* size of privilege set */
1033 uint32_t pr_infosize; /* size of supplementary data */
1034 priv_chunk_t pr_sets[1]; /* array of sets */
1035 } prpriv_t;
1036 .fi
1037 .in -2
1038
1039 .sp
1040 .LP
1041 The actual dimension of the \fBpr_sets\fR[] field is
1042 .sp
1043 .in +2
1044 .nf
1045 pr_sets[pr_nsets][pr_setsize]
1046 .fi
1047 .in -2
1048
1049 .sp
1050 .LP
1051 which is followed by additional information about the process state
1052 \fBpr_infosize\fR bytes in size.
1053 .sp
1054 .LP
1055 The full size of the structure can be computed using
1056 \fBPRIV_PRPRIV_SIZE\fR(\fBprpriv_t *\fR).
1057 .SS "sigact"
1058 .LP
1059 Contains an array of \fBsigaction structures\fR describing the current
1060 dispositions of all signals associated with the traced process (see
1061 \fBsigaction\fR(2)). Signal numbers are displaced by 1 from array indices, so
1062 that the action for signal number \fIn\fR appears in position \fIn\fR-1 of the
1063 array.
1064 .SS "auxv"
1065 .LP
1066 Contains the initial values of the process's aux vector in an array of
1067 \fBauxv_t\fR structures (see \fB<sys/auxv.h>\fR). The values are those that
1068 were passed by the operating system as startup information to the dynamic
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.
1076 .SS "ldt"
1077 .LP
1078 This file exists only on x86-based machines. It is non-empty only if the
1079 process has established a local descriptor table (\fBLDT\fR). If non-empty, the
1080 file contains the array of currently active \fBLDT\fR entries in an array of
1081 elements of type \fBstruct ssd\fR, defined in \fB<sys/sysi86.h>\fR, one element
1082 for each active \fBLDT\fR entry.
1083 .SS "map, xmap"
1084 .LP
1085 Contain information about the virtual address map of the process. The map file
1086 contains an array of \fBprmap\fR structures while the xmap file contains an
1087 array of \fBprxmap\fR structures. Each structure describes a contiguous virtual
1088 address region in the address space of the traced process:
1089 .sp
1090 .in +2
1091 .nf
1092 typedef struct prmap {
1093 uintptr_tpr_vaddr; /* virtual address of mapping */
1094 size_t pr_size; /* size of mapping in bytes */
1095 char pr_mapname[PRMAPSZ]; /* name in /proc/pid/object */
1096 offset_t pr_offset; /* offset into mapped object, if any */
1097 int pr_mflags; /* protection and attribute flags */
1098 int pr_pagesize; /* pagesize for this mapping in bytes */
1099 int pr_shmid; /* SysV shared memory identifier */
1100 } prmap_t;
1101 .fi
1102 .in -2
1103 .sp
1231 .sp
1232 .LP
1233 \fBpr_rss\fR is the number of resident pages of memory for the mapping. The
1234 number of resident bytes for the mapping may be determined by multiplying
1235 \fBpr_rss\fR by the page size given by \fBpr_pagesize.\fR
1236 .sp
1237 .LP
1238 \fBpr_anon\fR is the number of resident anonymous memory pages (pages which are
1239 private to this process) for the mapping.
1240 .sp
1241 .LP
1242 \fBpr_locked\fR is the number of locked pages for the mapping. Pages which are
1243 locked are always resident in memory.
1244 .sp
1245 .LP
1246 \fBpr_hatpagesize\fR is the size, in bytes, of the \fBHAT\fR (\fBMMU\fR)
1247 translation for the mapping. \fBpr_hatpagesize\fR may be different than
1248 \fBpr_pagesize.\fR The possible values are hardware architecture specific, and
1249 may change over a mapping's lifetime.
1250 .SS "rmap"
1251 .LP
1252 Contains information about the reserved address ranges of the process. The file
1253 contains an array of \fBprmap\fR structures, as defined above for the \fBmap\fR
1254 file. Each structure describes a contiguous virtual address region in the
1255 address space of the traced process that is reserved by the system in the sense
1256 that an \fBmmap\fR(2) system call that does not specify \fBMAP_FIXED\fR will
1257 not use any part of it for the new mapping. Examples of such reservations
1258 include the address ranges reserved for the process stack and the individual
1259 thread stacks of a multi-threaded process.
1260 .SS "cwd"
1261 .LP
1262 A symbolic link to the process's current working directory. See \fBchdir\fR(2).
1263 A \fBreadlink\fR(2) of \fB/proc/\fIpid\fR/cwd\fR yields a null string. However,
1264 it can be opened, listed, and searched as a directory, and can be the target of
1265 \fBchdir\fR(2).
1266 .SS "root"
1267 .LP
1268 A symbolic link to the process's root directory.
1269 \fB/proc/\fR\fIpid\fR\fB/root\fR can differ from the system root directory if
1270 the process or one of its ancestors executed \fBchroot\fR(2) as super user. It
1271 has the same semantics as \fB/proc/\fR\fIpid\fR\fB/cwd\fR.
1272 .SS "fd"
1273 .LP
1274 A directory containing references to the open files of the process. Each entry
1275 is a decimal number corresponding to an open file descriptor in the process.
1276 .sp
1277 .LP
1278 If an entry refers to a regular file, it can be opened with normal file system
1279 semantics but, to ensure that the controlling process cannot gain greater
1280 access than the controlled process, with no file access modes other than its
1281 read/write open modes in the controlled process. If an entry refers to a
1282 directory, it can be accessed with the same semantics as
1283 \fB/proc/\fIpid\fR/cwd\fR. An attempt to open any other type of entry fails
1284 with \fBEACCES\fR.
1285 .SS "object"
1286 .LP
1287 A directory containing read-only files with names corresponding to the
1288 \fBpr_mapname\fR entries in the \fBmap\fR and \fBpagedata\fR files. Opening
1289 such a file yields a file descriptor for the underlying mapped file associated
1290 with an address-space mapping in the process. The file name \fBa.out\fR appears
1291 in the directory as an alias for the process's executable file.
1292 .sp
1293 .LP
1294 The \fBobject\fR directory makes it possible for a controlling process to gain
1295 access to the object file and any shared libraries (and consequently the symbol
1296 tables) without having to know the actual path names of the executable files.
1297 .SS "path"
1298 .LP
1299 A directory containing symbolic links to files opened by the process. The
1300 directory includes one entry for \fBcwd\fR and \fBroot\fR. The directory also
1301 contains a numerical entry for each file descriptor in the \fBfd\fR directory,
1302 and entries matching those in the \fBobject\fR directory. If this information
1303 is not available, any attempt to read the contents of the symbolic link will
1304 fail. This is most common for files that do not exist in the filesystem
1305 namespace (such as \fBFIFO\fRs and sockets), but can also happen for regular
1306 files. For the file descriptor entries, the path may be different from the one
1307 used by the process to open the file.
1308 .SS "pagedata"
1309 .LP
1310 Opening the page data file enables tracking of address space references and
1311 modifications on a per-page basis.
1312 .sp
1313 .LP
1314 A \fBread\fR(2) of the page data file descriptor returns structured page data
1315 and atomically clears the page data maintained for the file by the system. That
1316 is to say, each read returns data collected since the last read; the first read
1317 returns data collected since the file was opened. When the call completes, the
1318 read buffer contains the following structure as its header and thereafter
1319 contains a number of section header structures and associated byte arrays that
1320 must be accessed by walking linearly through the buffer.
1321 .sp
1322 .in +2
1323 .nf
1324 typedef struct prpageheader {
1325 timestruc_t pr_tstamp; /* real time stamp, time of read() */
1326 ulong_t pr_nmap; /* number of address space mappings */
1327 ulong_t pr_npage; /* total number of pages */
1328 } prpageheader_t;
1370 .ad
1371 .RS 17n
1372 page has been modified.
1373 .RE
1374
1375 .sp
1376 .LP
1377 If the read buffer is not large enough to contain all of the page data, the
1378 read fails with \fBE2BIG\fR and the page data is not cleared. The required size
1379 of the read buffer can be determined through \fBfstat\fR(2). Application of
1380 \fBlseek\fR(2) to the page data file descriptor is ineffective; every read
1381 starts from the beginning of the file. Closing the page data file descriptor
1382 terminates the system overhead associated with collecting the data.
1383 .sp
1384 .LP
1385 More than one page data file descriptor for the same process can be opened, up
1386 to a system-imposed limit per traced process. A read of one does not affect the
1387 data being collected by the system for the others. An open of the page data
1388 file will fail with \fBENOMEM\fR if the system-imposed limit would be exceeded.
1389 .SS "watch"
1390 .LP
1391 Contains an array of \fBprwatch\fR structures, one for each watched area
1392 established by the \fBPCWATCH\fR control operation. See \fBPCWATCH\fR for
1393 details.
1394 .SS "usage"
1395 .LP
1396 Contains process usage information described by a \fBprusage\fR structure which
1397 contains at least the following fields:
1398 .sp
1399 .in +2
1400 .nf
1401 typedef struct prusage {
1402 id_t pr_lwpid; /* lwp id. 0: process or defunct */
1403 int pr_count; /* number of contributing lwps */
1404 timestruc_t pr_tstamp; /* real time stamp, time of read() */
1405 timestruc_t pr_create; /* process/lwp creation time stamp */
1406 timestruc_t pr_term; /* process/lwp termination time stamp */
1407 timestruc_t pr_rtime; /* total lwp real (elapsed) time */
1408 timestruc_t pr_utime; /* user level CPU time */
1409 timestruc_t pr_stime; /* system call CPU time */
1410 timestruc_t pr_ttime; /* other system trap CPU time */
1411 timestruc_t pr_tftime; /* text page fault sleep time */
1412 timestruc_t pr_dftime; /* data page fault sleep time */
1413 timestruc_t pr_kftime; /* kernel page fault sleep time */
1414 timestruc_t pr_ltime; /* user lock wait sleep time */
1421 ulong_t pr_inblk; /* input blocks */
1422 ulong_t pr_oublk; /* output blocks */
1423 ulong_t pr_msnd; /* messages sent */
1424 ulong_t pr_mrcv; /* messages received */
1425 ulong_t pr_sigs; /* signals received */
1426 ulong_t pr_vctx; /* voluntary context switches */
1427 ulong_t pr_ictx; /* involuntary context switches */
1428 ulong_t pr_sysc; /* system calls */
1429 ulong_t pr_ioch; /* chars read and written */
1430 } prusage_t;
1431 .fi
1432 .in -2
1433
1434 .sp
1435 .LP
1436 Microstate accounting is now continuously enabled. While this information was
1437 previously an estimate, if microstate accounting were not enabled, the current
1438 information is now never an estimate represents time the process has spent in
1439 various states.
1440 .SS "lstatus"
1441 .LP
1442 Contains a \fBprheader\fR structure followed by an array of \fBlwpstatus\fR
1443 structures, one for each active lwp in the process (see also
1444 \fB/proc/\fR\fIpid\fR\fB/lwp/\fR\fIlwpid\fR/\fBlwpstatus\fR, below). The
1445 \fBprheader\fR structure describes the number and size of the array entries
1446 that follow.
1447 .sp
1448 .in +2
1449 .nf
1450 typedef struct prheader {
1451 long pr_nent; /* number of entries */
1452 size_t pr_entsize; /* size of each entry, in bytes */
1453 } prheader_t;
1454 .fi
1455 .in -2
1456
1457 .sp
1458 .LP
1459 The \fBlwpstatus\fR structure may grow by the addition of elements at the end
1460 in future releases of the system. Programs must use \fBpr_entsize\fR in the
1461 file header to index through the array. These comments apply to all \fB/proc\fR
1462 files that include a \fBprheader\fR structure (\fBlpsinfo\fR and \fBlusage\fR,
1463 below).
1464 .SS "lpsinfo"
1465 .LP
1466 Contains a \fBprheader\fR structure followed by an array of \fBlwpsinfo\fR
1467 structures, one for eachactive and zombie lwp in the process. See also
1468 \fB/proc/\fR\fIpid\fR\fB/lwp/\fR\fIlwpid\fR/\fBlwpsinfo\fR, below.
1469 .SS "lusage"
1470 .LP
1471 Contains a \fBprheader\fR structure followed by an array of \fBprusage\fR
1472 structures, one for each active lwp in the process, plus an additional element
1473 at the beginning that contains the summation over all defunct lwps (lwps that
1474 once existed but no longer exist in the process). Excluding the \fBpr_lwpid\fR,
1475 \fBpr_tstamp\fR, \fBpr_create\fR, and \fBpr_term\fR entries, the entry-by-entry
1476 summation over all these structures is the definition of the process usage
1477 information obtained from the \fBusage\fR file. (See also
1478 \fB/proc/\fR\fIpid\fR\fB/lwp/\fR\fIlwpid\fR/\fBlwpusage\fR, below.)
1479 .SS "lwp"
1480 .LP
1481 A directory containing entries each of which names an active or zombie lwp
1482 within the process. These entries are themselves directories containing
1483 additional files as described below. Only the \fBlwpsinfo\fR file exists in the
1484 directory of a zombie lwp.
1485 .SH STRUCTURE OF \fB/proc/\fR\fIpid\fR\fB/lwp/\fR\fIlwpid\fR
1486 .LP
1487 A given directory \fB/proc/\fR\fIpid\fR\fB/lwp/\fR\fIlwpid\fR contains the
1488 following entries:
1489 .SS "lwpctl"
1490 .LP
1491 Write-only control file. The messages written to this file affect the specific
1492 lwp rather than the representative lwp, as is the case for the process's
1493 \fBctl\fR file.
1494 .SS "lwpstatus"
1495 .LP
1496 lwp-specific state information. This file contains the \fBlwpstatus\fR
1497 structure for the specific lwp as described above for the representative lwp in
1498 the process's \fBstatus\fR file.
1499 .SS "lwpsinfo"
1500 .LP
1501 lwp-specific \fBps\fR(1) information. This file contains the \fBlwpsinfo\fR
1502 structure for the specific lwp as described above for the representative lwp in
1503 the process's \fBpsinfo\fR file. The \fBlwpsinfo\fR file remains accessible
1504 after an lwp becomes a zombie.
1505 .SS "lwpusage"
1506 .LP
1507 This file contains the \fBprusage\fR structure for the specific lwp as
1508 described above for the process's \fBusage\fR file.
1509 .SS "gwindows"
1510 .LP
1511 This file exists only on SPARC based machines. If it is non-empty, it contains
1512 a \fBgwindows_t\fR structure, defined in \fB<sys/regset.h>\fR, with the values
1513 of those SPARC register windows that could not be stored on the stack when the
1514 lwp stopped. Conditions under which register windows are not stored on the
1515 stack are: the stack pointer refers to nonexistent process memory or the stack
1516 pointer is improperly aligned. If the lwp is not stopped or if there are no
1517 register windows that could not be stored on the stack, the file is empty (the
1518 usual case).
1519 .SS "xregs"
1520 .LP
1521 Extra state registers. The extra state register set is architecture dependent;
1522 this file is empty if the system does not support extra state registers. If the
1523 file is non-empty, it contains an architecture dependent structure of type
1524 \fBprxregset_t\fR, defined in \fB<procfs.h>\fR, with the values of the lwp's
1525 extra state registers. If the lwp is not stopped, all register values are
1526 undefined. See also the \fBPCSXREG\fR control operation, below.
1527 .SS "asrs"
1528 .LP
1529 This file exists only for 64-bit SPARC V9 processes. It contains an
1530 \fBasrset_t\fR structure, defined in <\fBsys/regset.h\fR>, containing the
1531 values of the lwp's platform-dependent ancillary state registers. If the lwp is
1532 not stopped, all register values are undefined. See also the \fBPCSASRS\fR
1533 control operation, below.
1534 .SS "spymaster"
1535 .LP
1536 For an agent lwp (see \fBPCAGENT\fR), this file contains a \fBpsinfo_t\fR
1537 structure that corresponds to the process that created the agent lwp at the
1538 time the agent was created. This structure is identical to that retrieved via
1539 the \fBpsinfo\fR file, with one modification: the \fBpr_time\fR field does not
1540 correspond to the CPU time for the process, but rather to the creation time of
1541 the agent lwp.
1542 .SS "templates"
1543 .LP
1544 A directory which contains references to the active templates for the lwp,
1545 named by the contract type. Changes made to an active template descriptor do
1546 not affect the original template which was activated, though they do affect the
1547 active template. It is not possible to activate an active template descriptor.
1548 See \fBcontract\fR(4).
1549 .SH CONTROL MESSAGES
1550 .LP
1551 Process state changes are effected through messages written to a process's
1552 \fBctl\fR file or to an individual lwp's \fBlwpctl\fR file. All control
1553 messages consist of a \fBlong\fR that names the specific operation followed by
1554 additional data containing the operand, if any.
1555 .sp
1556 .LP
1557 Multiple control messages may be combined in a single \fBwrite\fR(2) (or
1558 \fBwritev\fR(2)) to a control file, but no partial writes are permitted. That
1559 is, each control message, operation code plus operand, if any, must be
1560 presented in its entirety to the \fBwrite\fR(2) and not in pieces over several
1561 system calls. If a control operation fails, no subsequent operations contained
1562 in the same \fBwrite\fR(2) are attempted.
1563 .sp
1564 .LP
1565 Descriptions of the allowable control messages follow. In all cases, writing a
1566 message to a control file for a process or lwp that has terminated elicits the
1567 error \fBENOENT\fR.
1568 .SS "PCSTOP PCDSTOP PCWSTOP PCTWSTOP"
1569 .LP
1570 When applied to the process control file, \fBPCSTOP\fR directs all lwps to stop
1571 and waits for them to stop, \fBPCDSTOP\fR directs all lwps to stop without
1572 waiting for them to stop, and \fBPCWSTOP\fR simply waits for all lwps to stop.
1573 When applied to an lwp control file, \fBPCSTOP\fR directs the specific lwp to
1574 stop and waits until it has stopped, \fBPCDSTOP\fR directs the specific lwp to
1575 stop without waiting for it to stop, and \fBPCWSTOP\fR simply waits for the
1576 specific lwp to stop. When applied to an lwp control file, \fBPCSTOP\fR and
1577 \fBPCWSTOP\fR complete when the lwp stops on an event of interest, immediately
1578 if already so stopped; when applied to the process control file, they complete
1579 when every lwp has stopped either on an event of interest or on a
1580 \fBPR_SUSPENDED\fR stop.
1581 .sp
1582 .LP
1583 \fBPCTWSTOP\fR is identical to \fBPCWSTOP\fR except that it enables the
1584 operation to time out, to avoid waiting forever for a process or lwp that may
1585 never stop on an event of interest. \fBPCTWSTOP\fR takes a \fBlong\fR operand
1586 specifying a number of milliseconds; the wait will terminate successfully after
1587 the specified number of milliseconds even if the process or lwp has not
1588 stopped; a timeout value of zero makes the operation identical to
1597 is traced and again showing \fBPR_JOBCONTROL\fR if the lwp is set running
1598 without clearing the signal.) If \fBPCSTOP\fR or \fBPCDSTOP\fR is applied to an
1599 lwp that is stopped, but not on an event of interest, the stop directive takes
1600 effect when the lwp is restarted by the competing mechanism. At that time, the
1601 lwp enters a \fBPR_REQUESTED\fR stop before executing any user-level code.
1602 .sp
1603 .LP
1604 A write of a control message that blocks is interruptible by a signal so that,
1605 for example, an \fBalarm\fR(2) can be set to avoid waiting forever for a
1606 process or lwp that may never stop on an event of interest. If \fBPCSTOP\fR is
1607 interrupted, the lwp stop directives remain in effect even though the
1608 \fBwrite\fR(2) returns an error. (Use of \fBPCTWSTOP\fR with a non-zero timeout
1609 is recommended over \fBPCWSTOP\fR with an \fBalarm\fR(2).)
1610 .sp
1611 .LP
1612 A system process (indicated by the \fBPR_ISSYS\fR flag) never executes at user
1613 level, has no user-level address space visible through \fB/proc\fR, and cannot
1614 be stopped. Applying one of these operations to a system process or any of its
1615 lwps elicits the error \fBEBUSY\fR.
1616 .SS "PCRUN"
1617 .LP
1618 Make an lwp runnable again after a stop. This operation takes a \fBlong\fR
1619 operand containing zero or more of the following flags:
1620 .sp
1621 .ne 2
1622 .na
1623 \fB\fBPRCSIG\fR\fR
1624 .ad
1625 .RS 12n
1626 clears the current signal, if any (see \fBPCCSIG\fR).
1627 .RE
1628
1629 .sp
1630 .ne 2
1631 .na
1632 \fB\fBPRCFAULT\fR\fR
1633 .ad
1634 .RS 12n
1635 clears the current fault, if any (see \fBPCCFAULT\fR).
1636 .RE
1677 .sp
1678 .LP
1679 When applied to an lwp control file, \fBPCRUN\fR clears any outstanding
1680 directed-stop request and makes the specific lwp runnable. The operation fails
1681 with \fBEBUSY\fR if the specific lwp is not stopped on an event of interest or
1682 has not been directed to stop or if the agent lwp exists and this is not the
1683 agent lwp (see \fBPCAGENT\fR).
1684 .sp
1685 .LP
1686 When applied to the process control file, a representative lwp is chosen for
1687 the operation as described for \fB/proc/\fR\fIpid\fR\fB/status\fR. The
1688 operation fails with \fBEBUSY\fR if the representative lwp is not stopped on an
1689 event of interest or has not been directed to stop or if the agent lwp exists.
1690 If \fBPRSTEP\fR or \fBPRSTOP\fR was requested, the representative lwp is made
1691 runnable and its outstanding directed-stop request is cleared; otherwise all
1692 outstanding directed-stop requests are cleared and, if it was stopped on an
1693 event of interest, the representative lwp is marked \fBPR_REQUESTED\fR. If, as
1694 a consequence, all lwps are in the \fBPR_REQUESTED\fR or \fBPR_SUSPENDED\fR
1695 stop state, all lwps showing \fBPR_REQUESTED\fR are made runnable.
1696 .SS "PCSTRACE"
1697 .LP
1698 Define a set of signals to be traced in the process. The receipt of one of
1699 these signals by an lwp causes the lwp to stop. The set of signals is defined
1700 using an operand \fBsigset_t\fR contained in the control message. Receipt of
1701 \fBSIGKILL\fR cannot be traced; if specified, it is silently ignored.
1702 .sp
1703 .LP
1704 If a signal that is included in an lwp's held signal set (the signal mask) is
1705 sent to the lwp, the signal is not received and does not cause a stop until it
1706 is removed from the held signal set, either by the lwp itself or by setting the
1707 held signal set with \fBPCSHOLD\fR.
1708 .SS "PCCSIG"
1709 .LP
1710 The current signal, if any, is cleared from the specific or representative lwp.
1711 .SS "PCSSIG"
1712 .LP
1713 The current signal and its associated signal information for the specific or
1714 representative lwp are set according to the contents of the operand
1715 \fBsiginfo\fR structure (see \fB<sys/siginfo.h>\fR). If the specified signal
1716 number is zero, the current signal is cleared. The semantics of this operation
1717 are different from those of \fBkill\fR(2) in that the signal is delivered to
1718 the lwp immediately after execution is resumed (even if it is being blocked)
1719 and an additional \fBPR_SIGNALLED\fR stop does not intervene even if the signal
1720 is traced. Setting the current signal to \fBSIGKILL\fR terminates the process
1721 immediately.
1722 .SS "PCKILL"
1723 .LP
1724 If applied to the process control file, a signal is sent to the process with
1725 semantics identical to those of \fBkill\fR(2). If applied to an lwp control
1726 file, a directed signal is sent to the specific lwp. The signal is named in a
1727 \fBlong\fR operand contained in the message. Sending \fBSIGKILL\fR terminates
1728 the process immediately.
1729 .SS "PCUNKILL"
1730 .LP
1731 A signal is deleted, that is, it is removed from the set of pending signals. If
1732 applied to the process control file, the signal is deleted from the process's
1733 pending signals. If applied to an lwp control file, the signal is deleted from
1734 the lwp's pending signals. The current signal (if any) is unaffected. The
1735 signal is named in a \fBlong\fR operand in the control message. It is an error
1736 (\fBEINVAL\fR) to attempt to delete \fBSIGKILL\fR.
1737 .SS "PCSHOLD"
1738 .LP
1739 Set the set of held signals for the specific or representative lwp (signals
1740 whose delivery will be blocked if sent to the lwp). The set of signals is
1741 specified with a \fBsigset_t\fR operand. \fBSIGKILL\fR and \fBSIGSTOP\fR cannot
1742 be held; if specified, they are silently ignored.
1743 .SS "PCSFAULT"
1744 .LP
1745 Define a set of hardware faults to be traced in the process. On incurring one
1746 of these faults, an lwp stops. The set is defined via the operand
1747 \fBfltset_t\fR structure. Fault names are defined in \fB<sys/fault.h>\fR and
1748 include the following. Some of these may not occur on all processors; there may
1749 be processor-specific faults in addition to these.
1750 .sp
1751 .ne 2
1752 .na
1753 \fB\fBFLTILL\fR\fR
1754 .ad
1755 .RS 13n
1756 illegal instruction
1757 .RE
1758
1759 .sp
1760 .ne 2
1761 .na
1762 \fB\fBFLTPRIV\fR\fR
1763 .ad
1848
1849 .sp
1850 .ne 2
1851 .na
1852 \fB\fBFLTPAGE\fR\fR
1853 .ad
1854 .RS 13n
1855 recoverable page fault
1856 .RE
1857
1858 .sp
1859 .LP
1860 When not traced, a fault normally results in the posting of a signal to the lwp
1861 that incurred the fault. If an lwp stops on a fault, the signal is posted to
1862 the lwp when execution is resumed unless the fault is cleared by \fBPCCFAULT\fR
1863 or by the \fBPRCFAULT\fR option of \fBPCRUN\fR. \fBFLTPAGE\fR is an exception;
1864 no signal is posted. The \fBpr_info\fR field in the \fBlwpstatus\fR structure
1865 identifies the signal to be sent and contains machine-specific information
1866 about the fault.
1867 .SS "PCCFAULT"
1868 .LP
1869 The current fault, if any, is cleared; the associated signal will not be sent
1870 to the specific or representative lwp.
1871 .SS "PCSENTRY PCSEXIT"
1872 .LP
1873 These control operations instruct the process's lwps to stop on entry to or
1874 exit from specified system calls. The set of system calls to be traced is
1875 defined via an operand \fBsysset_t\fR structure.
1876 .sp
1877 .LP
1878 When entry to a system call is being traced, an lwp stops after having begun
1879 the call to the system but before the system call arguments have been fetched
1880 from the lwp. When exit from a system call is being traced, an lwp stops on
1881 completion of the system call just prior to checking for signals and returning
1882 to user level. At this point, all return values have been stored into the lwp's
1883 registers.
1884 .sp
1885 .LP
1886 If an lwp is stopped on entry to a system call (\fBPR_SYSENTRY\fR) or when
1887 sleeping in an interruptible system call (\fBPR_ASLEEP\fR is set), it may be
1888 instructed to go directly to system call exit by specifying the \fBPRSABORT\fR
1889 flag in a \fBPCRUN\fR control message. Unless exit from the system call is
1890 being traced, the lwp returns to user level showing \fBEINTR\fR.
1891 .SS "PCWATCH"
1892 .LP
1893 Set or clear a watched area in the controlled process from a \fBprwatch\fR
1894 structure operand:
1895 .sp
1896 .in +2
1897 .nf
1898 typedef struct prwatch {
1899 uintptr_t pr_vaddr; /* virtual address of watched area */
1900 size_t pr_size; /* size of watched area in bytes */
1901 int pr_wflags; /* watch type flags */
1902 } prwatch_t;
1903 .fi
1904 .in -2
1905
1906 .sp
1907 .LP
1908 \fBpr_vaddr\fR specifies the virtual address of an area of memory to be watched
1909 in the controlled process. \fBpr_size\fR specifies the size of the area, in
1910 bytes. \fBpr_wflags\fR specifies the type of memory access to be monitored as a
1911 bit-mask of the following flags:
2020 \fBexec\fR(2). \fBPCWATCH\fR fails with \fBEBUSY\fR if applied to the parent of
2021 a \fBvfork\fR(2) before the child has terminated or performed an \fBexec\fR(2).
2022 The \fBPR_VFORKP\fR flag is set in the \fBpstatus\fR structure for such a
2023 parent process.
2024 .sp
2025 .LP
2026 Certain accesses of the traced process's address space by the operating system
2027 are immune to watchpoints. The initial construction of a signal stack frame
2028 when a signal is delivered to an lwp will not trigger a watchpoint trap even if
2029 the new frame covers watched areas of the stack. Once the signal handler is
2030 entered, watchpoint traps occur normally. On SPARC based machines, register
2031 window overflow and underflow will not trigger watchpoint traps, even if the
2032 register window save areas cover watched areas of the stack.
2033 .sp
2034 .LP
2035 Watched areas are not inherited by child processes, even if the traced
2036 process's inherit-on-fork mode, \fBPR_FORK\fR, is set (see \fBPCSET\fR, below).
2037 All watched areas are cancelled when the traced process performs a successful
2038 \fBexec\fR(2).
2039 .SS "PCSET PCUNSET"
2040 .LP
2041 \fBPCSET\fR sets one or more modes of operation for the traced process.
2042 \fBPCUNSET\fR unsets these modes. The modes to be set or unset are specified by
2043 flags in an operand \fBlong\fR in the control message:
2044 .sp
2045 .ne 2
2046 .na
2047 \fB\fBPR_FORK\fR\fR
2048 .ad
2049 .RS 13n
2050 (inherit-on-fork): When set, the process's tracing flags and its
2051 inherit-on-fork mode are inherited by the child of a \fBfork\fR(2),
2052 \fBfork1\fR(2), or \fBvfork\fR(2). When unset, child processes start with all
2053 tracing flags cleared.
2054 .RE
2055
2056 .sp
2057 .ne 2
2058 .na
2059 \fB\fBPR_RLC\fR\fR
2135 \fB\fBPR_PTRACE\fR\fR
2136 .ad
2137 .RS 13n
2138 (ptrace-compatibility): When set, a stop on an event of interest by the traced
2139 process is reported to the parent of the traced process by \fBwait\fR(3C),
2140 \fBSIGTRAP\fR is sent to the traced process when it executes a successful
2141 \fBexec\fR(2), setuid/setgid flags are not honored for execs performed by the
2142 traced process, any exec of an object file that the traced process cannot read
2143 fails, and the process dies when its parent dies. This mode is deprecated; it
2144 is provided only to allow \fBptrace\fR(3C) to be implemented as a library
2145 function using \fB/proc\fR.
2146 .RE
2147
2148 .sp
2149 .LP
2150 It is an error (\fBEINVAL\fR) to specify flags other than those described above
2151 or to apply these operations to a system process. The current modes are
2152 reported in the \fBpr_flags\fR field of \fB/proc/\fR\fIpid\fR\fB/status\fR and
2153 \fB/proc/\fR\fIpid\fR\fB/lwp/\fR\fIlwp\fR\fB/lwpstatus\fR.
2154 .SS "PCSREG"
2155 .LP
2156 Set the general registers for the specific or representative lwp according to
2157 the operand \fBprgregset_t\fR structure.
2158 .sp
2159 .LP
2160 On SPARC based systems, only the condition-code bits of the processor-status
2161 register (R_PSR) of SPARC V8 (32-bit) processes can be modified by
2162 \fBPCSREG\fR. Other privileged registers cannot be modified at all.
2163 .sp
2164 .LP
2165 On x86-based systems, only certain bits of the flags register (EFL) can be
2166 modified by \fBPCSREG\fR: these include the condition codes, direction-bit, and
2167 overflow-bit.
2168 .sp
2169 .LP
2170 \fBPCSREG\fR fails with \fBEBUSY\fR if the lwp is not stopped on an event of
2171 interest.
2172 .SS "PCSVADDR"
2173 .LP
2174 Set the address at which execution will resume for the specific or
2175 representative lwp from the operand \fBlong\fR. On SPARC based systems, both
2176 %pc and %npc are set, with %npc set to the instruction following the virtual
2177 address. On x86-based systems, only %eip is set. \fBPCSVADDR\fR fails with
2178 \fBEBUSY\fR if the lwp is not stopped on an event of interest.
2179 .SS "PCSFPREG"
2180 .LP
2181 Set the floating-point registers for the specific or representative lwp
2182 according to the operand \fBprfpregset_t\fR structure. An error (\fBEINVAL\fR)
2183 is returned if the system does not support floating-point operations (no
2184 floating-point hardware and the system does not emulate floating-point machine
2185 instructions). \fBPCSFPREG\fR fails with \fBEBUSY\fR if the lwp is not stopped
2186 on an event of interest.
2187 .SS "PCSXREG"
2188 .LP
2189 Set the extra state registers for the specific or representative lwp according
2190 to the architecture-dependent operand \fBprxregset_t\fR structure. An error
2191 (\fBEINVAL\fR) is returned if the system does not support extra state
2192 registers. \fBPCSXREG\fR fails with \fBEBUSY\fR if the lwp is not stopped on an
2193 event of interest.
2194 .SS "PCSASRS"
2195 .LP
2196 Set the ancillary state registers for the specific or representative lwp
2197 according to the SPARC V9 platform-dependent operand \fBasrset_t\fR structure.
2198 An error (\fBEINVAL\fR) is returned if either the target process or the
2199 controlling process is not a 64-bit SPARC V9 process. Most of the ancillary
2200 state registers are privileged registers that cannot be modified. Only those
2201 that can be modified are set; all others are silently ignored. \fBPCSASRS\fR
2202 fails with \fBEBUSY\fR if the lwp is not stopped on an event of interest.
2203 .SS "PCAGENT"
2204 .LP
2205 Create an agent lwp in the controlled process with register values from the
2206 operand \fBprgregset_t\fR structure (see \fBPCSREG\fR, above). The agent lwp is
2207 created in the stopped state showing \fBPR_REQUESTED\fR and with its held
2208 signal set (the signal mask) having all signals except \fBSIGKILL\fR and
2209 \fBSIGSTOP\fR blocked.
2210 .sp
2211 .LP
2212 The \fBPCAGENT\fR operation fails with \fBEBUSY\fR unless the process is fully
2213 stopped via \fB/proc\fR, that is, unless all of the lwps in the process are
2214 stopped either on events of interest or on \fBPR_SUSPENDED\fR, or are stopped
2215 on \fBPR_JOBCONTROL\fR and have been directed to stop via \fBPCDSTOP\fR. It
2216 fails with \fBEBUSY\fR if an agent lwp already exists. It fails with
2217 \fBENOMEM\fR if system resources for creating new lwps have been exhausted.
2218 .sp
2219 .LP
2220 Any \fBPCRUN\fR operation applied to the process control file or to the control
2221 file of an lwp other than the agent lwp fails with \fBEBUSY\fR as long as the
2222 agent lwp exists. The agent lwp must be caused to terminate by executing the
2223 \fBSYS_lwp_exit\fR system call trap before the process can be restarted.
2244 .sp
2245 .LP
2246 If the controlling process neglects to force the agent lwp to execute the
2247 \fBSYS_lwp_exit\fR system call (due to either logic error or fatal failure on
2248 the part of the controlling process), the agent lwp will remain in the target
2249 process. For purposes of being able to debug these otherwise rogue agents,
2250 information as to the creator of the agent lwp is reflected in that lwp's
2251 \fBspymaster\fR file in \fB/proc\fR. Should the target process generate a core
2252 dump with the agent lwp in place, this information will be available via the
2253 \fBNT_SPYMASTER\fR note in the core file (see \fBcore\fR(4)).
2254 .sp
2255 .LP
2256 The agent lwp is not allowed to execute any variation of the \fBSYS_fork\fR or
2257 \fBSYS_exec\fR system call traps. Attempts to do so yield \fBENOTSUP\fR to the
2258 agent lwp.
2259 .sp
2260 .LP
2261 Symbolic constants for system call trap numbers like \fBSYS_lwp_exit\fR and
2262 \fBSYS_lwp_create\fR can be found in the header file <\fBsys/syscall.h\fR>.
2263 .SS "PCREAD PCWRITE"
2264 .LP
2265 Read or write the target process's address space via a \fBpriovec\fR structure
2266 operand:
2267 .sp
2268 .in +2
2269 .nf
2270 typedef struct priovec {
2271 void *pio_base; /* buffer in controlling process */
2272 size_t pio_len; /* size of read/write request in bytes */
2273 off_t pio_offset; /* virtual address in target process */
2274 } priovec_t;
2275 .fi
2276 .in -2
2277
2278 .sp
2279 .LP
2280 These operations have the same effect as \fBpread\fR(2) and \fBpwrite\fR(2),
2281 respectively, of the target process's address space file. The difference is
2282 that more than one \fBPCREAD\fR or \fBPCWRITE\fR control operation can be
2283 written to the control file at once, and they can be interspersed with other
2284 control operations in a single write to the control file. This is useful, for
2285 example, when planting many breakpoint instructions in the process's address
2286 space, or when stepping over a breakpointed instruction. Unlike \fBpread\fR(2)
2287 and \fBpwrite\fR(2), no provision is made for partial reads or writes; if the
2288 operation cannot be performed completely, it fails with \fBEIO\fR.
2289 .SS "PCNICE"
2290 .LP
2291 The traced process's \fBnice\fR(2) value is incremented by the amount in the
2292 operand \fBlong\fR. Only a process with the {\fBPRIV_PROC_PRIOCNTL\fR}
2293 privilege asserted in its effective set can better a process's priority in this
2294 way, but any user may lower the priority. This operation is not meaningful for
2295 all scheduling classes.
2296 .SS "PCSCRED"
2297 .LP
2298 Set the target process credentials to the values contained in the
2299 \fBprcred_t\fR structure operand (see \fB/proc/\fR\fIpid\fR\fB/cred\fR). The
2300 effective, real, and saved user-IDs and group-IDs of the target process are
2301 set. The target process's supplementary groups are not changed; the
2302 \fBpr_ngroups\fR and \fBpr_groups\fR members of the structure operand are
2303 ignored. Only the privileged processes can perform this operation; for all
2304 others it fails with \fBEPERM\fR.
2305 .SS "PCSCREDX"
2306 .LP
2307 Operates like \fBPCSCRED\fR but also sets the supplementary groups; the length
2308 of the data written with this control operation should be "sizeof
2309 (\fBprcred_t\fR) + sizeof (\fBgid_t)\fR * (#groups - 1)".
2310 .SS "PCSPRIV"
2311 .LP
2312 Set the target process privilege to the values contained in the \fBprpriv_t\fR
2313 operand (see \fB/proc/pid/priv\fR). The effective, permitted, inheritable, and
2314 limit sets are all changed. Privilege flags can also be set. The process is
2315 made privilege aware unless it can relinquish privilege awareness. See
2316 \fBprivileges\fR(5).
2317 .sp
2318 .LP
2319 The limit set of the target process cannot be grown. The other privilege sets
2320 must be subsets of the intersection of the effective set of the calling process
2321 with the new limit set of the target process or subsets of the original values
2322 of the sets in the target process.
2323 .sp
2324 .LP
2325 If any of the above restrictions are not met, \fBEPERM\fR is returned. If the
2326 structure written is improperly formatted, \fBEINVAL\fR is returned.
2327 .SH PROGRAMMING NOTES
2328 .LP
2329 For security reasons, except for the \fBpsinfo\fR, \fBusage\fR, \fBlpsinfo\fR,
2330 \fBlusage\fR, \fBlwpsinfo\fR, and \fBlwpusage\fR files, which are
2331 world-readable, and except for privileged processes, an open of a \fB/proc\fR
2332 file fails unless both the user-ID and group-ID of the caller match those of
2333 the traced process and the process's object file is readable by the caller. The
2334 effective set of the caller is a superset of both the inheritable and the
2335 permitted set of the target process. The limit set of the caller is a superset
2336 of the limit set of the target process. Except for the world-readable files
2337 just mentioned, files corresponding to setuid and setgid processes can be
2338 opened only by the appropriately privileged process.
2339 .sp
2340 .LP
2341 A process that is missing the basic privilege {\fBPRIV_PROC_INFO\fR} cannot see
2342 any processes under \fB/proc\fR that it cannot send a signal to.
2343 .sp
2344 .LP
2345 A process that has {\fBPRIV_PROC_OWNER\fR} asserted in its effective set can
2346 open any file for reading. To manipulate or control a process, the controlling
2347 process must have at least as many privileges in its effective set as the
2366 flags cleared. Any process not currently open for writing via \fB/proc\fR, but
2367 that has left-over tracing flags from a previous open, and that executes a
2368 setuid/setgid or unreadable object file, will not be stopped but will have all
2369 its tracing flags cleared.
2370 .sp
2371 .LP
2372 To wait for one or more of a set of processes or lwps to stop or terminate,
2373 \fB/proc\fR file descriptors (other than those obtained by opening the
2374 \fBcwd\fR or \fBroot\fR directories or by opening files in the \fBfd\fR or
2375 \fBobject\fR directories) can be used in a \fBpoll\fR(2) system call. When
2376 requested and returned, either of the polling events \fBPOLLPRI\fR or
2377 \fBPOLLWRNORM\fR indicates that the process or lwp stopped on an event of
2378 interest. Although they cannot be requested, the polling events \fBPOLLHUP\fR,
2379 \fBPOLLERR\fR, and \fBPOLLNVAL\fR may be returned. \fBPOLLHUP\fR indicates that
2380 the process or lwp has terminated. \fBPOLLERR\fR indicates that the file
2381 descriptor has become invalid. \fBPOLLNVAL\fR is returned immediately if
2382 \fBPOLLPRI\fR or \fBPOLLWRNORM\fR is requested on a file descriptor referring
2383 to a system process (see \fBPCSTOP\fR). The requested events may be empty to
2384 wait simply for termination.
2385 .SH FILES
2386 .ne 2
2387 .na
2388 \fB\fB/proc\fR\fR
2389 .ad
2390 .sp .6
2391 .RS 4n
2392 directory (list of processes)
2393 .RE
2394
2395 .sp
2396 .ne 2
2397 .na
2398 \fB\fB/proc/\fIpid\fR\fR\fR
2399 .ad
2400 .sp .6
2401 .RS 4n
2402 specific process directory
2403 .RE
2404
2405 .sp
2528 \fB\fB/proc/\fIpid\fR/sigact\fR\fR
2529 .ad
2530 .sp .6
2531 .RS 4n
2532 process signal actions
2533 .RE
2534
2535 .sp
2536 .ne 2
2537 .na
2538 \fB\fB/proc/\fIpid\fR/auxv\fR\fR
2539 .ad
2540 .sp .6
2541 .RS 4n
2542 process aux vector
2543 .RE
2544
2545 .sp
2546 .ne 2
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
2558 \fB\fB/proc/\fIpid\fR/ldt\fR\fR
2559 .ad
2560 .sp .6
2561 .RS 4n
2562 process \fBLDT\fR (x86 only)
2563 .RE
2564
2565 .sp
2566 .ne 2
2567 .na
2568 \fB\fB/proc/\fIpid\fR/usage\fR\fR
2569 .ad
2570 .sp .6
2571 .RS 4n
2572 process usage
2573 .RE
2574
2575 .sp
2576 .ne 2
2577 .na
2776 .ne 2
2777 .na
2778 \fB\fB/proc/\fIpid\fR/lwp/\fIlwpid\fR/asrs\fR\fR
2779 .ad
2780 .sp .6
2781 .RS 4n
2782 ancillary state registers (SPARC V9 only)
2783 .RE
2784
2785 .sp
2786 .ne 2
2787 .na
2788 \fB\fB/proc/\fIpid\fR/lwp/\fIlwpid\fR/spymaster\fR\fR
2789 .ad
2790 .sp .6
2791 .RS 4n
2792 For an agent LWP, the controlling process
2793 .RE
2794
2795 .SH SEE ALSO
2796 .LP
2797 \fBls\fR(1), \fBps\fR(1), \fBchroot\fR(1M), \fBalarm\fR(2), \fBbrk\fR(2),
2798 \fBchdir\fR(2), \fBchroot\fR(2), \fBclose\fR(2), \fBcreat\fR(2), \fBdup\fR(2),
2799 \fBexec\fR(2), \fBfcntl\fR(2), \fBfork\fR(2), \fBfork1\fR(2), \fBfstat\fR(2),
2800 \fBgetdents\fR(2), \fBgetustack\fR(2), \fBkill\fR(2), \fBlseek\fR(2),
2801 \fBmmap\fR(2), \fBnice\fR(2), \fBopen\fR(2), \fBpoll\fR(2), \fBpread\fR(2),
2802 \fBptrace\fR(3C), \fBpwrite\fR(2), \fBread\fR(2), \fBreadlink\fR(2),
2803 \fBreadv\fR(2), \fBshmget\fR(2), \fBsigaction\fR(2), \fBsigaltstack\fR(2),
2804 \fBvfork\fR(2), \fBwrite\fR(2), \fBwritev\fR(2), \fB_stack_grow\fR(3C),
2805 \fBreaddir\fR(3C), \fBpthread_create\fR(3C), \fBpthread_join\fR(3C),
2806 \fBsiginfo.h\fR(3HEAD), \fBsignal.h\fR(3HEAD), \fBthr_create\fR(3C),
2807 \fBthr_join\fR(3C), \fBtypes32.h\fR(3HEAD), \fBucontext.h\fR(3HEAD),
2808 \fBwait\fR(3C), \fBcontract\fR(4), \fBcore\fR(4), \fBprocess\fR(4),
2809 \fBlfcompile\fR(5), \fBprivileges\fR(5)
2810 .SH DIAGNOSTICS
2811 .LP
2812 Errors that can occur in addition to the errors normally associated with file
2813 system access:
2814 .sp
2815 .ne 2
2816 .na
2817 \fB\fBE2BIG\fR\fR
2818 .ad
2819 .RS 13n
2820 Data to be returned in a \fBread\fR(2) of the page data file exceeds the size
2821 of the read buffer provided by the caller.
2822 .RE
2823
2824 .sp
2825 .ne 2
2826 .na
2827 \fB\fBEACCES\fR\fR
2828 .ad
2829 .RS 13n
2830 An attempt was made to examine a process that ran under a different uid than
2945 .na
2946 \fB\fBEPERM\fR\fR
2947 .ad
2948 .RS 13n
2949 The process that issued the \fBPCSCRED\fR or \fBPCSCREDX\fR operation did not
2950 have the {\fBPRIV_PROC_SETID\fR} privilege asserted in its effective set, or
2951 the process that issued the \fBPCNICE\fR operation did not have the
2952 {\fBPRIV_PROC_PRIOCNTL\fR} in its effective set.
2953 .sp
2954 An attempt was made to control a process of which the E, P, and I privilege
2955 sets were not a subset of the effective set of the controlling process or the
2956 limit set of the controlling process is not a superset of limit set of the
2957 controlled process.
2958 .sp
2959 Any of the uids of the target process are 0 or an attempt was made to change
2960 any of the uids to 0 using PCSCRED and the security policy imposed additional
2961 restrictions. See \fBprivileges\fR(5).
2962 .RE
2963
2964 .SH NOTES
2965 .LP
2966 Descriptions of structures in this document include only interesting structure
2967 elements, not filler and padding fields, and may show elements out of order for
2968 descriptive clarity. The actual structure definitions are contained in
2969 \fB<procfs.h>\fR\&.
2970 .SH BUGS
2971 .LP
2972 Because the old \fBioctl\fR(2)-based version of \fB/proc\fR is currently
2973 supported for binary compatibility with old applications, the top-level
2974 directory for a process, \fB/proc/\fR\fIpid\fR, is not world-readable, but it
2975 is world-searchable. Thus, anyone can open \fB/proc/\fR\fIpid\fR\fB/psinfo\fR
2976 even though \fBls\fR(1) applied to \fB/proc/\fR\fIpid\fR will fail for anyone
2977 but the owner or an appropriately privileged process. Support for the old
2978 \fBioctl\fR(2)-based version of \fB/proc\fR will be dropped in a future
2979 release, at which time the top-level directory for a process will be made
2980 world-readable.
2981 .sp
2982 .LP
2983 On SPARC based machines, the types \fBgregset_t\fR and \fBfpregset_t\fR defined
2984 in <\fBsys/regset.h\fR> are similar to but not the same as the types
2985 \fBprgregset_t\fR and \fBprfpregset_t\fR defined in <\fBprocfs.h\fR>.
|