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


 496        PR_SYSENTRY
 497        PR_SYSEXIT
 498                         indicate a stop on entry to or exit from a system call
 499                         (see PCSENTRY and PCSEXIT); pr_what holds the system
 500                         call number.
 501 
 502 
 503        PR_JOBCONTROL
 504                         indicates that the lwp stopped due to the default
 505                         action of a job control stop signal (see
 506                         sigaction(2)); pr_what holds the stopping signal
 507                         number.
 508 
 509 
 510        PR_SUSPENDED
 511                         indicates that the lwp stopped due to internal
 512                         synchronization of lwps within the process. pr_what is
 513                         unused in this case.
 514 
 515 






 516 


 517        pr_cursig names the current signal, that is, the next signal to be
 518        delivered to the lwp, if any. pr_info, when the lwp is in a
 519        PR_SIGNALLED or PR_FAULTED stop, contains additional information
 520        pertinent to the particular signal or fault (see <sys/siginfo.h>).
 521 
 522 
 523        pr_lwppend identifies any synchronous or directed signals pending for
 524        the lwp. pr_lwphold identifies those signals whose delivery is being
 525        blocked by the lwp (the signal mask).
 526 
 527 
 528        pr_action contains the signal action information pertaining to the
 529        current signal (see sigaction(2)); it is undefined if pr_cursig is
 530        zero. pr_altstack contains the alternate signal stack information for
 531        the lwp (see sigaltstack(2)).
 532 
 533 
 534        pr_oldcontext, if not zero, contains the address on the lwp stack of a
 535        ucontext structure describing the previous user-level context (see
 536        ucontext.h(3HEAD)). It is non-zero only if the lwp is executing in the


 728              ctid_t pr_contract;      /* process contract id */
 729          } psinfo_t;
 730 
 731 
 732 
 733        Some of the entries in psinfo, such as pr_addr, refer to internal
 734        kernel data structures and should not be expected to retain their
 735        meanings across different versions of the operating system.
 736 
 737 
 738        psinfo_t.pr_flag is a deprecated interface that should no longer be
 739        used.  Applications currently relying on the SSYS bit in pr_flag should
 740        migrate to checking PR_ISSYS in the pstatus structure's pr_flags field.
 741 
 742 
 743        pr_pctcpu and pr_pctmem are 16-bit binary fractions in the range 0.0 to
 744        1.0 with the binary point to the right of the high-order bit (1.0 ==
 745        0x8000). pr_pctcpu is the summation over all lwps in the process.
 746 
 747 










 748        pr_lwp contains the ps(1) information for the representative lwp.  If
 749        the process is a zombie, pr_nlwp, pr_nzomb, and pr_lwp.pr_lwpid are
 750        zero and the other fields of pr_lwp are undefined:
 751 
 752          typedef struct lwpsinfo {
 753              int pr_flag;             /* lwp flags (DEPRECATED: see below) */
 754              id_t pr_lwpid;           /* lwp id */
 755              uintptr_t pr_addr;       /* internal address of lwp */
 756              uintptr_t pr_wchan;      /* wait addr for sleeping lwp */
 757              char pr_stype;           /* synchronization event type */
 758              char pr_state;           /* numeric lwp state */
 759              char pr_sname;           /* printable character for pr_state */
 760              char pr_nice;            /* nice for cpu usage */
 761              short pr_syscall;        /* system call number (if in syscall) */
 762              char pr_oldpri;          /* pre-SVR4, low value is high priority */
 763              char pr_cpu;             /* pre-SVR4, cpu usage for scheduling */
 764              int pr_pri;              /* priority, high value = high priority */
 765              ushort_t pr_pctcpu;      /* % of recent cpu time used by this lwp */
 766              timestruc_t pr_start;    /* lwp start time, from the epoch */
 767              timestruc_t pr_time;     /* cpu time for this lwp */


 836        which is followed by additional information about the process state
 837        pr_infosize bytes in size.
 838 
 839 
 840        The full size of the structure can be computed using
 841        PRIV_PRPRIV_SIZE(prpriv_t *).
 842 
 843    sigact
 844        Contains an array of sigaction structures describing the current
 845        dispositions of all signals associated with the traced process (see
 846        sigaction(2)). Signal numbers are displaced by 1 from array indices, so
 847        that the action for signal number n appears in position n-1 of the
 848        array.
 849 
 850    auxv
 851        Contains the initial values of the process's aux vector in an array of
 852        auxv_t structures (see <sys/auxv.h>). The values   are those that were
 853        passed by the operating system as startup information to the dynamic
 854        linker.
 855 







 856    ldt
 857        This file exists only on x86-based machines. It is non-empty only if
 858        the process has established a local descriptor table (LDT). If non-
 859        empty, the file contains the array of currently active LDT entries in
 860        an array of elements of type struct ssd, defined in <sys/sysi86.h>, one
 861        element for each active LDT entry.
 862 
 863    map, xmap
 864        Contain information about the virtual address map of the process. The
 865        map file contains an array of prmap structures while the xmap file
 866        contains an array of prxmap structures. Each structure describes a
 867        contiguous virtual address region in the address space of the traced
 868        process:
 869 
 870          typedef struct prmap {
 871               uintptr_tpr_vaddr;         /* virtual address of mapping */
 872               size_t pr_size;            /* size of mapping in bytes */
 873               char pr_mapname[PRMAPSZ];  /* name in /proc/pid/object */
 874               offset_t pr_offset;        /* offset into mapped object, if any */
 875               int pr_mflags;             /* protection and attribute flags */


2040        /proc/pid/cred
2041 
2042            process credentials
2043 
2044 
2045        /proc/pid/priv
2046 
2047            process privileges
2048 
2049 
2050        /proc/pid/sigact
2051 
2052            process signal actions
2053 
2054 
2055        /proc/pid/auxv
2056 
2057            process aux vector
2058 
2059 





2060        /proc/pid/ldt
2061 
2062            process LDT (x86 only)
2063 
2064 
2065        /proc/pid/usage
2066 
2067            process usage
2068 
2069 
2070        /proc/pid/lusage
2071 
2072            array of lwp usage structs
2073 
2074 
2075        /proc/pid/path
2076 
2077            symbolic links to process open files
2078 
2079 


2303        elements out of order for descriptive clarity. The actual structure
2304        definitions are contained in <procfs.h>.
2305 
2306 BUGS
2307        Because the old ioctl(2)-based version of /proc is currently supported
2308        for binary compatibility with old applications, the top-level directory
2309        for a process, /proc/pid, is not world-readable, but it is world-
2310        searchable. Thus, anyone can open /proc/pid/psinfo even though ls(1)
2311        applied to /proc/pid will fail for anyone but the owner or an
2312        appropriately privileged process. Support for the old ioctl(2)-based
2313        version of /proc will be dropped in a future release, at which time the
2314        top-level directory for a process will be made world-readable.
2315 
2316 
2317        On SPARC based machines, the types gregset_t and fpregset_t defined in
2318        <sys/regset.h> are similar to but not the same as the types prgregset_t
2319        and prfpregset_t defined in <procfs.h>.
2320 
2321 
2322 
2323                                 March 31, 2013                         PROC(4)


 496        PR_SYSENTRY
 497        PR_SYSEXIT
 498                         indicate a stop on entry to or exit from a system call
 499                         (see PCSENTRY and PCSEXIT); pr_what holds the system
 500                         call number.
 501 
 502 
 503        PR_JOBCONTROL
 504                         indicates that the lwp stopped due to the default
 505                         action of a job control stop signal (see
 506                         sigaction(2)); pr_what holds the stopping signal
 507                         number.
 508 
 509 
 510        PR_SUSPENDED
 511                         indicates that the lwp stopped due to internal
 512                         synchronization of lwps within the process. pr_what is
 513                         unused in this case.
 514 
 515 
 516        PR_BRAND
 517                         indicates that the lwp stopped for a brand-specific
 518                         reason.  Interpretation of the value of pr_what
 519                         depends on which zone brand is in use.  It is not
 520                         generally expected that an lwp stopped in this state
 521                         will be restarted by native proc(4) consumers.
 522 
 523 
 524 
 525        pr_cursig names the current signal, that is, the next signal to be
 526        delivered to the lwp, if any. pr_info, when the lwp is in a
 527        PR_SIGNALLED or PR_FAULTED stop, contains additional information
 528        pertinent to the particular signal or fault (see <sys/siginfo.h>).
 529 
 530 
 531        pr_lwppend identifies any synchronous or directed signals pending for
 532        the lwp. pr_lwphold identifies those signals whose delivery is being
 533        blocked by the lwp (the signal mask).
 534 
 535 
 536        pr_action contains the signal action information pertaining to the
 537        current signal (see sigaction(2)); it is undefined if pr_cursig is
 538        zero. pr_altstack contains the alternate signal stack information for
 539        the lwp (see sigaltstack(2)).
 540 
 541 
 542        pr_oldcontext, if not zero, contains the address on the lwp stack of a
 543        ucontext structure describing the previous user-level context (see
 544        ucontext.h(3HEAD)). It is non-zero only if the lwp is executing in the


 736              ctid_t pr_contract;      /* process contract id */
 737          } psinfo_t;
 738 
 739 
 740 
 741        Some of the entries in psinfo, such as pr_addr, refer to internal
 742        kernel data structures and should not be expected to retain their
 743        meanings across different versions of the operating system.
 744 
 745 
 746        psinfo_t.pr_flag is a deprecated interface that should no longer be
 747        used.  Applications currently relying on the SSYS bit in pr_flag should
 748        migrate to checking PR_ISSYS in the pstatus structure's pr_flags field.
 749 
 750 
 751        pr_pctcpu and pr_pctmem are 16-bit binary fractions in the range 0.0 to
 752        1.0 with the binary point to the right of the high-order bit (1.0 ==
 753        0x8000). pr_pctcpu is the summation over all lwps in the process.
 754 
 755 
 756        The pr_fname and pr_psargs are writable by the owner of the process. To
 757        write to them, the psinfo file should be open for writing and the
 758        desired value for the field should be written at the file offset that
 759        corresponds to the member of structure.  No other entry may be written
 760        to; if a write is attempted to an offset that does not represent one of
 761        these two memers, or if the size of the write is not exactly the size
 762        of the member being written, no bytes will be written and zero will be
 763        returned.
 764 
 765 
 766        pr_lwp contains the ps(1) information for the representative lwp.  If
 767        the process is a zombie, pr_nlwp, pr_nzomb, and pr_lwp.pr_lwpid are
 768        zero and the other fields of pr_lwp are undefined:
 769 
 770          typedef struct lwpsinfo {
 771              int pr_flag;             /* lwp flags (DEPRECATED: see below) */
 772              id_t pr_lwpid;           /* lwp id */
 773              uintptr_t pr_addr;       /* internal address of lwp */
 774              uintptr_t pr_wchan;      /* wait addr for sleeping lwp */
 775              char pr_stype;           /* synchronization event type */
 776              char pr_state;           /* numeric lwp state */
 777              char pr_sname;           /* printable character for pr_state */
 778              char pr_nice;            /* nice for cpu usage */
 779              short pr_syscall;        /* system call number (if in syscall) */
 780              char pr_oldpri;          /* pre-SVR4, low value is high priority */
 781              char pr_cpu;             /* pre-SVR4, cpu usage for scheduling */
 782              int pr_pri;              /* priority, high value = high priority */
 783              ushort_t pr_pctcpu;      /* % of recent cpu time used by this lwp */
 784              timestruc_t pr_start;    /* lwp start time, from the epoch */
 785              timestruc_t pr_time;     /* cpu time for this lwp */


 854        which is followed by additional information about the process state
 855        pr_infosize bytes in size.
 856 
 857 
 858        The full size of the structure can be computed using
 859        PRIV_PRPRIV_SIZE(prpriv_t *).
 860 
 861    sigact
 862        Contains an array of sigaction structures describing the current
 863        dispositions of all signals associated with the traced process (see
 864        sigaction(2)). Signal numbers are displaced by 1 from array indices, so
 865        that the action for signal number n appears in position n-1 of the
 866        array.
 867 
 868    auxv
 869        Contains the initial values of the process's aux vector in an array of
 870        auxv_t structures (see <sys/auxv.h>). The values   are those that were
 871        passed by the operating system as startup information to the dynamic
 872        linker.
 873 
 874    argv
 875        Contains the concatenation of each of the argument strings, including
 876        their NUL terminators, in the argument vector (argv) for the process.
 877        If the process has modified either its argument vector, or the contents
 878        of any of the strings referenced by that vector, those changes will be
 879        visible here.
 880 
 881    ldt
 882        This file exists only on x86-based machines. It is non-empty only if
 883        the process has established a local descriptor table (LDT). If non-
 884        empty, the file contains the array of currently active LDT entries in
 885        an array of elements of type struct ssd, defined in <sys/sysi86.h>, one
 886        element for each active LDT entry.
 887 
 888    map, xmap
 889        Contain information about the virtual address map of the process. The
 890        map file contains an array of prmap structures while the xmap file
 891        contains an array of prxmap structures. Each structure describes a
 892        contiguous virtual address region in the address space of the traced
 893        process:
 894 
 895          typedef struct prmap {
 896               uintptr_tpr_vaddr;         /* virtual address of mapping */
 897               size_t pr_size;            /* size of mapping in bytes */
 898               char pr_mapname[PRMAPSZ];  /* name in /proc/pid/object */
 899               offset_t pr_offset;        /* offset into mapped object, if any */
 900               int pr_mflags;             /* protection and attribute flags */


2065        /proc/pid/cred
2066 
2067            process credentials
2068 
2069 
2070        /proc/pid/priv
2071 
2072            process privileges
2073 
2074 
2075        /proc/pid/sigact
2076 
2077            process signal actions
2078 
2079 
2080        /proc/pid/auxv
2081 
2082            process aux vector
2083 
2084 
2085        /proc/pid/argv
2086 
2087            process argument vector
2088 
2089 
2090        /proc/pid/ldt
2091 
2092            process LDT (x86 only)
2093 
2094 
2095        /proc/pid/usage
2096 
2097            process usage
2098 
2099 
2100        /proc/pid/lusage
2101 
2102            array of lwp usage structs
2103 
2104 
2105        /proc/pid/path
2106 
2107            symbolic links to process open files
2108 
2109 


2333        elements out of order for descriptive clarity. The actual structure
2334        definitions are contained in <procfs.h>.
2335 
2336 BUGS
2337        Because the old ioctl(2)-based version of /proc is currently supported
2338        for binary compatibility with old applications, the top-level directory
2339        for a process, /proc/pid, is not world-readable, but it is world-
2340        searchable. Thus, anyone can open /proc/pid/psinfo even though ls(1)
2341        applied to /proc/pid will fail for anyone but the owner or an
2342        appropriately privileged process. Support for the old ioctl(2)-based
2343        version of /proc will be dropped in a future release, at which time the
2344        top-level directory for a process will be made world-readable.
2345 
2346 
2347        On SPARC based machines, the types gregset_t and fpregset_t defined in
2348        <sys/regset.h> are similar to but not the same as the types prgregset_t
2349        and prfpregset_t defined in <procfs.h>.
2350 
2351 
2352 
2353                                  May 19, 2014                          PROC(4)