LEFT | RIGHT |
(no file at all) | |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 #include "runtime.h" | 5 #include "runtime.h" |
6 #include "defs_GOOS_GOARCH.h" | 6 #include "defs_GOOS_GOARCH.h" |
7 #include "os_GOOS.h" | 7 #include "os_GOOS.h" |
8 #include "stack.h" | 8 #include "stack.h" |
9 | 9 |
10 extern SigTab runtime·sigtab[]; | 10 extern SigTab runtime·sigtab[]; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 if(ret < 0) { | 155 if(ret < 0) { |
156 runtime·printf("runtime: failed to create new OS thread (have %d
already; errno=%d)\n", runtime·mcount(), -ret); | 156 runtime·printf("runtime: failed to create new OS thread (have %d
already; errno=%d)\n", runtime·mcount(), -ret); |
157 runtime·throw("runtime.newosproc"); | 157 runtime·throw("runtime.newosproc"); |
158 } | 158 } |
159 } | 159 } |
160 | 160 |
161 void | 161 void |
162 runtime·osinit(void) | 162 runtime·osinit(void) |
163 { | 163 { |
164 runtime·ncpu = getproccount(); | 164 runtime·ncpu = getproccount(); |
| 165 runtime·gsignalstk = 32*1024; // OS X wants >=8K, Linux >=2K |
165 } | 166 } |
166 | 167 |
167 void | 168 void |
168 runtime·goenvs(void) | 169 runtime·goenvs(void) |
169 { | 170 { |
170 runtime·goenvs_unix(); | 171 runtime·goenvs_unix(); |
171 } | 172 } |
172 | 173 |
173 // Called to initialize a new m (including the bootstrap m). | 174 // Called to initialize a new m (including the bootstrap m). |
174 void | 175 void |
175 runtime·minit(void) | 176 runtime·minit(void) |
176 { | 177 { |
177 // Initialize signal handling. | 178 // Initialize signal handling. |
178 m->gsignal = runtime·malg(32*1024); // OS X wants >=8K, Linux >=2K | |
179 runtime·signalstack((byte*)m->gsignal->stackguard - StackGuard, 32*1024)
; | 179 runtime·signalstack((byte*)m->gsignal->stackguard - StackGuard, 32*1024)
; |
180 runtime·rtsigprocmask(SIG_SETMASK, &sigset_none, nil, sizeof sigset_none
); | 180 runtime·rtsigprocmask(SIG_SETMASK, &sigset_none, nil, sizeof sigset_none
); |
181 } | 181 } |
182 | 182 |
183 void | 183 void |
184 runtime·sigpanic(void) | 184 runtime·sigpanic(void) |
185 { | 185 { |
186 switch(g->sig) { | 186 switch(g->sig) { |
187 case SIGBUS: | 187 case SIGBUS: |
188 if(g->sigcode0 == BUS_ADRERR && g->sigcode1 < 0x1000) { | 188 if(g->sigcode0 == BUS_ADRERR && g->sigcode1 < 0x1000) { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 #pragma textflag 7 | 262 #pragma textflag 7 |
263 void | 263 void |
264 runtime·badsignal(int32 sig) | 264 runtime·badsignal(int32 sig) |
265 { | 265 { |
266 if (sig == SIGPROF) { | 266 if (sig == SIGPROF) { |
267 return; // Ignore SIGPROFs intended for a non-Go thread. | 267 return; // Ignore SIGPROFs intended for a non-Go thread. |
268 } | 268 } |
269 runtime·write(2, badsignal, sizeof badsignal - 1); | 269 runtime·write(2, badsignal, sizeof badsignal - 1); |
270 runtime·exit(1); | 270 runtime·exit(1); |
271 } | 271 } |
LEFT | RIGHT |