Commit 807605d0 authored by Ian Lance Taylor's avatar Ian Lance Taylor

Only catch all signals if os/signal package imported.

Fixes #776.

R=rsc
CC=golang-dev
https://golang.org/cl/1745041
parent d4384ff7
......@@ -129,7 +129,7 @@ signalstack(byte *p, int32 n)
}
void
initsig(void)
initsig(int32 queue)
{
int32 i;
static Sigaction sa;
......@@ -141,6 +141,8 @@ initsig(void)
sa.sa_tramp = sigtramp; // sigtramp's job is to call into real handler
for(i = 0; i<NSIG; i++) {
if(sigtab[i].flags) {
if((sigtab[i].flags & SigQueue) != queue)
continue;
if(sigtab[i].flags & (SigCatch | SigQueue)) {
sa.__sigaction_u.__sa_sigaction = sighandler;
} else {
......
......@@ -138,7 +138,7 @@ signalstack(byte *p, int32 n)
}
void
initsig(void)
initsig(int32 queue)
{
int32 i;
static Sigaction sa;
......@@ -150,6 +150,8 @@ initsig(void)
sa.sa_tramp = sigtramp; // sigtramp's job is to call into real handler
for(i = 0; i<NSIG; i++) {
if(sigtab[i].flags) {
if((sigtab[i].flags & SigQueue) != queue)
continue;
if(sigtab[i].flags & (SigCatch | SigQueue)) {
sa.__sigaction_u.__sa_sigaction = sighandler;
} else {
......
......@@ -124,7 +124,7 @@ signalstack(byte *p, int32 n)
}
void
initsig(void)
initsig(int32 queue)
{
static Sigaction sa;
......@@ -136,6 +136,8 @@ initsig(void)
for(i = 0; i < NSIG; i++) {
if(sigtab[i].flags) {
if((sigtab[i].flags & SigQueue) != queue)
continue;
if(sigtab[i].flags & (SigCatch | SigQueue))
sa.__sigaction_u.__sa_sigaction = (void*) sigtramp;
else
......
......@@ -132,7 +132,7 @@ signalstack(byte *p, int32 n)
}
void
initsig(void)
initsig(int32 queue)
{
static Sigaction sa;
......@@ -144,6 +144,8 @@ initsig(void)
for(i = 0; i < NSIG; i++) {
if(sigtab[i].flags) {
if((sigtab[i].flags & SigQueue) != queue)
continue;
if(sigtab[i].flags & (SigCatch | SigQueue))
sa.__sigaction_u.__sa_sigaction = (void*) sigtramp;
else
......
......@@ -116,7 +116,7 @@ signalstack(byte *p, int32 n)
}
void
initsig(void)
initsig(int32 queue)
{
static Sigaction sa;
......@@ -128,6 +128,8 @@ initsig(void)
sa.sa_restorer = (void*)sigreturn;
for(i = 0; i<NSIG; i++) {
if(sigtab[i].flags) {
if((sigtab[i].flags & SigQueue) != queue)
continue;
if(sigtab[i].flags & (SigCatch | SigQueue))
sa.k_sa_handler = (void*)sigtramp;
else
......
......@@ -126,7 +126,7 @@ signalstack(byte *p, int32 n)
}
void
initsig(void)
initsig(int32 queue)
{
static Sigaction sa;
......@@ -138,6 +138,8 @@ initsig(void)
sa.sa_restorer = (void*)sigreturn;
for(i = 0; i<NSIG; i++) {
if(sigtab[i].flags) {
if((sigtab[i].flags & SigQueue) != queue)
continue;
if(sigtab[i].flags & (SigCatch | SigQueue))
sa.sa_handler = (void*)sigtramp;
else
......
......@@ -120,7 +120,7 @@ signalstack(byte *p, int32 n)
}
void
initsig(void)
initsig(int32 queue)
{
static Sigaction sa;
......@@ -133,6 +133,8 @@ initsig(void)
sa.sa_restorer = (void*)sigreturn;
for(i = 0; i<NSIG; i++) {
if(sigtab[i].flags) {
if((sigtab[i].flags & SigQueue) != queue)
continue;
if(sigtab[i].flags & (SigCatch | SigQueue))
sa.sa_handler = (void*)sigtramp;
else
......
......@@ -8,7 +8,7 @@
#include "os.h"
void
initsig(void)
initsig(int32 queue)
{
}
......@@ -278,7 +278,7 @@ check(void)
if(z != 4)
throw("cas4");
initsig();
initsig(0);
}
/*
......
......@@ -389,7 +389,7 @@ String catstring(String, String);
String gostring(byte*);
String gostringnocopy(byte*);
String gostringw(uint16*);
void initsig(void);
void initsig(int32);
int32 gotraceback(void);
void traceback(uint8 *pc, uint8 *sp, uint8 *lr, G* gp);
void tracebackothers(G*);
......
......@@ -94,5 +94,6 @@ func Signame(sig int32) (name String) {
}
func Siginit() {
initsig(SigQueue);
sig.inuse = true; // enable reception of signals; cannot disable
}
......@@ -17,7 +17,7 @@ osinit(void)
}
void
initsig(void)
initsig(int32 queue)
{
}
......
......@@ -3,6 +3,6 @@
// license that can be found in the LICENSE file.
void
initsig(void)
initsig(int32 queue)
{
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment