From: Austin Clements Date: Tue, 14 Jul 2009 02:20:38 +0000 (-0700) Subject: Add accessor for SIGTRAP cause in wait status X-Git-Tag: weekly.2009-11-06~1167 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=da1da8d07e0b0f4fef5fcab537a78ef28c8b6c7a;p=gostls13.git Add accessor for SIGTRAP cause in wait status R=rsc APPROVED=rsc DELTA=7 (7 added, 0 deleted, 0 changed) OCL=31563 CL=31565 --- diff --git a/src/pkg/syscall/syscall_linux.go b/src/pkg/syscall/syscall_linux.go index c3ef9162ae..65d69e467e 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;