1*27b03b36SApple OSS Distributions /* 2*27b03b36SApple OSS Distributions * Copyright (c) 2000-2018 Apple Inc. All rights reserved. 3*27b03b36SApple OSS Distributions * 4*27b03b36SApple OSS Distributions * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5*27b03b36SApple OSS Distributions * 6*27b03b36SApple OSS Distributions * This file contains Original Code and/or Modifications of Original Code 7*27b03b36SApple OSS Distributions * as defined in and that are subject to the Apple Public Source License 8*27b03b36SApple OSS Distributions * Version 2.0 (the 'License'). You may not use this file except in 9*27b03b36SApple OSS Distributions * compliance with the License. The rights granted to you under the License 10*27b03b36SApple OSS Distributions * may not be used to create, or enable the creation or redistribution of, 11*27b03b36SApple OSS Distributions * unlawful or unlicensed copies of an Apple operating system, or to 12*27b03b36SApple OSS Distributions * circumvent, violate, or enable the circumvention or violation of, any 13*27b03b36SApple OSS Distributions * terms of an Apple operating system software license agreement. 14*27b03b36SApple OSS Distributions * 15*27b03b36SApple OSS Distributions * Please obtain a copy of the License at 16*27b03b36SApple OSS Distributions * http://www.opensource.apple.com/apsl/ and read it before using this file. 17*27b03b36SApple OSS Distributions * 18*27b03b36SApple OSS Distributions * The Original Code and all software distributed under the License are 19*27b03b36SApple OSS Distributions * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20*27b03b36SApple OSS Distributions * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21*27b03b36SApple OSS Distributions * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22*27b03b36SApple OSS Distributions * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23*27b03b36SApple OSS Distributions * Please see the License for the specific language governing rights and 24*27b03b36SApple OSS Distributions * limitations under the License. 25*27b03b36SApple OSS Distributions * 26*27b03b36SApple OSS Distributions * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27*27b03b36SApple OSS Distributions */ 28*27b03b36SApple OSS Distributions /* Copyright (c) 1995, 1997 Apple Computer, Inc. All Rights Reserved */ 29*27b03b36SApple OSS Distributions /* 30*27b03b36SApple OSS Distributions * Copyright (c) 1982, 1986, 1989, 1991, 1993 31*27b03b36SApple OSS Distributions * The Regents of the University of California. All rights reserved. 32*27b03b36SApple OSS Distributions * 33*27b03b36SApple OSS Distributions * Redistribution and use in source and binary forms, with or without 34*27b03b36SApple OSS Distributions * modification, are permitted provided that the following conditions 35*27b03b36SApple OSS Distributions * are met: 36*27b03b36SApple OSS Distributions * 1. Redistributions of source code must retain the above copyright 37*27b03b36SApple OSS Distributions * notice, this list of conditions and the following disclaimer. 38*27b03b36SApple OSS Distributions * 2. Redistributions in binary form must reproduce the above copyright 39*27b03b36SApple OSS Distributions * notice, this list of conditions and the following disclaimer in the 40*27b03b36SApple OSS Distributions * documentation and/or other materials provided with the distribution. 41*27b03b36SApple OSS Distributions * 3. All advertising materials mentioning features or use of this software 42*27b03b36SApple OSS Distributions * must display the following acknowledgement: 43*27b03b36SApple OSS Distributions * This product includes software developed by the University of 44*27b03b36SApple OSS Distributions * California, Berkeley and its contributors. 45*27b03b36SApple OSS Distributions * 4. Neither the name of the University nor the names of its contributors 46*27b03b36SApple OSS Distributions * may be used to endorse or promote products derived from this software 47*27b03b36SApple OSS Distributions * without specific prior written permission. 48*27b03b36SApple OSS Distributions * 49*27b03b36SApple OSS Distributions * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 50*27b03b36SApple OSS Distributions * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 51*27b03b36SApple OSS Distributions * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 52*27b03b36SApple OSS Distributions * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 53*27b03b36SApple OSS Distributions * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 54*27b03b36SApple OSS Distributions * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 55*27b03b36SApple OSS Distributions * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 56*27b03b36SApple OSS Distributions * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 57*27b03b36SApple OSS Distributions * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 58*27b03b36SApple OSS Distributions * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 59*27b03b36SApple OSS Distributions * SUCH DAMAGE. 60*27b03b36SApple OSS Distributions * 61*27b03b36SApple OSS Distributions * @(#)user.h 8.2 (Berkeley) 9/23/93 62*27b03b36SApple OSS Distributions */ 63*27b03b36SApple OSS Distributions 64*27b03b36SApple OSS Distributions #ifndef _SYS_USER_H_ 65*27b03b36SApple OSS Distributions #define _SYS_USER_H_ 66*27b03b36SApple OSS Distributions 67*27b03b36SApple OSS Distributions #include <sys/appleapiopts.h> 68*27b03b36SApple OSS Distributions struct waitq_set; 69*27b03b36SApple OSS Distributions #ifndef KERNEL 70*27b03b36SApple OSS Distributions /* stuff that *used* to be included by user.h, or is now needed */ 71*27b03b36SApple OSS Distributions #include <errno.h> 72*27b03b36SApple OSS Distributions #include <sys/time.h> 73*27b03b36SApple OSS Distributions #include <sys/resource.h> 74*27b03b36SApple OSS Distributions #include <sys/ucred.h> 75*27b03b36SApple OSS Distributions #include <sys/uio.h> 76*27b03b36SApple OSS Distributions #endif 77*27b03b36SApple OSS Distributions #ifdef XNU_KERNEL_PRIVATE 78*27b03b36SApple OSS Distributions #include <sys/resource.h> 79*27b03b36SApple OSS Distributions #include <sys/resourcevar.h> 80*27b03b36SApple OSS Distributions #include <sys/signal.h> 81*27b03b36SApple OSS Distributions #include <sys/signalvar.h> 82*27b03b36SApple OSS Distributions #endif 83*27b03b36SApple OSS Distributions #include <sys/vm.h> /* XXX */ 84*27b03b36SApple OSS Distributions #include <sys/sysctl.h> 85*27b03b36SApple OSS Distributions 86*27b03b36SApple OSS Distributions #ifdef KERNEL 87*27b03b36SApple OSS Distributions #ifdef BSD_KERNEL_PRIVATE 88*27b03b36SApple OSS Distributions #include <sys/pthread_internal.h> /* for uu_kwe entry */ 89*27b03b36SApple OSS Distributions #include <sys/eventvar.h> 90*27b03b36SApple OSS Distributions #include <kern/btlog.h> 91*27b03b36SApple OSS Distributions #endif /* BSD_KERNEL_PRIVATE */ 92*27b03b36SApple OSS Distributions #ifdef __APPLE_API_PRIVATE 93*27b03b36SApple OSS Distributions #include <sys/eventvar.h> 94*27b03b36SApple OSS Distributions 95*27b03b36SApple OSS Distributions #if !defined(__LP64__) || defined(XNU_KERNEL_PRIVATE) 96*27b03b36SApple OSS Distributions /* 97*27b03b36SApple OSS Distributions * VFS context structure (part of uthread) 98*27b03b36SApple OSS Distributions */ 99*27b03b36SApple OSS Distributions struct vfs_context { 100*27b03b36SApple OSS Distributions thread_t vc_thread; /* pointer to Mach thread */ 101*27b03b36SApple OSS Distributions kauth_cred_t vc_ucred; /* per thread credential */ 102*27b03b36SApple OSS Distributions }; 103*27b03b36SApple OSS Distributions 104*27b03b36SApple OSS Distributions #endif /* !__LP64 || XNU_KERNEL_PRIVATE */ 105*27b03b36SApple OSS Distributions 106*27b03b36SApple OSS Distributions #ifdef BSD_KERNEL_PRIVATE 107*27b03b36SApple OSS Distributions struct label; /* MAC label dummy struct */ 108*27b03b36SApple OSS Distributions 109*27b03b36SApple OSS Distributions #define MAXTHREADNAMESIZE 64 110*27b03b36SApple OSS Distributions /* 111*27b03b36SApple OSS Distributions * Per-thread U area. 112*27b03b36SApple OSS Distributions */ 113*27b03b36SApple OSS Distributions 114*27b03b36SApple OSS Distributions #if PROC_REF_DEBUG 115*27b03b36SApple OSS Distributions struct uthread_proc_ref_info { 116*27b03b36SApple OSS Distributions #define NUM_PROC_REFS_TO_TRACK 31 117*27b03b36SApple OSS Distributions uint32_t upri_pindex; 118*27b03b36SApple OSS Distributions btref_t upri_proc_stacks[NUM_PROC_REFS_TO_TRACK]; 119*27b03b36SApple OSS Distributions void * upri_proc_ps[NUM_PROC_REFS_TO_TRACK]; 120*27b03b36SApple OSS Distributions }; 121*27b03b36SApple OSS Distributions #endif /* PROC_REF_DEBUG */ 122*27b03b36SApple OSS Distributions 123*27b03b36SApple OSS Distributions struct uthread { 124*27b03b36SApple OSS Distributions /* syscall parameters, results and catches */ 125*27b03b36SApple OSS Distributions u_int64_t uu_arg[8]; /* arguments to current system call */ 126*27b03b36SApple OSS Distributions int uu_rval[2]; 127*27b03b36SApple OSS Distributions char uu_cursig; /* p_cursig for exc. */ 128*27b03b36SApple OSS Distributions /* 129*27b03b36SApple OSS Distributions * uu_workq_pthread_kill_allowed is not modified under a lock and thus 130*27b03b36SApple OSS Distributions * relies on single copy atomicity and cannot be changed to a bitfield. 131*27b03b36SApple OSS Distributions */ 132*27b03b36SApple OSS Distributions bool uu_workq_pthread_kill_allowed; 133*27b03b36SApple OSS Distributions uint16_t syscall_code; /* current syscall code */ 134*27b03b36SApple OSS Distributions 135*27b03b36SApple OSS Distributions /* thread exception handling */ 136*27b03b36SApple OSS Distributions int uu_exception; 137*27b03b36SApple OSS Distributions mach_exception_code_t uu_code; /* ``code'' to trap */ 138*27b03b36SApple OSS Distributions mach_exception_subcode_t uu_subcode; 139*27b03b36SApple OSS Distributions 140*27b03b36SApple OSS Distributions /* support for syscalls which use continuations */ 141*27b03b36SApple OSS Distributions union { 142*27b03b36SApple OSS Distributions struct _select_data { 143*27b03b36SApple OSS Distributions u_int64_t abstime; 144*27b03b36SApple OSS Distributions int count; 145*27b03b36SApple OSS Distributions struct select_nocancel_args *args; /* original syscall arguments */ 146*27b03b36SApple OSS Distributions int32_t *retval; /* place to store return val */ 147*27b03b36SApple OSS Distributions } uus_select_data; 148*27b03b36SApple OSS Distributions 149*27b03b36SApple OSS Distributions struct kevent_ctx_s uus_kevent; 150*27b03b36SApple OSS Distributions 151*27b03b36SApple OSS Distributions struct _kevent_register { 152*27b03b36SApple OSS Distributions struct kevent_qos_s kev; /* the kevent to maybe copy out */ 153*27b03b36SApple OSS Distributions thread_t handoff_thread; /* thread we handed off to, has +1 */ 154*27b03b36SApple OSS Distributions struct kqworkloop *kqwl; 155*27b03b36SApple OSS Distributions int eventout; /* number of events output */ 156*27b03b36SApple OSS Distributions user_addr_t ueventlist; /* the user-address to copyout to */ 157*27b03b36SApple OSS Distributions } uus_kevent_register; /* saved for EVFILT_WORKLOOP wait */ 158*27b03b36SApple OSS Distributions 159*27b03b36SApple OSS Distributions struct _kauth { 160*27b03b36SApple OSS Distributions user_addr_t message; /* message in progress */ 161*27b03b36SApple OSS Distributions } uus_kauth; 162*27b03b36SApple OSS Distributions 163*27b03b36SApple OSS Distributions struct ksyn_waitq_element uus_kwe; /* user for pthread synch */ 164*27b03b36SApple OSS Distributions 165*27b03b36SApple OSS Distributions struct _waitid_data { 166*27b03b36SApple OSS Distributions struct waitid_nocancel_args *args; /* original syscall arguments */ 167*27b03b36SApple OSS Distributions int32_t *retval; /* place to store return val */ 168*27b03b36SApple OSS Distributions } uus_waitid_data; 169*27b03b36SApple OSS Distributions 170*27b03b36SApple OSS Distributions struct _wait4_data { 171*27b03b36SApple OSS Distributions struct wait4_nocancel_args *args; /* original syscall arguments */ 172*27b03b36SApple OSS Distributions int32_t *retval; /* place to store return val */ 173*27b03b36SApple OSS Distributions } uus_wait4_data; 174*27b03b36SApple OSS Distributions 175*27b03b36SApple OSS Distributions struct _workq_park_data { 176*27b03b36SApple OSS Distributions uint64_t idle_stamp; 177*27b03b36SApple OSS Distributions uint64_t workloop_params; 178*27b03b36SApple OSS Distributions uint32_t fulfilled_snapshot; 179*27b03b36SApple OSS Distributions uint32_t yields; 180*27b03b36SApple OSS Distributions void *thread_request; /* request being fulfilled, for tracing only */ 181*27b03b36SApple OSS Distributions uint32_t upcall_flags; 182*27b03b36SApple OSS Distributions bool has_stack; 183*27b03b36SApple OSS Distributions thread_qos_t qos; 184*27b03b36SApple OSS Distributions } uus_workq_park_data; /* saved for parked workq threads */ 185*27b03b36SApple OSS Distributions 186*27b03b36SApple OSS Distributions struct _ulock_wait_data { 187*27b03b36SApple OSS Distributions struct ull *ull; 188*27b03b36SApple OSS Distributions thread_t owner_thread; 189*27b03b36SApple OSS Distributions thread_t old_owner; 190*27b03b36SApple OSS Distributions int32_t *retval; 191*27b03b36SApple OSS Distributions uint flags; 192*27b03b36SApple OSS Distributions } uus_ulock_wait_data; 193*27b03b36SApple OSS Distributions 194*27b03b36SApple OSS Distributions struct _bsdthread_terminate { 195*27b03b36SApple OSS Distributions user_addr_t ulock_addr; 196*27b03b36SApple OSS Distributions mach_port_name_t kport; 197*27b03b36SApple OSS Distributions } uus_bsdthread_terminate; 198*27b03b36SApple OSS Distributions } uu_save; 199*27b03b36SApple OSS Distributions 200*27b03b36SApple OSS Distributions /* Persistent memory allocations across system calls */ 201*27b03b36SApple OSS Distributions struct _select { 202*27b03b36SApple OSS Distributions u_int32_t *ibits, *obits; /* bits to select on */ 203*27b03b36SApple OSS Distributions uint nbytes; /* number of bytes in ibits and obits */ 204*27b03b36SApple OSS Distributions } uu_select; /* saved state for select() */ 205*27b03b36SApple OSS Distributions 206*27b03b36SApple OSS Distributions void * uu_userstate; 207*27b03b36SApple OSS Distributions struct select_set *uu_selset; /* waitq state cached across select calls */ 208*27b03b36SApple OSS Distributions int uu_flag; 209*27b03b36SApple OSS Distributions sigset_t uu_siglist; /* signals pending for the thread */ 210*27b03b36SApple OSS Distributions sigset_t uu_sigwait; /* sigwait on this thread*/ 211*27b03b36SApple OSS Distributions sigset_t uu_sigmask; /* signal mask for the thread */ 212*27b03b36SApple OSS Distributions sigset_t uu_oldmask; /* signal mask saved before sigpause */ 213*27b03b36SApple OSS Distributions user_addr_t uu_sigreturn_token; /* random token used to validate sigreturn arguments */ 214*27b03b36SApple OSS Distributions uint32_t uu_sigreturn_diversifier; /* random diversifier used to validate user signed sigreturn pc/lr */ 215*27b03b36SApple OSS Distributions int uu_pending_sigreturn; /* Pending sigreturn count */ 216*27b03b36SApple OSS Distributions 217*27b03b36SApple OSS Distributions TAILQ_ENTRY(uthread) uu_list; /* List of uthreads in proc */ 218*27b03b36SApple OSS Distributions 219*27b03b36SApple OSS Distributions #if CONFIG_AUDIT 220*27b03b36SApple OSS Distributions struct kaudit_record *uu_ar; /* audit record */ 221*27b03b36SApple OSS Distributions #endif 222*27b03b36SApple OSS Distributions struct task *uu_aio_task; /* target task for async io */ 223*27b03b36SApple OSS Distributions 224*27b03b36SApple OSS Distributions union { 225*27b03b36SApple OSS Distributions lck_mtx_t *uu_mtx; 226*27b03b36SApple OSS Distributions struct knote_lock_ctx *uu_knlock; 227*27b03b36SApple OSS Distributions }; 228*27b03b36SApple OSS Distributions 229*27b03b36SApple OSS Distributions lck_spin_t uu_rethrottle_lock; /* locks was_rethrottled and is_throttled */ 230*27b03b36SApple OSS Distributions TAILQ_ENTRY(uthread) uu_throttlelist; /* List of uthreads currently throttled */ 231*27b03b36SApple OSS Distributions void * uu_throttle_info; /* pointer to throttled I/Os info */ 232*27b03b36SApple OSS Distributions int8_t uu_on_throttlelist; 233*27b03b36SApple OSS Distributions bool uu_lowpri_window; 234*27b03b36SApple OSS Distributions /* These boolean fields are protected by different locks */ 235*27b03b36SApple OSS Distributions bool uu_was_rethrottled; 236*27b03b36SApple OSS Distributions bool uu_is_throttled; 237*27b03b36SApple OSS Distributions bool uu_throttle_bc; 238*27b03b36SApple OSS Distributions bool uu_defer_reclaims; 239*27b03b36SApple OSS Distributions 240*27b03b36SApple OSS Distributions /* internal support for continuation framework */ 241*27b03b36SApple OSS Distributions uint16_t uu_pri; /* pri | PCATCH | PVFS, ... */ 242*27b03b36SApple OSS Distributions caddr_t uu_wchan; /* sleeping thread wait channel */ 243*27b03b36SApple OSS Distributions int (*uu_continuation)(int); 244*27b03b36SApple OSS Distributions const char *uu_wmesg; /* ... wait message */ 245*27b03b36SApple OSS Distributions 246*27b03b36SApple OSS Distributions struct kern_sigaltstack uu_sigstk; 247*27b03b36SApple OSS Distributions vnode_t uu_vreclaims; 248*27b03b36SApple OSS Distributions vnode_t uu_cdir; /* per thread CWD */ 249*27b03b36SApple OSS Distributions int uu_dupfd; /* fd in fdesc_open/dupfdopen */ 250*27b03b36SApple OSS Distributions 251*27b03b36SApple OSS Distributions u_int32_t uu_network_marks; /* network control flow marks */ 252*27b03b36SApple OSS Distributions 253*27b03b36SApple OSS Distributions /* 254*27b03b36SApple OSS Distributions * Bound kqueue request. This field is only cleared by the current thread, 255*27b03b36SApple OSS Distributions * hence can be dereferenced safely by the current thread without locks. 256*27b03b36SApple OSS Distributions */ 257*27b03b36SApple OSS Distributions struct workq_threadreq_s *uu_kqr_bound; 258*27b03b36SApple OSS Distributions TAILQ_ENTRY(uthread) uu_workq_entry; 259*27b03b36SApple OSS Distributions vm_offset_t uu_workq_stackaddr; 260*27b03b36SApple OSS Distributions mach_port_name_t uu_workq_thport; 261*27b03b36SApple OSS Distributions struct uu_workq_policy { 262*27b03b36SApple OSS Distributions uint16_t qos_req : 4; /* requested QoS */ 263*27b03b36SApple OSS Distributions uint16_t qos_max : 4; /* current acked max qos */ 264*27b03b36SApple OSS Distributions uint16_t qos_override : 4; /* received async override */ 265*27b03b36SApple OSS Distributions uint16_t qos_bucket : 4; /* current acked bucket */ 266*27b03b36SApple OSS Distributions } uu_workq_pri; 267*27b03b36SApple OSS Distributions 268*27b03b36SApple OSS Distributions uint16_t uu_workq_flags; 269*27b03b36SApple OSS Distributions kq_index_t uu_kqueue_override; 270*27b03b36SApple OSS Distributions 271*27b03b36SApple OSS Distributions #ifdef CONFIG_IOCOUNT_TRACE 272*27b03b36SApple OSS Distributions int uu_iocount; 273*27b03b36SApple OSS Distributions int uu_vpindex; 274*27b03b36SApple OSS Distributions void *uu_vps[32]; 275*27b03b36SApple OSS Distributions void *uu_pcs[32][10]; 276*27b03b36SApple OSS Distributions #endif 277*27b03b36SApple OSS Distributions #if CONFIG_WORKLOOP_DEBUG 278*27b03b36SApple OSS Distributions #define UU_KEVENT_HISTORY_COUNT 32 279*27b03b36SApple OSS Distributions #define UU_KEVENT_HISTORY_WRITE_ENTRY(uth, ...) ({ \ 280*27b03b36SApple OSS Distributions struct uthread *__uth = (uth); \ 281*27b03b36SApple OSS Distributions unsigned int __index = __uth->uu_kevent_index++; \ 282*27b03b36SApple OSS Distributions __uth->uu_kevent_history[__index % UU_KEVENT_HISTORY_COUNT] = \ 283*27b03b36SApple OSS Distributions (struct uu_kevent_history)__VA_ARGS__; \ 284*27b03b36SApple OSS Distributions }) 285*27b03b36SApple OSS Distributions struct uu_kevent_history { 286*27b03b36SApple OSS Distributions uint64_t uu_kqid; 287*27b03b36SApple OSS Distributions struct kqueue *uu_kq; 288*27b03b36SApple OSS Distributions int uu_error, uu_nchanges, uu_nevents; 289*27b03b36SApple OSS Distributions unsigned int uu_flags; 290*27b03b36SApple OSS Distributions } uu_kevent_history[UU_KEVENT_HISTORY_COUNT]; 291*27b03b36SApple OSS Distributions unsigned int uu_kevent_index; 292*27b03b36SApple OSS Distributions #endif 293*27b03b36SApple OSS Distributions int uu_proc_refcount; 294*27b03b36SApple OSS Distributions #if PROC_REF_DEBUG 295*27b03b36SApple OSS Distributions struct uthread_proc_ref_info *uu_proc_ref_info; 296*27b03b36SApple OSS Distributions #endif 297*27b03b36SApple OSS Distributions 298*27b03b36SApple OSS Distributions #if CONFIG_DTRACE 299*27b03b36SApple OSS Distributions uint32_t t_dtrace_errno; /* Most recent errno */ 300*27b03b36SApple OSS Distributions siginfo_t t_dtrace_siginfo; 301*27b03b36SApple OSS Distributions uint64_t t_dtrace_resumepid; /* DTrace's pidresume() pid */ 302*27b03b36SApple OSS Distributions uint8_t t_dtrace_stop; /* indicates a DTrace desired stop */ 303*27b03b36SApple OSS Distributions uint8_t t_dtrace_sig; /* signal sent via DTrace's raise() */ 304*27b03b36SApple OSS Distributions 305*27b03b36SApple OSS Distributions union __tdu { 306*27b03b36SApple OSS Distributions struct __tds { 307*27b03b36SApple OSS Distributions uint8_t _t_dtrace_on; /* hit a fasttrap tracepoint */ 308*27b03b36SApple OSS Distributions uint8_t _t_dtrace_step; /* about to return to kernel */ 309*27b03b36SApple OSS Distributions uint8_t _t_dtrace_ret; /* handling a return probe */ 310*27b03b36SApple OSS Distributions uint8_t _t_dtrace_ast; /* saved ast flag */ 311*27b03b36SApple OSS Distributions #if __sol64 || defined(__APPLE__) 312*27b03b36SApple OSS Distributions uint8_t _t_dtrace_reg; /* modified register */ 313*27b03b36SApple OSS Distributions #endif 314*27b03b36SApple OSS Distributions } _tds; 315*27b03b36SApple OSS Distributions u_int32_t _t_dtrace_ft; /* bitwise or of these flags */ 316*27b03b36SApple OSS Distributions } _tdu; 317*27b03b36SApple OSS Distributions #define t_dtrace_ft _tdu._t_dtrace_ft 318*27b03b36SApple OSS Distributions #define t_dtrace_on _tdu._tds._t_dtrace_on 319*27b03b36SApple OSS Distributions #define t_dtrace_step _tdu._tds._t_dtrace_step 320*27b03b36SApple OSS Distributions #define t_dtrace_ret _tdu._tds._t_dtrace_ret 321*27b03b36SApple OSS Distributions #define t_dtrace_ast _tdu._tds._t_dtrace_ast 322*27b03b36SApple OSS Distributions #if __sol64 || defined(__APPLE__) 323*27b03b36SApple OSS Distributions #define t_dtrace_reg _tdu._tds._t_dtrace_reg 324*27b03b36SApple OSS Distributions #endif 325*27b03b36SApple OSS Distributions 326*27b03b36SApple OSS Distributions user_addr_t t_dtrace_pc; /* DTrace saved pc from fasttrap */ 327*27b03b36SApple OSS Distributions user_addr_t t_dtrace_npc; /* DTrace next pc from fasttrap */ 328*27b03b36SApple OSS Distributions user_addr_t t_dtrace_scrpc; /* DTrace per-thread scratch location */ 329*27b03b36SApple OSS Distributions user_addr_t t_dtrace_astpc; /* DTrace return sequence location */ 330*27b03b36SApple OSS Distributions 331*27b03b36SApple OSS Distributions struct dtrace_ptss_page_entry* t_dtrace_scratch; /* scratch space entry */ 332*27b03b36SApple OSS Distributions 333*27b03b36SApple OSS Distributions #if __sol64 || defined(__APPLE__) 334*27b03b36SApple OSS Distributions uint64_t t_dtrace_regv; /* DTrace saved reg from fasttrap */ 335*27b03b36SApple OSS Distributions #endif 336*27b03b36SApple OSS Distributions void *t_dtrace_syscall_args; 337*27b03b36SApple OSS Distributions #endif /* CONFIG_DTRACE */ 338*27b03b36SApple OSS Distributions char *pth_name; 339*27b03b36SApple OSS Distributions 340*27b03b36SApple OSS Distributions /* Document Tracking struct used to track a "tombstone" for a document */ 341*27b03b36SApple OSS Distributions struct doc_tombstone *t_tombstone; 342*27b03b36SApple OSS Distributions 343*27b03b36SApple OSS Distributions /* Field to be used by filesystems */ 344*27b03b36SApple OSS Distributions uint64_t t_fs_private; 345*27b03b36SApple OSS Distributions 346*27b03b36SApple OSS Distributions struct os_reason *uu_exit_reason; 347*27b03b36SApple OSS Distributions 348*27b03b36SApple OSS Distributions #if CONFIG_DEBUG_SYSCALL_REJECTION 349*27b03b36SApple OSS Distributions uint64_t *syscall_rejection_mask; /* mach_trap_count + nsysent bits */ 350*27b03b36SApple OSS Distributions #endif /* CONFIG_DEBUG_SYSCALL_REJECTION */ 351*27b03b36SApple OSS Distributions }; 352*27b03b36SApple OSS Distributions 353*27b03b36SApple OSS Distributions typedef struct uthread * uthread_t; 354*27b03b36SApple OSS Distributions 355*27b03b36SApple OSS Distributions /* Definition of uu_flag */ 356*27b03b36SApple OSS Distributions #define UT_SAS_OLDMASK 0x00000001 /* need to restore mask before pause */ 357*27b03b36SApple OSS Distributions #define UT_NO_SIGMASK 0x00000002 /* exited thread; invalid sigmask */ 358*27b03b36SApple OSS Distributions #define UT_NOTCANCELPT 0x00000004 /* not a cancelation point */ 359*27b03b36SApple OSS Distributions #define UT_CANCEL 0x00000008 /* thread marked for cancel */ 360*27b03b36SApple OSS Distributions #define UT_CANCELED 0x00000010 /* thread cancelled */ 361*27b03b36SApple OSS Distributions #define UT_CANCELDISABLE 0x00000020 /* thread cancel disabled */ 362*27b03b36SApple OSS Distributions #define UT_ALTSTACK 0x00000040 /* this thread has alt stack for signals */ 363*27b03b36SApple OSS Distributions #define UT_THROTTLE_IO 0x00000080 /* this thread issues throttle I/O */ 364*27b03b36SApple OSS Distributions #define UT_PASSIVE_IO 0x00000100 /* this thread issues passive I/O */ 365*27b03b36SApple OSS Distributions #define UT_PROCEXIT 0x00000200 /* this thread completed the proc exit */ 366*27b03b36SApple OSS Distributions #define UT_RAGE_VNODES 0x00000400 /* rapid age any vnodes created by this thread */ 367*27b03b36SApple OSS Distributions #define UT_KERN_RAGE_VNODES 0x00000800 /* rapid age any vnodes created by this thread (kernel set) */ 368*27b03b36SApple OSS Distributions #define UT_NSPACE_NODATALESSFAULTS 0x00001000 /* thread does not materialize dataless files */ 369*27b03b36SApple OSS Distributions #define UT_ATIME_UPDATE 0x00002000 /* don't update atime for files accessed by this thread */ 370*27b03b36SApple OSS Distributions #define UT_NSPACE_FORCEDATALESSFAULTS 0x00004000 /* thread always materializes dataless files */ 371*27b03b36SApple OSS Distributions #define UT_LP64 0x00010000 /* denormalized P_LP64 bit from proc */ 372*27b03b36SApple OSS Distributions 373*27b03b36SApple OSS Distributions #endif /* BSD_KERNEL_PRIVATE */ 374*27b03b36SApple OSS Distributions 375*27b03b36SApple OSS Distributions #endif /* __APPLE_API_PRIVATE */ 376*27b03b36SApple OSS Distributions 377*27b03b36SApple OSS Distributions #endif /* KERNEL */ 378*27b03b36SApple OSS Distributions 379*27b03b36SApple OSS Distributions /* 380*27b03b36SApple OSS Distributions * Per process structure containing data that isn't needed in core 381*27b03b36SApple OSS Distributions * when the process isn't running (esp. when swapped out). 382*27b03b36SApple OSS Distributions * This structure may or may not be at the same kernel address 383*27b03b36SApple OSS Distributions * in all processes. 384*27b03b36SApple OSS Distributions */ 385*27b03b36SApple OSS Distributions 386*27b03b36SApple OSS Distributions struct user { 387*27b03b36SApple OSS Distributions /* NOT USED ANYMORE */ 388*27b03b36SApple OSS Distributions }; 389*27b03b36SApple OSS Distributions 390*27b03b36SApple OSS Distributions #endif /* !_SYS_USER_H_ */ 391