Print this page




  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  27 /*        All Rights Reserved   */
  28 
  29 /*
  30  * Copyright 2018 Joyent, Inc.
  31  * Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
  32  * Copyright 2023 Oxide Computer Company
  33  */
  34 
  35 #ifndef _SYS_PROC_PRDATA_H
  36 #define _SYS_PROC_PRDATA_H
  37 
  38 #include <sys/isa_defs.h>
  39 #include <sys/proc.h>
  40 #include <sys/vnode.h>
  41 #include <sys/prsystm.h>
  42 #include <sys/model.h>
  43 #include <sys/poll.h>
  44 #include <sys/list.h>
  45 
  46 #ifdef  __cplusplus
  47 extern "C" {
  48 #endif
  49 
  50 /*


 108  */
 109 typedef enum prnodetype {
 110         PR_PROCDIR,             /* /proc                                */
 111         PR_SELF,                /* /proc/self                           */
 112         PR_PIDDIR,              /* /proc/<pid>                            */
 113         PR_AS,                  /* /proc/<pid>/as                 */
 114         PR_CTL,                 /* /proc/<pid>/ctl                        */
 115         PR_STATUS,              /* /proc/<pid>/status                     */
 116         PR_LSTATUS,             /* /proc/<pid>/lstatus                    */
 117         PR_PSINFO,              /* /proc/<pid>/psinfo                     */
 118         PR_LPSINFO,             /* /proc/<pid>/lpsinfo                    */
 119         PR_MAP,                 /* /proc/<pid>/map                        */
 120         PR_RMAP,                /* /proc/<pid>/rmap                       */
 121         PR_XMAP,                /* /proc/<pid>/xmap                       */
 122         PR_CRED,                /* /proc/<pid>/cred                       */
 123         PR_SIGACT,              /* /proc/<pid>/sigact                     */
 124         PR_AUXV,                /* /proc/<pid>/auxv                       */
 125 #if defined(__i386) || defined(__amd64)
 126         PR_LDT,                 /* /proc/<pid>/ldt                        */
 127 #endif


 128         PR_USAGE,               /* /proc/<pid>/usage                      */
 129         PR_LUSAGE,              /* /proc/<pid>/lusage                     */
 130         PR_PAGEDATA,            /* /proc/<pid>/pagedata                   */
 131         PR_WATCH,               /* /proc/<pid>/watch                      */
 132         PR_CURDIR,              /* /proc/<pid>/cwd                        */
 133         PR_ROOTDIR,             /* /proc/<pid>/root                       */
 134         PR_FDDIR,               /* /proc/<pid>/fd                 */
 135         PR_FD,                  /* /proc/<pid>/fd/nn                      */
 136         PR_FDINFODIR,           /* /proc/<pid>/fdinfo                     */
 137         PR_FDINFO,              /* /proc/<pid>/fdinfo/nn          */
 138         PR_OBJECTDIR,           /* /proc/<pid>/object                     */
 139         PR_OBJECT,              /* /proc/<pid>/object/xxx         */
 140         PR_LWPDIR,              /* /proc/<pid>/lwp                        */
 141         PR_LWPIDDIR,            /* /proc/<pid>/lwp/<lwpid>          */
 142         PR_LWPCTL,              /* /proc/<pid>/lwp/<lwpid>/lwpctl   */
 143         PR_LWPNAME,             /* /proc/<pid>/lwp/<lwpid>/lwpname  */
 144         PR_LWPSTATUS,           /* /proc/<pid>/lwp/<lwpid>/lwpstatus        */
 145         PR_LWPSINFO,            /* /proc/<pid>/lwp/<lwpid>/lwpsinfo */
 146         PR_LWPUSAGE,            /* /proc/<pid>/lwp/<lwpid>/lwpusage */
 147         PR_XREGS,               /* /proc/<pid>/lwp/<lwpid>/xregs    */


 339 
 340 extern  proc_t  *pr_p_lock(prnode_t *);
 341 extern  kthread_t *pr_thread(prnode_t *);
 342 extern  void    pr_stop(prnode_t *);
 343 extern  int     pr_wait_stop(prnode_t *, time_t);
 344 extern  int     pr_setrun(prnode_t *, ulong_t);
 345 extern  int     pr_wait(prcommon_t *, timestruc_t *, int);
 346 extern  void    pr_wait_die(prnode_t *);
 347 extern  int     pr_setsig(prnode_t *, siginfo_t *);
 348 extern  int     pr_kill(prnode_t *, int, cred_t *);
 349 extern  int     pr_unkill(prnode_t *, int);
 350 extern  int     pr_nice(proc_t *, int, cred_t *);
 351 extern  void    pr_setentryexit(proc_t *, sysset_t *, int);
 352 extern  int     pr_set(proc_t *, long);
 353 extern  int     pr_unset(proc_t *, long);
 354 extern  void    pr_sethold(prnode_t *, sigset_t *);
 355 extern  file_t  *pr_getf(proc_t *, uint_t, short *);
 356 extern  void    pr_releasef(file_t *);
 357 extern  void    pr_setfault(proc_t *, fltset_t *);
 358 extern  int     prusrio(proc_t *, enum uio_rw, struct uio *, int);



 359 extern  int     prwritectl(vnode_t *, struct uio *, cred_t *);
 360 extern  int     prlock(prnode_t *, int);
 361 extern  void    prunmark(proc_t *);
 362 extern  void    prunlock(prnode_t *);
 363 extern  size_t  prpdsize(struct as *);
 364 extern  int     prpdread(proc_t *, uint_t, struct uio *);
 365 extern  size_t  oprpdsize(struct as *);
 366 extern  int     oprpdread(struct as *, uint_t, struct uio *);
 367 extern  void    prgetaction(proc_t *, user_t *, uint_t, struct sigaction *);
 368 extern  void    prgetusage(kthread_t *, struct prhusage *);
 369 extern  void    praddusage(kthread_t *, struct prhusage *);
 370 extern  void    prcvtusage(struct prhusage *, prusage_t *);
 371 extern  void    prscaleusage(prhusage_t *);
 372 extern  kthread_t *prchoose(proc_t *);
 373 extern  void    allsetrun(proc_t *);
 374 extern  int     setisempty(uint32_t *, uint_t);
 375 extern  int     pr_u32tos(uint32_t, char *, int);
 376 extern  vnode_t *prlwpnode(prnode_t *, uint_t);
 377 extern  prnode_t *prgetnode(vnode_t *, prnodetype_t);
 378 extern  void    prfreenode(prnode_t *);




  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  27 /*        All Rights Reserved   */
  28 
  29 /*
  30  * Copyright 2019 Joyent, Inc.
  31  * Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
  32  * Copyright 2023 Oxide Computer Company
  33  */
  34 
  35 #ifndef _SYS_PROC_PRDATA_H
  36 #define _SYS_PROC_PRDATA_H
  37 
  38 #include <sys/isa_defs.h>
  39 #include <sys/proc.h>
  40 #include <sys/vnode.h>
  41 #include <sys/prsystm.h>
  42 #include <sys/model.h>
  43 #include <sys/poll.h>
  44 #include <sys/list.h>
  45 
  46 #ifdef  __cplusplus
  47 extern "C" {
  48 #endif
  49 
  50 /*


 108  */
 109 typedef enum prnodetype {
 110         PR_PROCDIR,             /* /proc                                */
 111         PR_SELF,                /* /proc/self                           */
 112         PR_PIDDIR,              /* /proc/<pid>                            */
 113         PR_AS,                  /* /proc/<pid>/as                 */
 114         PR_CTL,                 /* /proc/<pid>/ctl                        */
 115         PR_STATUS,              /* /proc/<pid>/status                     */
 116         PR_LSTATUS,             /* /proc/<pid>/lstatus                    */
 117         PR_PSINFO,              /* /proc/<pid>/psinfo                     */
 118         PR_LPSINFO,             /* /proc/<pid>/lpsinfo                    */
 119         PR_MAP,                 /* /proc/<pid>/map                        */
 120         PR_RMAP,                /* /proc/<pid>/rmap                       */
 121         PR_XMAP,                /* /proc/<pid>/xmap                       */
 122         PR_CRED,                /* /proc/<pid>/cred                       */
 123         PR_SIGACT,              /* /proc/<pid>/sigact                     */
 124         PR_AUXV,                /* /proc/<pid>/auxv                       */
 125 #if defined(__i386) || defined(__amd64)
 126         PR_LDT,                 /* /proc/<pid>/ldt                        */
 127 #endif
 128         PR_ARGV,                /* /proc/<pid>/argv                       */
 129         PR_CMDLINE,             /* /proc/<pid>/cmdline                    */
 130         PR_USAGE,               /* /proc/<pid>/usage                      */
 131         PR_LUSAGE,              /* /proc/<pid>/lusage                     */
 132         PR_PAGEDATA,            /* /proc/<pid>/pagedata                   */
 133         PR_WATCH,               /* /proc/<pid>/watch                      */
 134         PR_CURDIR,              /* /proc/<pid>/cwd                        */
 135         PR_ROOTDIR,             /* /proc/<pid>/root                       */
 136         PR_FDDIR,               /* /proc/<pid>/fd                 */
 137         PR_FD,                  /* /proc/<pid>/fd/nn                      */
 138         PR_FDINFODIR,           /* /proc/<pid>/fdinfo                     */
 139         PR_FDINFO,              /* /proc/<pid>/fdinfo/nn          */
 140         PR_OBJECTDIR,           /* /proc/<pid>/object                     */
 141         PR_OBJECT,              /* /proc/<pid>/object/xxx         */
 142         PR_LWPDIR,              /* /proc/<pid>/lwp                        */
 143         PR_LWPIDDIR,            /* /proc/<pid>/lwp/<lwpid>          */
 144         PR_LWPCTL,              /* /proc/<pid>/lwp/<lwpid>/lwpctl   */
 145         PR_LWPNAME,             /* /proc/<pid>/lwp/<lwpid>/lwpname  */
 146         PR_LWPSTATUS,           /* /proc/<pid>/lwp/<lwpid>/lwpstatus        */
 147         PR_LWPSINFO,            /* /proc/<pid>/lwp/<lwpid>/lwpsinfo */
 148         PR_LWPUSAGE,            /* /proc/<pid>/lwp/<lwpid>/lwpusage */
 149         PR_XREGS,               /* /proc/<pid>/lwp/<lwpid>/xregs    */


 341 
 342 extern  proc_t  *pr_p_lock(prnode_t *);
 343 extern  kthread_t *pr_thread(prnode_t *);
 344 extern  void    pr_stop(prnode_t *);
 345 extern  int     pr_wait_stop(prnode_t *, time_t);
 346 extern  int     pr_setrun(prnode_t *, ulong_t);
 347 extern  int     pr_wait(prcommon_t *, timestruc_t *, int);
 348 extern  void    pr_wait_die(prnode_t *);
 349 extern  int     pr_setsig(prnode_t *, siginfo_t *);
 350 extern  int     pr_kill(prnode_t *, int, cred_t *);
 351 extern  int     pr_unkill(prnode_t *, int);
 352 extern  int     pr_nice(proc_t *, int, cred_t *);
 353 extern  void    pr_setentryexit(proc_t *, sysset_t *, int);
 354 extern  int     pr_set(proc_t *, long);
 355 extern  int     pr_unset(proc_t *, long);
 356 extern  void    pr_sethold(prnode_t *, sigset_t *);
 357 extern  file_t  *pr_getf(proc_t *, uint_t, short *);
 358 extern  void    pr_releasef(file_t *);
 359 extern  void    pr_setfault(proc_t *, fltset_t *);
 360 extern  int     prusrio(proc_t *, enum uio_rw, struct uio *, int);
 361 extern  int     prreadargv(proc_t *, char *, size_t, size_t *);
 362 extern  int     prreadcmdline(proc_t *, char *, size_t, size_t *);
 363 extern  int     prreadenvv(proc_t *, char *, size_t, size_t *);
 364 extern  int     prwritectl(vnode_t *, struct uio *, cred_t *);
 365 extern  int     prlock(prnode_t *, int);
 366 extern  void    prunmark(proc_t *);
 367 extern  void    prunlock(prnode_t *);
 368 extern  size_t  prpdsize(struct as *);
 369 extern  int     prpdread(proc_t *, uint_t, struct uio *);
 370 extern  size_t  oprpdsize(struct as *);
 371 extern  int     oprpdread(struct as *, uint_t, struct uio *);
 372 extern  void    prgetaction(proc_t *, user_t *, uint_t, struct sigaction *);
 373 extern  void    prgetusage(kthread_t *, struct prhusage *);
 374 extern  void    praddusage(kthread_t *, struct prhusage *);
 375 extern  void    prcvtusage(struct prhusage *, prusage_t *);
 376 extern  void    prscaleusage(prhusage_t *);
 377 extern  kthread_t *prchoose(proc_t *);
 378 extern  void    allsetrun(proc_t *);
 379 extern  int     setisempty(uint32_t *, uint_t);
 380 extern  int     pr_u32tos(uint32_t, char *, int);
 381 extern  vnode_t *prlwpnode(prnode_t *, uint_t);
 382 extern  prnode_t *prgetnode(vnode_t *, prnodetype_t);
 383 extern  void    prfreenode(prnode_t *);