2009-11-17 09:20:58 -07:00
|
|
|
// Copyright 2009 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
os/signal: selective signal handling
Restore package os/signal, with new API:
Notify replaces Incoming, allowing clients
to ask for certain signals only. Also, signals
go to everyone who asks, not just one client.
This could plausibly move into package os now
that there are no magic side effects as a result
of the import.
Update runtime for new API: move common Unix
signal handling code into signal_unix.c.
(It's so easy to do this now that we don't have
to edit Makefiles!)
Tested on darwin,linux 386,amd64.
Fixes #1266.
R=r, dsymonds, bradfitz, iant, borman
CC=golang-dev
https://golang.org/cl/3749041
2012-02-13 11:52:37 -07:00
|
|
|
#define N SigNotify
|
|
|
|
#define K SigKill
|
|
|
|
#define T SigThrow
|
2010-04-08 19:15:30 -06:00
|
|
|
#define P SigPanic
|
2012-02-16 20:36:40 -07:00
|
|
|
#define D SigDefault
|
2009-11-17 09:20:58 -07:00
|
|
|
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
SigTab runtime·sigtab[] = {
|
2012-04-10 05:57:05 -06:00
|
|
|
/* 0 */ 0, "SIGNONE: no trap",
|
|
|
|
/* 1 */ N+K, "SIGHUP: terminal line hangup",
|
|
|
|
/* 2 */ N+K, "SIGINT: interrupt",
|
|
|
|
/* 3 */ N+T, "SIGQUIT: quit",
|
|
|
|
/* 4 */ T, "SIGILL: illegal instruction",
|
|
|
|
/* 5 */ T, "SIGTRAP: trace trap",
|
|
|
|
/* 6 */ N+T, "SIGABRT: abort",
|
|
|
|
/* 7 */ T, "SIGEMT: emulate instruction executed",
|
|
|
|
/* 8 */ P, "SIGFPE: floating-point exception",
|
|
|
|
/* 9 */ 0, "SIGKILL: kill",
|
os/signal: selective signal handling
Restore package os/signal, with new API:
Notify replaces Incoming, allowing clients
to ask for certain signals only. Also, signals
go to everyone who asks, not just one client.
This could plausibly move into package os now
that there are no magic side effects as a result
of the import.
Update runtime for new API: move common Unix
signal handling code into signal_unix.c.
(It's so easy to do this now that we don't have
to edit Makefiles!)
Tested on darwin,linux 386,amd64.
Fixes #1266.
R=r, dsymonds, bradfitz, iant, borman
CC=golang-dev
https://golang.org/cl/3749041
2012-02-13 11:52:37 -07:00
|
|
|
/* 10 */ P, "SIGBUS: bus error",
|
|
|
|
/* 11 */ P, "SIGSEGV: segmentation violation",
|
|
|
|
/* 12 */ T, "SIGSYS: bad system call",
|
|
|
|
/* 13 */ N, "SIGPIPE: write to broken pipe",
|
|
|
|
/* 14 */ N, "SIGALRM: alarm clock",
|
|
|
|
/* 15 */ N+K, "SIGTERM: termination",
|
|
|
|
/* 16 */ N, "SIGURG: urgent condition on socket",
|
|
|
|
/* 17 */ 0, "SIGSTOP: stop",
|
2012-02-16 20:36:40 -07:00
|
|
|
/* 18 */ N+D, "SIGTSTP: keyboard stop",
|
os/signal: selective signal handling
Restore package os/signal, with new API:
Notify replaces Incoming, allowing clients
to ask for certain signals only. Also, signals
go to everyone who asks, not just one client.
This could plausibly move into package os now
that there are no magic side effects as a result
of the import.
Update runtime for new API: move common Unix
signal handling code into signal_unix.c.
(It's so easy to do this now that we don't have
to edit Makefiles!)
Tested on darwin,linux 386,amd64.
Fixes #1266.
R=r, dsymonds, bradfitz, iant, borman
CC=golang-dev
https://golang.org/cl/3749041
2012-02-13 11:52:37 -07:00
|
|
|
/* 19 */ 0, "SIGCONT: continue after stop",
|
|
|
|
/* 20 */ N, "SIGCHLD: child status has changed",
|
2012-02-16 20:36:40 -07:00
|
|
|
/* 21 */ N+D, "SIGTTIN: background read from tty",
|
|
|
|
/* 22 */ N+D, "SIGTTOU: background write to tty",
|
os/signal: selective signal handling
Restore package os/signal, with new API:
Notify replaces Incoming, allowing clients
to ask for certain signals only. Also, signals
go to everyone who asks, not just one client.
This could plausibly move into package os now
that there are no magic side effects as a result
of the import.
Update runtime for new API: move common Unix
signal handling code into signal_unix.c.
(It's so easy to do this now that we don't have
to edit Makefiles!)
Tested on darwin,linux 386,amd64.
Fixes #1266.
R=r, dsymonds, bradfitz, iant, borman
CC=golang-dev
https://golang.org/cl/3749041
2012-02-13 11:52:37 -07:00
|
|
|
/* 23 */ N, "SIGIO: i/o now possible",
|
|
|
|
/* 24 */ N, "SIGXCPU: cpu limit exceeded",
|
|
|
|
/* 25 */ N, "SIGXFSZ: file size limit exceeded",
|
|
|
|
/* 26 */ N, "SIGVTALRM: virtual alarm clock",
|
|
|
|
/* 27 */ N, "SIGPROF: profiling alarm clock",
|
|
|
|
/* 28 */ N, "SIGWINCH: window size change",
|
|
|
|
/* 29 */ N, "SIGINFO: status request from keyboard",
|
|
|
|
/* 30 */ N, "SIGUSR1: user-defined signal 1",
|
|
|
|
/* 31 */ N, "SIGUSR2: user-defined signal 2",
|
|
|
|
/* 32 */ N, "SIGTHR: reserved",
|
2009-11-17 09:20:58 -07:00
|
|
|
};
|
|
|
|
|
os/signal: selective signal handling
Restore package os/signal, with new API:
Notify replaces Incoming, allowing clients
to ask for certain signals only. Also, signals
go to everyone who asks, not just one client.
This could plausibly move into package os now
that there are no magic side effects as a result
of the import.
Update runtime for new API: move common Unix
signal handling code into signal_unix.c.
(It's so easy to do this now that we don't have
to edit Makefiles!)
Tested on darwin,linux 386,amd64.
Fixes #1266.
R=r, dsymonds, bradfitz, iant, borman
CC=golang-dev
https://golang.org/cl/3749041
2012-02-13 11:52:37 -07:00
|
|
|
#undef N
|
|
|
|
#undef K
|
|
|
|
#undef T
|
|
|
|
#undef P
|
2012-02-16 20:36:40 -07:00
|
|
|
#undef D
|