Print this page
re #13613 rb4516 Tunables needs volatile keyword
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/common/sys/klwp.h
+++ new/usr/src/uts/common/sys/klwp.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
↓ open down ↓ |
14 lines elided |
↑ open up ↑ |
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 23 * Use is subject to license terms.
24 24 */
25 +/*
26 + * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
27 + */
25 28
26 29 /*
27 30 * Copyright (c) 2013, Joyent, Inc. All rights reserved.
28 31 */
29 32
30 33 #ifndef _SYS_KLWP_H
31 34 #define _SYS_KLWP_H
32 35
33 36 #include <sys/types.h>
34 37 #include <sys/condvar.h>
35 38 #include <sys/thread.h>
36 39 #include <sys/signal.h>
37 40 #include <sys/siginfo.h>
38 41 #include <sys/pcb.h>
39 42 #include <sys/time.h>
40 43 #include <sys/msacct.h>
41 44 #include <sys/ucontext.h>
42 45 #include <sys/lwp.h>
43 46 #include <sys/contract.h>
44 47
45 48 #if (defined(_KERNEL) || defined(_KMEMUSER)) && defined(_MACHDEP)
46 49 #include <sys/machparam.h>
47 50 #endif
48 51
49 52 #ifdef __cplusplus
50 53 extern "C" {
51 54 #endif
52 55
53 56 /*
54 57 * The light-weight process object and the methods by which it
55 58 * is accessed.
56 59 */
57 60
58 61 #define MAXSYSARGS 8 /* Maximum # of arguments passed to a syscall */
59 62
60 63 /* lwp_eosys values */
61 64 #define NORMALRETURN 0 /* normal return; adjusts PC, registers */
62 65 #define JUSTRETURN 1 /* just return, leave registers alone */
63 66
64 67 /*
65 68 * Resource usage, per-lwp plus per-process (sum over defunct lwps).
66 69 */
67 70 struct lrusage {
68 71 u_longlong_t minflt; /* minor page faults */
69 72 u_longlong_t majflt; /* major page faults */
70 73 u_longlong_t nswap; /* swaps */
71 74 u_longlong_t inblock; /* input blocks */
72 75 u_longlong_t oublock; /* output blocks */
73 76 u_longlong_t msgsnd; /* messages sent */
74 77 u_longlong_t msgrcv; /* messages received */
75 78 u_longlong_t nsignals; /* signals received */
76 79 u_longlong_t nvcsw; /* voluntary context switches */
77 80 u_longlong_t nivcsw; /* involuntary context switches */
78 81 u_longlong_t sysc; /* system calls */
79 82 u_longlong_t ioch; /* chars read and written */
80 83 };
81 84
82 85 typedef struct _klwp *klwp_id_t;
83 86
84 87 typedef struct _klwp {
85 88 /*
86 89 * user-mode context
87 90 */
88 91 struct pcb lwp_pcb; /* user regs save pcb */
89 92 uintptr_t lwp_oldcontext; /* previous user context */
90 93
91 94 /*
92 95 * system-call interface
93 96 */
94 97 long *lwp_ap; /* pointer to arglist */
95 98 int lwp_errno; /* error for current syscall (private) */
96 99 /*
97 100 * support for I/O
98 101 */
99 102 char lwp_error; /* return error code */
100 103 char lwp_eosys; /* special action on end of syscall */
101 104 char lwp_argsaved; /* are all args in lwp_arg */
102 105 char lwp_watchtrap; /* lwp undergoing watchpoint single-step */
103 106 long lwp_arg[MAXSYSARGS]; /* args to current syscall */
104 107 void *lwp_regs; /* pointer to saved regs on stack */
105 108 void *lwp_fpu; /* pointer to fpu regs */
106 109 label_t lwp_qsav; /* longjmp label for quits and interrupts */
107 110
108 111 /*
109 112 * signal handling and debugger (/proc) interface
110 113 */
111 114 uchar_t lwp_cursig; /* current signal */
112 115 uchar_t lwp_curflt; /* current fault */
113 116 uchar_t lwp_sysabort; /* if set, abort syscall */
114 117 uchar_t lwp_asleep; /* lwp asleep in syscall */
115 118 uchar_t lwp_extsig; /* cursig sent from another contract */
116 119 stack_t lwp_sigaltstack; /* alternate signal stack */
117 120 struct sigqueue *lwp_curinfo; /* siginfo for current signal */
118 121 k_siginfo_t lwp_siginfo; /* siginfo for stop-on-fault */
119 122 k_sigset_t lwp_sigoldmask; /* for sigsuspend */
120 123 struct lwp_watch { /* used in watchpoint single-stepping */
121 124 caddr_t wpaddr;
122 125 size_t wpsize;
123 126 int wpcode;
124 127 int wpmapped;
125 128 greg_t wppc;
126 129 } lwp_watch[4]; /* one for each of exec/write/read/read */
127 130
128 131 uint32_t lwp_oweupc; /* profil(2) ticks owed to this lwp */
129 132
130 133 /*
131 134 * Microstate accounting. Timestamps are made at the start and the
132 135 * end of each microstate (see <sys/msacct.h> for state definitions)
133 136 * and the corresponding accounting info is updated. The current
134 137 * microstate is kept in the thread struct, since there are cases
135 138 * when one thread must update another thread's state (a no-no
136 139 * for an lwp since it may be swapped/paged out). The rest of the
137 140 * microstate stuff is kept here to avoid wasting space on things
138 141 * like kernel threads that don't have an associated lwp.
139 142 */
140 143 struct mstate {
141 144 int ms_prev; /* previous running mstate */
142 145 hrtime_t ms_start; /* lwp creation time */
143 146 hrtime_t ms_term; /* lwp termination time */
144 147 hrtime_t ms_state_start; /* start time of this mstate */
145 148 hrtime_t ms_acct[NMSTATES]; /* per mstate accounting */
146 149 } lwp_mstate;
147 150
148 151 /*
149 152 * Per-lwp resource usage.
150 153 */
151 154 struct lrusage lwp_ru;
152 155
153 156 /*
154 157 * Things to keep for real-time (SIGPROF) profiling.
155 158 */
156 159 int lwp_lastfault;
157 160 caddr_t lwp_lastfaddr;
158 161
159 162 /*
160 163 * timers. Protected by lwp->procp->p_lock
161 164 */
162 165 struct itimerval lwp_timer[3];
163 166
164 167 /*
165 168 * used to stop/alert lwps
166 169 */
167 170 char lwp_unused;
168 171 char lwp_state; /* Running in User/Kernel mode (no lock req) */
169 172 ushort_t lwp_nostop; /* Don't stop this lwp (no lock required) */
170 173 ushort_t lwp_pad; /* Reserved for future use */
171 174
172 175 /*
173 176 * Last failed privilege.
174 177 */
175 178 short lwp_badpriv;
176 179
177 180 /*
178 181 * linkage
179 182 */
180 183 struct _kthread *lwp_thread;
181 184 struct proc *lwp_procp;
182 185
183 186 size_t lwp_childstksz; /* kernel stksize for this lwp's descendants */
184 187
185 188 uintptr_t lwp_ustack; /* current stack bounds */
186 189 size_t lwp_old_stk_ctl; /* old stack limit */
187 190
188 191 /*
189 192 * Contracts
190 193 */
191 194 struct ct_template *lwp_ct_active[CTT_MAXTYPE]; /* active templates */
192 195 struct contract *lwp_ct_latest[CTT_MAXTYPE]; /* last created contract */
|
↓ open down ↓ |
158 lines elided |
↑ open up ↑ |
193 196
194 197 void *lwp_brand; /* per-lwp brand data */
195 198 struct psinfo *lwp_spymaster; /* if an agent LWP, our spymaster */
196 199 } klwp_t;
197 200
198 201 /* lwp states */
199 202 #define LWP_USER 0x01 /* Running in user mode */
200 203 #define LWP_SYS 0x02 /* Running in kernel mode */
201 204
202 205 #if defined(_KERNEL)
203 -extern int lwp_default_stksize;
206 +extern volatile int lwp_default_stksize;
204 207 extern int lwp_reapcnt;
205 208
206 209 extern struct _kthread *lwp_deathrow;
207 210 extern kmutex_t reaplock;
208 211 extern struct kmem_cache *lwp_cache;
209 212 extern void *segkp_lwp;
210 213 extern klwp_t lwp0;
211 214
212 215 /* where newly-created lwps normally start */
213 216 extern void lwp_rtt(void);
214 217
215 218 #endif /* _KERNEL */
216 219
217 220 #ifdef __cplusplus
218 221 }
219 222 #endif
220 223
221 224 #endif /* _SYS_KLWP_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX