...
Source file
src/os/signal/signal_unix.go
1
2
3
4
5
6
7
8 package signal
9
10 import (
11 "os"
12 "syscall"
13 )
14
15
16 func signal_disable(uint32)
17 func signal_enable(uint32)
18 func signal_ignore(uint32)
19 func signal_ignored(uint32) bool
20 func signal_recv() uint32
21
22 func loop() {
23 for {
24 process(syscall.Signal(signal_recv()))
25 }
26 }
27
28 func init() {
29 watchSignalLoop = loop
30 }
31
32 const (
33 numSig = 65
34 )
35
36 func signum(sig os.Signal) int {
37 switch sig := sig.(type) {
38 case syscall.Signal:
39 i := int(sig)
40 if i < 0 || i >= numSig {
41 return -1
42 }
43 return i
44 default:
45 return -1
46 }
47 }
48
49 func enableSignal(sig int) {
50 signal_enable(uint32(sig))
51 }
52
53 func disableSignal(sig int) {
54 signal_disable(uint32(sig))
55 }
56
57 func ignoreSignal(sig int) {
58 signal_ignore(uint32(sig))
59 }
60
61 func signalIgnored(sig int) bool {
62 return signal_ignored(uint32(sig))
63 }
64
View as plain text