Commit 0ed728c4 authored by David Symonds's avatar David Symonds Committed by Russ Cox

Replicate signal names from syscall in os/signal.

R=rsc
CC=golang-dev
https://golang.org/cl/183142
parent 93d81fb7
......@@ -20,6 +20,7 @@ src/cmd/gc/mkbuiltin1
src/cmd/gc/opnames.h
src/pkg/Make.deps
src/pkg/exp/ogle/ogle
src/pkg/os/signal/unix.go
src/pkg/runtime/cgo2c
src/pkg/runtime/*/asm.h
src/pkg/runtime/runtime.acid.*
......
......@@ -7,5 +7,11 @@ include ../../../Make.$(GOARCH)
TARG=os/signal
GOFILES=\
signal.go\
unix.go\
CLEANFILES+=unix.go
include ../../../Make.pkg
unix.go: ../../syscall/zerrors_$(GOOS)_$(GOARCH).go
./mkunix.sh $< > $@ || rm -f $@
#!/usr/bin/env bash
# Copyright 2010 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.
echo '// ./mkunix.sh' "$1"
echo '// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT'
echo
cat <<EOH
package signal
import (
"syscall"
)
var _ = syscall.Syscall // in case there are zero signals
const (
EOH
sed -n 's/^[ ]*\(SIG[A-Z0-9][A-Z0-9]*\).*/ \1 = UnixSignal(syscall.\1)/p' "$1"
echo ")"
......@@ -13,7 +13,7 @@ func TestSignal(t *testing.T) {
// Send this process a SIGHUP.
syscall.Syscall(syscall.SYS_KILL, uintptr(syscall.Getpid()), syscall.SIGHUP, 0)
if sig := (<-Incoming).(UnixSignal); sig != 1 {
t.Errorf("signal was %v, want %v", sig, 1)
if sig := (<-Incoming).(UnixSignal); sig != SIGHUP {
t.Errorf("signal was %v, want %v", sig, SIGHUP)
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment