github.com/searKing/golang/go@v1.2.117/os/signal/signal_plan9.go (about) 1 // Copyright 2020 The searKing Author. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package signal 6 7 import ( 8 "os" 9 "syscall" 10 ) 11 12 const numSig = 256 13 14 func Signum(sig os.Signal) int { 15 switch sig := sig.(type) { 16 case syscall.Note: 17 n, ok := sigtab[sig] 18 if !ok { 19 n = len(sigtab) + 1 20 if n > numSig { 21 return -1 22 } 23 sigtab[sig] = n 24 } 25 return n 26 default: 27 return -1 28 } 29 }