#define SIG_DFL ((void*)0)
#define SIG_IGN ((void*)1)
+#define SIGHUP 1
int32 runtime·bsdthread_create(void*, M*, G*, void(*)(void));
int32 runtime·bsdthread_register(void);
#define SIG_DFL ((void*)0)
#define SIG_IGN ((void*)1)
+#define SIGHUP 1
int32 runtime·thr_new(ThrParam*, int32);
void runtime·sighandler(int32 sig, Siginfo *info, void *context, G *gp);
#define SIG_DFL ((void*)0)
#define SIG_IGN ((void*)1)
+#define SIGHUP 1
// Linux-specific system calls
int32 runtime·futex(uint32*, int32, uint32, Timespec*, uint32*, uint32);
#define SIG_DFL ((void*)0)
#define SIG_IGN ((void*)1)
+#define SIGHUP 1
#define SIG_BLOCK 1
#define SIG_UNBLOCK 2
#define SIG_DFL ((void*)0)
#define SIG_IGN ((void*)1)
+#define SIGHUP 1
#define SIG_BLOCK 1
#define SIG_UNBLOCK 2
GCStats gcstats;
bool racecall;
void* racepc;
+ void* sigset;
uint32 moreframesize_minalloc;
uintptr settype_buf[1024];
{
Sigaction sa;
+ // If SIGHUP handler is SIG_IGN, assume running
+ // under nohup and do not set explicit handler.
+ if(i == SIGHUP) {
+ runtime·memclr((byte*)&sa, sizeof sa);
+ runtime·sigaction(i, nil, &sa);
+ if(*(void**)sa.__sigaction_u == SIG_IGN)
+ return;
+ }
+
runtime·memclr((byte*)&sa, sizeof sa);
sa.sa_flags = SA_SIGINFO|SA_ONSTACK;
if(restart)
{
Sigaction sa;
+ // If SIGHUP handler is SIG_IGN, assume running
+ // under nohup and do not set explicit handler.
+ if(i == SIGHUP) {
+ runtime·memclr((byte*)&sa, sizeof sa);
+ runtime·sigaction(i, nil, &sa);
+ if(*(void**)sa.__sigaction_u == SIG_IGN)
+ return;
+ }
+
runtime·memclr((byte*)&sa, sizeof sa);
sa.sa_flags = SA_SIGINFO|SA_ONSTACK;
if(restart)
{
Sigaction sa;
+ // If SIGHUP handler is SIG_IGN, assume running
+ // under nohup and do not set explicit handler.
+ if(i == SIGHUP) {
+ runtime·memclr((byte*)&sa, sizeof sa);
+ runtime·sigaction(i, nil, &sa);
+ if(sa.__sigaction_u.__sa_sigaction == SIG_IGN)
+ return;
+ }
+
runtime·memclr((byte*)&sa, sizeof sa);
sa.sa_flags = SA_SIGINFO|SA_ONSTACK;
if(restart)
{
Sigaction sa;
+ // If SIGHUP handler is SIG_IGN, assume running
+ // under nohup and do not set explicit handler.
+ if(i == SIGHUP) {
+ runtime·memclr((byte*)&sa, sizeof sa);
+ runtime·sigaction(i, nil, &sa);
+ if(sa.__sigaction_u.__sa_sigaction == SIG_IGN)
+ return;
+ }
+
runtime·memclr((byte*)&sa, sizeof sa);
sa.sa_flags = SA_SIGINFO|SA_ONSTACK;
if(restart)
{
Sigaction sa;
+ // If SIGHUP handler is SIG_IGN, assume running
+ // under nohup and do not set explicit handler.
+ if(i == SIGHUP) {
+ runtime·memclr((byte*)&sa, sizeof sa);
+ runtime·sigaction(i, nil, &sa);
+ if(sa.__sigaction_u.__sa_sigaction == SIG_IGN)
+ return;
+ }
+
runtime·memclr((byte*)&sa, sizeof sa);
sa.sa_flags = SA_SIGINFO|SA_ONSTACK;
if(restart)
{
Sigaction sa;
+ // If SIGHUP handler is SIG_IGN, assume running
+ // under nohup and do not set explicit handler.
+ if(i == SIGHUP) {
+ runtime·memclr((byte*)&sa, sizeof sa);
+ runtime·sigaction(i, nil, &sa);
+ if(sa.k_sa_handler == SIG_IGN)
+ return;
+ }
+
runtime·memclr((byte*)&sa, sizeof sa);
sa.sa_flags = SA_ONSTACK | SA_SIGINFO | SA_RESTORER;
if(restart)
{
Sigaction sa;
+ // If SIGHUP handler is SIG_IGN, assume running
+ // under nohup and do not set explicit handler.
+ if(i == SIGHUP) {
+ runtime·memclr((byte*)&sa, sizeof sa);
+ runtime·sigaction(i, nil, &sa);
+ if(sa.sa_handler == SIG_IGN)
+ return;
+ }
+
runtime·memclr((byte*)&sa, sizeof sa);
sa.sa_flags = SA_ONSTACK | SA_SIGINFO | SA_RESTORER;
if(restart)
{
Sigaction sa;
+ // If SIGHUP handler is SIG_IGN, assume running
+ // under nohup and do not set explicit handler.
+ if(i == SIGHUP) {
+ runtime·memclr((byte*)&sa, sizeof sa);
+ runtime·sigaction(i, nil, &sa);
+ if(sa.sa_handler == SIG_IGN)
+ return;
+ }
+
runtime·memclr((byte*)&sa, sizeof sa);
sa.sa_flags = SA_ONSTACK | SA_SIGINFO | SA_RESTORER;
if(restart)
{
Sigaction sa;
+ // If SIGHUP handler is SIG_IGN, assume running
+ // under nohup and do not set explicit handler.
+ if(i == SIGHUP) {
+ runtime·memclr((byte*)&sa, sizeof sa);
+ runtime·sigaction(i, nil, &sa);
+ if(sa._sa_u._sa_sigaction == SIG_IGN)
+ return;
+ }
+
runtime·memclr((byte*)&sa, sizeof sa);
sa.sa_flags = SA_SIGINFO|SA_ONSTACK;
if(restart)
{
Sigaction sa;
+ // If SIGHUP handler is SIG_IGN, assume running
+ // under nohup and do not set explicit handler.
+ if(i == SIGHUP) {
+ runtime·memclr((byte*)&sa, sizeof sa);
+ runtime·sigaction(i, nil, &sa);
+ if(sa._sa_u._sa_sigaction == SIG_IGN)
+ return;
+ }
+
runtime·memclr((byte*)&sa, sizeof sa);
sa.sa_flags = SA_SIGINFO|SA_ONSTACK;
if(restart)
{
Sigaction sa;
+ // If SIGHUP handler is SIG_IGN, assume running
+ // under nohup and do not set explicit handler.
+ if(i == SIGHUP) {
+ runtime·memclr((byte*)&sa, sizeof sa);
+ runtime·sigaction(i, nil, &sa);
+ if(sa._sa_u._sa_sigaction == SIG_IGN)
+ return;
+ }
+
runtime·memclr((byte*)&sa, sizeof sa);
sa.sa_flags = SA_SIGINFO|SA_ONSTACK;
if(restart)
{
Sigaction sa;
+ // If SIGHUP handler is SIG_IGN, assume running
+ // under nohup and do not set explicit handler.
+ if(i == SIGHUP) {
+ runtime·memclr((byte*)&sa, sizeof sa);
+ runtime·sigaction(i, nil, &sa);
+ if(sa.__sigaction_u.__sa_sigaction == SIG_IGN)
+ return;
+ }
+
runtime·memclr((byte*)&sa, sizeof sa);
sa.sa_flags = SA_SIGINFO|SA_ONSTACK;
if(restart)
{
Sigaction sa;
+ // If SIGHUP handler is SIG_IGN, assume running
+ // under nohup and do not set explicit handler.
+ if(i == SIGHUP) {
+ runtime·memclr((byte*)&sa, sizeof sa);
+ runtime·sigaction(i, nil, &sa);
+ if(sa.__sigaction_u.__sa_sigaction == SIG_IGN)
+ return;
+ }
+
runtime·memclr((byte*)&sa, sizeof sa);
sa.sa_flags = SA_SIGINFO|SA_ONSTACK;
if(restart)
extern SigTab runtime·sigtab[];
static Sigset sigset_all = ~(Sigset)0;
-static Sigset sigset_none;
static Sigset sigset_prof = 1<<(SIGPROF-1);
static void
}
runtime·sigprocmask(SIG_SETMASK, &sigset_all, &oset);
+ mp->sigset = runtime·mal(sizeof(Sigset));
+ *(Sigset*)mp->sigset = oset;
errno = runtime·bsdthread_create(stk, mp, gp, fn);
runtime·sigprocmask(SIG_SETMASK, &oset, nil);
m->gsignal = runtime·malg(32*1024); // OS X wants >=8K, Linux >=2K
runtime·signalstack((byte*)m->gsignal->stackguard - StackGuard, 32*1024);
- if(m->profilehz > 0)
- runtime·sigprocmask(SIG_SETMASK, &sigset_none, nil);
- else
- runtime·sigprocmask(SIG_SETMASK, &sigset_prof, nil);
+ if(m->sigset != nil)
+ runtime·sigprocmask(SIG_SETMASK, m->sigset, nil);
+ runtime·setprof(m->profilehz > 0);
}
// Mach IPC, to get at semaphores
#define HW_NCPU 3
static Sigset sigset_all = { ~(uint32)0, ~(uint32)0, ~(uint32)0, ~(uint32)0, };
-static Sigset sigset_none = { 0, 0, 0, 0, };
static int32
getncpu(void)
}
runtime·sigprocmask(&sigset_all, &oset);
+ mp->sigset = runtime·mal(sizeof(Sigset));
+ *(Sigset*)mp->sigset = oset;
runtime·memclr((byte*)¶m, sizeof param);
param.start_func = runtime·thr_start;
// Initialize signal handling
m->gsignal = runtime·malg(32*1024);
runtime·signalstack((byte*)m->gsignal->stackguard - StackGuard, 32*1024);
- runtime·sigprocmask(&sigset_none, nil);
+ if(m->sigset != nil)
+ runtime·sigprocmask(m->sigset, nil);
}
void
int32 runtime·read(int32, void*, int32);
static Sigset sigset_all = { ~(uint32)0, ~(uint32)0 };
-static Sigset sigset_none;
// Linux futex.
//
// Disable signals during clone, so that the new thread starts
// with signals disabled. It will enable them in minit.
runtime·rtsigprocmask(SIG_SETMASK, &sigset_all, &oset, sizeof oset);
+ mp->sigset = runtime·mal(sizeof(Sigset));
+ *(Sigset*)mp->sigset = oset;
ret = runtime·clone(flags, stk, mp, gp, fn);
runtime·rtsigprocmask(SIG_SETMASK, &oset, nil, sizeof oset);
// Initialize signal handling.
m->gsignal = runtime·malg(32*1024); // OS X wants >=8K, Linux >=2K
runtime·signalstack((byte*)m->gsignal->stackguard - StackGuard, 32*1024);
- runtime·rtsigprocmask(SIG_SETMASK, &sigset_none, nil, sizeof sigset_none);
+ if(m->sigset != nil)
+ runtime·rtsigprocmask(SIG_SETMASK, m->sigset, nil, sizeof *m->sigset);
}
void
extern SigTab runtime·sigtab[];
static Sigset sigset_all = { ~(uint32)0, ~(uint32)0, ~(uint32)0, ~(uint32)0, };
-static Sigset sigset_none;
extern void runtime·getcontext(UcontextT *context);
extern int32 runtime·lwp_create(UcontextT *context, uintptr flags, void *lwpid);
uc.uc_link = nil;
uc.uc_sigmask = sigset_all;
+ mp->sigset = runtime·mal(sizeof(Sigset));
+ runtime·sigprocmask(SIG_SETMASK, nil, mp->sigset);
+
runtime·lwp_mcontext_init(&uc.uc_mcontext, stk, mp, gp, fn);
ret = runtime·lwp_create(&uc, 0, &mp->procid);
// Initialize signal handling
m->gsignal = runtime·malg(32*1024);
runtime·signalstack((byte*)m->gsignal->stackguard - StackGuard, 32*1024);
- runtime·sigprocmask(SIG_SETMASK, &sigset_none, nil);
+ if(m->sigset != nil)
+ runtime·sigprocmask(SIG_SETMASK, m->sigset, nil);
}
void
extern SigTab runtime·sigtab[];
static Sigset sigset_all = ~(Sigset)0;
-static Sigset sigset_none;
extern int64 runtime·tfork(void *param, uintptr psize, M *mp, G *gp, void (*fn)(void));
extern int32 runtime·thrsleep(void *ident, int32 clock_id, void *tsp, void *lock, const int32 *abort);
param.tf_stack = stk;
oset = runtime·sigprocmask(SIG_SETMASK, sigset_all);
+ mp->sigset = runtime·mal(sizeof(Sigset));
+ *(Sigset*)mp->sigset = oset;
ret = runtime·tfork((byte*)¶m, sizeof(param), mp, gp, fn);
runtime·sigprocmask(SIG_SETMASK, oset);
// Initialize signal handling
m->gsignal = runtime·malg(32*1024);
runtime·signalstack((byte*)m->gsignal->stackguard - StackGuard, 32*1024);
- runtime·sigprocmask(SIG_SETMASK, sigset_none);
+ if(m->sigset != nil)
+ runtime·sigprocmask(SIG_SETMASK, m->sigset, nil, sizeof *m->sigset);
}
void