mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00: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
This commit is contained in:
parent
cdd7e02583
commit
35586f718c
61 changed files with 1216 additions and 1266 deletions
|
|
@ -151,18 +151,18 @@ func (w WaitStatus) ExitStatus() int {
|
|||
return int(w>>shift) & 0xFF
|
||||
}
|
||||
|
||||
func (w WaitStatus) Signal() int {
|
||||
func (w WaitStatus) Signal() Signal {
|
||||
if !w.Signaled() {
|
||||
return -1
|
||||
}
|
||||
return int(w & mask)
|
||||
return Signal(w & mask)
|
||||
}
|
||||
|
||||
func (w WaitStatus) StopSignal() int {
|
||||
func (w WaitStatus) StopSignal() Signal {
|
||||
if !w.Stopped() {
|
||||
return -1
|
||||
}
|
||||
return int(w>>shift) & 0xFF
|
||||
return Signal(w>>shift) & 0xFF
|
||||
}
|
||||
|
||||
func (w WaitStatus) TrapCause() int {
|
||||
|
|
@ -830,7 +830,7 @@ func Mount(source string, target string, fstype string, flags uintptr, data stri
|
|||
//sysnb InotifyInit() (fd int, err error)
|
||||
//sysnb InotifyInit1(flags int) (fd int, err error)
|
||||
//sysnb InotifyRmWatch(fd int, watchdesc uint32) (success int, err error)
|
||||
//sysnb Kill(pid int, sig int) (err error)
|
||||
//sysnb Kill(pid int, sig Signal) (err error)
|
||||
//sys Klogctl(typ int, buf []byte) (n int, err error) = SYS_SYSLOG
|
||||
//sys Link(oldpath string, newpath string) (err error)
|
||||
//sys Mkdir(path string, mode uint32) (err error)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue