xref: /illumos-gate/usr/src/uts/common/sys/prsystm.h (revision 201ceb75ab95f9bf1f42ea1dc9ab363b43ba47cf)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
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 /*
23  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
28 /*	  All Rights Reserved	*/
29 
30 /*
31  * Copyright 2019 Joyent, Inc.
32  * Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
33  */
34 
35 #ifndef _SYS_PRSYSTM_H
36 #define	_SYS_PRSYSTM_H
37 
38 #include <sys/isa_defs.h>
39 #include <sys/zone.h>
40 
41 #ifdef	__cplusplus
42 extern "C" {
43 #endif
44 
45 #if defined(_KERNEL)
46 
47 extern kmutex_t pr_pidlock;
48 extern kcondvar_t *pr_pid_cv;
49 
50 struct prfpregset;
51 struct pstatus;
52 struct lwpstatus;
53 struct psinfo;
54 struct lwpsinfo;
55 struct prcred;
56 struct prpriv;
57 struct prsecflags;
58 struct prfdinfo;
59 struct prxregset;
60 
61 struct seg;
62 struct regs;
63 struct watched_page;
64 
65 /*
66  * These are functions in the procfs module that are
67  * called from the kernel proper and from other modules.
68  */
69 extern uint_t pr_getprot(struct seg *, int, void **,
70 	caddr_t *, caddr_t *, caddr_t);
71 extern void pr_getprot_done(void **);
72 extern size_t pr_getsegsize(struct seg *, int);
73 extern int  pr_isobject(struct vnode *);
74 extern int  pr_isself(struct vnode *);
75 extern void prinvalidate(struct user *);
76 extern void prgetstatus(proc_t *, struct pstatus *, zone_t *);
77 extern void prgetlwpstatus(kthread_t *, struct lwpstatus *, zone_t *);
78 extern void prgetpsinfo(proc_t *, struct psinfo *);
79 extern void prgetlwpsinfo(kthread_t *, struct lwpsinfo *);
80 extern void prgetprfpregs(klwp_t *, struct prfpregset *);
81 extern void prgetprxregs(klwp_t *, struct prxregset *);
82 extern size_t prgetprxregsize(proc_t *);
83 extern void prgetcred(proc_t *, struct prcred *);
84 extern void prgetpriv(proc_t *, struct prpriv *);
85 extern size_t prgetprivsize(void);
86 extern void prgetsecflags(proc_t *, struct prsecflags *);
87 extern uint_t prnsegs(struct as *, int);
88 extern u_offset_t prgetfdinfosize(proc_t *, vnode_t *, cred_t *);
89 extern int prgetfdinfo(proc_t *, vnode_t *, struct prfdinfo *, cred_t *,
90     cred_t *, list_t *);
91 extern void prexit(proc_t *);
92 extern void prfree(proc_t *);
93 extern void prlwpexit(kthread_t *);
94 extern void prlwpfree(proc_t *, lwpent_t *);
95 extern void prexecstart(void);
96 extern void prexecend(void);
97 extern void prrelvm(void);
98 extern void prbarrier(proc_t *);
99 extern void prstop(int, int);
100 extern void prunstop(void);
101 extern void prnotify(struct vnode *);
102 extern void prstep(klwp_t *, int);
103 extern void prnostep(klwp_t *);
104 extern void prdostep(void);
105 extern int  prundostep(void);
106 extern int  prhasfp(void);
107 extern int  prhasx(proc_t *);
108 extern caddr_t prmapin(struct as *, caddr_t, int);
109 extern void prmapout(struct as *, caddr_t, caddr_t, int);
110 extern int  pr_watch_emul(struct regs *, caddr_t, enum seg_rw);
111 extern void pr_free_watched_pages(proc_t *);
112 extern int  pr_allstopped(proc_t *, int);
113 #if defined(__sparc)
114 struct _gwindows;
115 extern	int	prnwindows(klwp_t *);
116 extern	void	prgetwindows(klwp_t *, struct _gwindows *);
117 #if defined(__sparcv9) /* 32-bit adb macros should not see these defs */
118 extern	void	prgetasregs(klwp_t *, asrset_t);
119 extern	void	prsetasregs(klwp_t *, asrset_t);
120 #endif /* __sparcv9 */
121 #endif	/* __sparc */
122 #if defined(__x86)
123 struct	ssd;
124 extern	int	prnldt(proc_t *);
125 extern	void	prgetldt(proc_t *, struct ssd *);
126 #endif	/* __x86 */
127 
128 #ifdef _SYSCALL32_IMPL
129 struct prfpregset32;
130 struct pstatus32;
131 struct lwpstatus32;
132 struct psinfo32;
133 struct lwpsinfo32;
134 extern void prgetstatus32(proc_t *, struct pstatus32 *, zone_t *);
135 extern void prgetlwpstatus32(kthread_t *, struct lwpstatus32 *, zone_t *);
136 extern void prgetpsinfo32(proc_t *, struct psinfo32 *);
137 extern void prgetlwpsinfo32(kthread_t *, struct lwpsinfo32 *);
138 extern void lwpsinfo_kto32(const struct lwpsinfo *src, struct lwpsinfo32 *dest);
139 extern void psinfo_kto32(const struct psinfo *src, struct psinfo32 *dest);
140 extern void prgetprfpregs32(klwp_t *, struct prfpregset32 *);
141 #if defined(__sparc)
142 struct gwindows32;
143 void		prgetwindows32(klwp_t *, struct gwindows32 *);
144 #endif /* __sparc */
145 #endif	/* _SYSCALL32_IMPL */
146 
147 #endif	/* defined (_KERNEL) */
148 
149 #ifdef	__cplusplus
150 }
151 #endif
152 
153 #endif	/* _SYS_PRSYSTM_H */
154