1
0
mirror of https://github.com/golang/go synced 2024-11-21 15:14:43 -07:00

Only catch all signals if os/signal package imported.

Fixes #776.

R=rsc
CC=golang-dev
https://golang.org/cl/1745041
This commit is contained in:
Ian Lance Taylor 2010-06-28 17:14:17 -07:00
parent d4384ff7f5
commit 807605d0fc
13 changed files with 27 additions and 12 deletions

View File

@ -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 {

View File

@ -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 {

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -8,7 +8,7 @@
#include "os.h"
void
initsig(void)
initsig(int32 queue)
{
}

View File

@ -278,7 +278,7 @@ check(void)
if(z != 4)
throw("cas4");
initsig();
initsig(0);
}
/*

View File

@ -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*);

View File

@ -94,5 +94,6 @@ func Signame(sig int32) (name String) {
}
func Siginit() {
initsig(SigQueue);
sig.inuse = true; // enable reception of signals; cannot disable
}

View File

@ -17,7 +17,7 @@ osinit(void)
}
void
initsig(void)
initsig(int32 queue)
{
}

View File

@ -3,6 +3,6 @@
// license that can be found in the LICENSE file.
void
initsig(void)
initsig(int32 queue)
{
}