17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 507a48826SRoger A. Faulkner * Common Development and Distribution License (the "License"). 607a48826SRoger A. Faulkner * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 2107a48826SRoger A. Faulkner 227c478bd9Sstevel@tonic-gate /* 2307a48826SRoger A. Faulkner * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 287c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 297c478bd9Sstevel@tonic-gate 30f971a346SBryan Cantrill /* 314e18e297SPatrick Mooney * Copyright 2019 Joyent, Inc. 32a02120c4SAndy Fiddaman * Copyright 2020 OmniOS Community Edition (OmniOSce) Association. 33f971a346SBryan Cantrill */ 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate #ifndef _SYS_PRSYSTM_H 367c478bd9Sstevel@tonic-gate #define _SYS_PRSYSTM_H 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gate #include <sys/isa_defs.h> 397c478bd9Sstevel@tonic-gate #include <sys/zone.h> 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate #ifdef __cplusplus 427c478bd9Sstevel@tonic-gate extern "C" { 437c478bd9Sstevel@tonic-gate #endif 447c478bd9Sstevel@tonic-gate 457c478bd9Sstevel@tonic-gate #if defined(_KERNEL) 467c478bd9Sstevel@tonic-gate 477c478bd9Sstevel@tonic-gate extern kmutex_t pr_pidlock; 487c478bd9Sstevel@tonic-gate extern kcondvar_t *pr_pid_cv; 497c478bd9Sstevel@tonic-gate 507c478bd9Sstevel@tonic-gate struct prfpregset; 517c478bd9Sstevel@tonic-gate struct pstatus; 527c478bd9Sstevel@tonic-gate struct lwpstatus; 537c478bd9Sstevel@tonic-gate struct psinfo; 547c478bd9Sstevel@tonic-gate struct lwpsinfo; 557c478bd9Sstevel@tonic-gate struct prcred; 567c478bd9Sstevel@tonic-gate struct prpriv; 57d2a70789SRichard Lowe struct prsecflags; 58a02120c4SAndy Fiddaman struct prfdinfo; 59*ed093b41SRobert Mustacchi struct prxregset; 607c478bd9Sstevel@tonic-gate 617c478bd9Sstevel@tonic-gate struct seg; 627c478bd9Sstevel@tonic-gate struct regs; 637c478bd9Sstevel@tonic-gate struct watched_page; 647c478bd9Sstevel@tonic-gate 657c478bd9Sstevel@tonic-gate /* 667c478bd9Sstevel@tonic-gate * These are functions in the procfs module that are 677c478bd9Sstevel@tonic-gate * called from the kernel proper and from other modules. 687c478bd9Sstevel@tonic-gate */ 697c478bd9Sstevel@tonic-gate extern uint_t pr_getprot(struct seg *, int, void **, 707c478bd9Sstevel@tonic-gate caddr_t *, caddr_t *, caddr_t); 717c478bd9Sstevel@tonic-gate extern void pr_getprot_done(void **); 727c478bd9Sstevel@tonic-gate extern size_t pr_getsegsize(struct seg *, int); 737c478bd9Sstevel@tonic-gate extern int pr_isobject(struct vnode *); 747c478bd9Sstevel@tonic-gate extern int pr_isself(struct vnode *); 757c478bd9Sstevel@tonic-gate extern void prinvalidate(struct user *); 767c478bd9Sstevel@tonic-gate extern void prgetstatus(proc_t *, struct pstatus *, zone_t *); 777c478bd9Sstevel@tonic-gate extern void prgetlwpstatus(kthread_t *, struct lwpstatus *, zone_t *); 787c478bd9Sstevel@tonic-gate extern void prgetpsinfo(proc_t *, struct psinfo *); 797c478bd9Sstevel@tonic-gate extern void prgetlwpsinfo(kthread_t *, struct lwpsinfo *); 807c478bd9Sstevel@tonic-gate extern void prgetprfpregs(klwp_t *, struct prfpregset *); 81*ed093b41SRobert Mustacchi extern void prgetprxregs(klwp_t *, struct prxregset *); 82*ed093b41SRobert Mustacchi extern size_t prgetprxregsize(proc_t *); 837c478bd9Sstevel@tonic-gate extern void prgetcred(proc_t *, struct prcred *); 847c478bd9Sstevel@tonic-gate extern void prgetpriv(proc_t *, struct prpriv *); 857c478bd9Sstevel@tonic-gate extern size_t prgetprivsize(void); 86d2a70789SRichard Lowe extern void prgetsecflags(proc_t *, struct prsecflags *); 874e18e297SPatrick Mooney extern uint_t prnsegs(struct as *, int); 88a02120c4SAndy Fiddaman extern u_offset_t prgetfdinfosize(proc_t *, vnode_t *, cred_t *); 89a02120c4SAndy Fiddaman extern int prgetfdinfo(proc_t *, vnode_t *, struct prfdinfo *, cred_t *, 9019ee9cd1SAndy Fiddaman cred_t *, list_t *); 917c478bd9Sstevel@tonic-gate extern void prexit(proc_t *); 927c478bd9Sstevel@tonic-gate extern void prfree(proc_t *); 937c478bd9Sstevel@tonic-gate extern void prlwpexit(kthread_t *); 947c478bd9Sstevel@tonic-gate extern void prlwpfree(proc_t *, lwpent_t *); 957c478bd9Sstevel@tonic-gate extern void prexecstart(void); 967c478bd9Sstevel@tonic-gate extern void prexecend(void); 977c478bd9Sstevel@tonic-gate extern void prrelvm(void); 987c478bd9Sstevel@tonic-gate extern void prbarrier(proc_t *); 997c478bd9Sstevel@tonic-gate extern void prstop(int, int); 10007a48826SRoger A. Faulkner extern void prunstop(void); 1017c478bd9Sstevel@tonic-gate extern void prnotify(struct vnode *); 1027c478bd9Sstevel@tonic-gate extern void prstep(klwp_t *, int); 1037c478bd9Sstevel@tonic-gate extern void prnostep(klwp_t *); 1047c478bd9Sstevel@tonic-gate extern void prdostep(void); 1057c478bd9Sstevel@tonic-gate extern int prundostep(void); 1067c478bd9Sstevel@tonic-gate extern int prhasfp(void); 1077c478bd9Sstevel@tonic-gate extern int prhasx(proc_t *); 1087c478bd9Sstevel@tonic-gate extern caddr_t prmapin(struct as *, caddr_t, int); 1097c478bd9Sstevel@tonic-gate extern void prmapout(struct as *, caddr_t, caddr_t, int); 1107c478bd9Sstevel@tonic-gate extern int pr_watch_emul(struct regs *, caddr_t, enum seg_rw); 1117c478bd9Sstevel@tonic-gate extern void pr_free_watched_pages(proc_t *); 1127c478bd9Sstevel@tonic-gate extern int pr_allstopped(proc_t *, int); 1137c478bd9Sstevel@tonic-gate #if defined(__sparc) 114bc0e9132SGordon Ross struct _gwindows; 1157c478bd9Sstevel@tonic-gate extern int prnwindows(klwp_t *); 116bc0e9132SGordon Ross extern void prgetwindows(klwp_t *, struct _gwindows *); 1177c478bd9Sstevel@tonic-gate #if defined(__sparcv9) /* 32-bit adb macros should not see these defs */ 1187c478bd9Sstevel@tonic-gate extern void prgetasregs(klwp_t *, asrset_t); 1197c478bd9Sstevel@tonic-gate extern void prsetasregs(klwp_t *, asrset_t); 1207c478bd9Sstevel@tonic-gate #endif /* __sparcv9 */ 1217c478bd9Sstevel@tonic-gate #endif /* __sparc */ 1227c478bd9Sstevel@tonic-gate #if defined(__x86) 1237c478bd9Sstevel@tonic-gate struct ssd; 1247c478bd9Sstevel@tonic-gate extern int prnldt(proc_t *); 1257c478bd9Sstevel@tonic-gate extern void prgetldt(proc_t *, struct ssd *); 1267c478bd9Sstevel@tonic-gate #endif /* __x86 */ 1277c478bd9Sstevel@tonic-gate 1287c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32_IMPL 1297c478bd9Sstevel@tonic-gate struct prfpregset32; 1307c478bd9Sstevel@tonic-gate struct pstatus32; 1317c478bd9Sstevel@tonic-gate struct lwpstatus32; 1327c478bd9Sstevel@tonic-gate struct psinfo32; 1337c478bd9Sstevel@tonic-gate struct lwpsinfo32; 1347c478bd9Sstevel@tonic-gate extern void prgetstatus32(proc_t *, struct pstatus32 *, zone_t *); 1357c478bd9Sstevel@tonic-gate extern void prgetlwpstatus32(kthread_t *, struct lwpstatus32 *, zone_t *); 1367c478bd9Sstevel@tonic-gate extern void prgetpsinfo32(proc_t *, struct psinfo32 *); 1377c478bd9Sstevel@tonic-gate extern void prgetlwpsinfo32(kthread_t *, struct lwpsinfo32 *); 138f971a346SBryan Cantrill extern void lwpsinfo_kto32(const struct lwpsinfo *src, struct lwpsinfo32 *dest); 139f971a346SBryan Cantrill extern void psinfo_kto32(const struct psinfo *src, struct psinfo32 *dest); 1407c478bd9Sstevel@tonic-gate extern void prgetprfpregs32(klwp_t *, struct prfpregset32 *); 1417c478bd9Sstevel@tonic-gate #if defined(__sparc) 1427c478bd9Sstevel@tonic-gate struct gwindows32; 1437c478bd9Sstevel@tonic-gate void prgetwindows32(klwp_t *, struct gwindows32 *); 1447c478bd9Sstevel@tonic-gate #endif /* __sparc */ 1457c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32_IMPL */ 1467c478bd9Sstevel@tonic-gate 1477c478bd9Sstevel@tonic-gate #endif /* defined (_KERNEL) */ 1487c478bd9Sstevel@tonic-gate 1497c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1507c478bd9Sstevel@tonic-gate } 1517c478bd9Sstevel@tonic-gate #endif 1527c478bd9Sstevel@tonic-gate 1537c478bd9Sstevel@tonic-gate #endif /* _SYS_PRSYSTM_H */ 154