summaryrefslogtreecommitdiffhomepage
path: root/pkg/abi
diff options
context:
space:
mode:
authorMichael Pratt <mpratt@google.com>2018-12-07 16:27:35 -0800
committerShentubot <shentubot@google.com>2018-12-07 16:28:54 -0800
commit42e2e5cae9b035a62bdbf492ad4a1e9d016c5830 (patch)
treeb6310eddeebd511f06442bb626c35074fe31961b /pkg/abi
parent673949048e84aed6cf7d6ccc4e93bfc0c3855c61 (diff)
Format sigaction in strace
Sample: I1206 14:24:56.768520 3700 x:0] [ 1] ioctl_test E rt_sigaction(SIGSEGV, 0x7ee6edb0c590 {Handler: 0x559c6d915cf0, Flags: SA_SIGINFO|SA_RESTORER|SA_ONSTACK|SA_NODEFER, Restorer: 0x2a9901a259a0, Mask: []}, 0x7ee6edb0c630) I1206 14:24:56.768530 3700 x:0] [ 1] ioctl_test X rt_sigaction(SIGSEGV, 0x7ee6edb0c590 {Handler: 0x559c6d915cf0, Flags: SA_SIGINFO|SA_RESTORER|SA_ONSTACK|SA_NODEFER, Restorer: 0x2a9901a259a0, Mask: []}, 0x7ee6edb0c630 {Handler: SIG_DFL, Flags: 0x0, Restorer: 0x0, Mask: []}) = 0x0 (2.701?s) PiperOrigin-RevId: 224596606 Change-Id: I3512493aed99d3d75600249263da46686b1dc0e7
Diffstat (limited to 'pkg/abi')
-rw-r--r--pkg/abi/flag.go5
-rw-r--r--pkg/abi/linux/signal.go19
2 files changed, 15 insertions, 9 deletions
diff --git a/pkg/abi/flag.go b/pkg/abi/flag.go
index ec87c9cee..b48757da8 100644
--- a/pkg/abi/flag.go
+++ b/pkg/abi/flag.go
@@ -43,6 +43,11 @@ func (s FlagSet) Parse(val uint64) string {
flags = append(flags, "0x"+strconv.FormatUint(val, 16))
}
+ if len(flags) == 0 {
+ // Prefer 0 to an empty string.
+ return "0x0"
+ }
+
return strings.Join(flags, "|")
}
diff --git a/pkg/abi/linux/signal.go b/pkg/abi/linux/signal.go
index bf9bce6ed..395f9f31e 100644
--- a/pkg/abi/linux/signal.go
+++ b/pkg/abi/linux/signal.go
@@ -165,15 +165,16 @@ const (
// Signal action flags for rt_sigaction(2), from uapi/asm-generic/signal.h
const (
- SA_NOCLDSTOP = 0x00000001
- SA_NOCLDWAIT = 0x00000002
- SA_SIGINFO = 0x00000004
- SA_ONSTACK = 0x08000000
- SA_RESTART = 0x10000000
- SA_NODEFER = 0x40000000
- SA_RESTARTHAND = 0x80000000
- SA_NOMASK = SA_NODEFER
- SA_ONESHOT = SA_RESTARTHAND
+ SA_NOCLDSTOP = 0x00000001
+ SA_NOCLDWAIT = 0x00000002
+ SA_SIGINFO = 0x00000004
+ SA_RESTORER = 0x04000000
+ SA_ONSTACK = 0x08000000
+ SA_RESTART = 0x10000000
+ SA_NODEFER = 0x40000000
+ SA_RESETHAND = 0x80000000
+ SA_NOMASK = SA_NODEFER
+ SA_ONESHOT = SA_RESETHAND
)
// Signal info types.