diff options
author | Austin Clements <aclements@csail.mit.edu> | 2009-07-13 19:20:38 -0700 |
---|---|---|
committer | Austin Clements <aclements@csail.mit.edu> | 2009-07-13 19:20:38 -0700 |
commit | face04436a1eb048e31626fba18bb66fb83aa1b5 (patch) | |
tree | 4cc227c9cb4084158167868e457285b062e2f91e /src/pkg/syscall/syscall_linux.go | |
parent | 81d09f0683297aec12e8c6de9c670fd092a95bde (diff) | |
download | golang-face04436a1eb048e31626fba18bb66fb83aa1b5.tar.gz |
Add accessor for SIGTRAP cause in wait status
R=rsc
APPROVED=rsc
DELTA=7 (7 added, 0 deleted, 0 changed)
OCL=31563
CL=31565
Diffstat (limited to 'src/pkg/syscall/syscall_linux.go')
-rw-r--r-- | src/pkg/syscall/syscall_linux.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/pkg/syscall/syscall_linux.go b/src/pkg/syscall/syscall_linux.go index c3ef9162a..65d69e467 100644 --- a/src/pkg/syscall/syscall_linux.go +++ b/src/pkg/syscall/syscall_linux.go @@ -164,6 +164,13 @@ func (w WaitStatus) StopSignal() int { return int(w >> shift) & 0xFF; } +func (w WaitStatus) TrapCause() int { + if w.StopSignal() != SIGTRAP { + return -1; + } + return int(w >> shift) >> 8; +} + //sys wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, errno int) func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, errno int) { var status _C_int; |