mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
[op] Move SignalStack to abi/linux package.
Updates #214 PiperOrigin-RevId: 378594929
This commit is contained in:
@@ -79,6 +79,7 @@ go_library(
|
||||
"//pkg/abi",
|
||||
"//pkg/bits",
|
||||
"//pkg/context",
|
||||
"//pkg/hostarch",
|
||||
"//pkg/marshal",
|
||||
"//pkg/marshal/primitive",
|
||||
],
|
||||
|
||||
+35
-1
@@ -16,6 +16,7 @@ package linux
|
||||
|
||||
import (
|
||||
"gvisor.dev/gvisor/pkg/bits"
|
||||
"gvisor.dev/gvisor/pkg/hostarch"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -165,7 +166,7 @@ const (
|
||||
SIG_IGN = 1
|
||||
)
|
||||
|
||||
// Signal action flags for rt_sigaction(2), from uapi/asm-generic/signal.h
|
||||
// Signal action flags for rt_sigaction(2), from uapi/asm-generic/signal.h.
|
||||
const (
|
||||
SA_NOCLDSTOP = 0x00000001
|
||||
SA_NOCLDWAIT = 0x00000002
|
||||
@@ -179,6 +180,12 @@ const (
|
||||
SA_ONESHOT = SA_RESETHAND
|
||||
)
|
||||
|
||||
// Signal stack flags for signalstack(2), from include/uapi/linux/signal.h.
|
||||
const (
|
||||
SS_ONSTACK = 1
|
||||
SS_DISABLE = 2
|
||||
)
|
||||
|
||||
// Signal info types.
|
||||
const (
|
||||
SI_MASK = 0xffff0000
|
||||
@@ -242,6 +249,33 @@ type SigAction struct {
|
||||
|
||||
// LINT.ThenChange(../../safecopy/safecopy_unsafe.go)
|
||||
|
||||
// SignalStack represents information about a user stack, and is equivalent to
|
||||
// stack_t.
|
||||
//
|
||||
// +marshal
|
||||
// +stateify savable
|
||||
type SignalStack struct {
|
||||
Addr uint64
|
||||
Flags uint32
|
||||
_ uint32
|
||||
Size uint64
|
||||
}
|
||||
|
||||
// Contains checks if the stack pointer is within this stack.
|
||||
func (s *SignalStack) Contains(sp hostarch.Addr) bool {
|
||||
return hostarch.Addr(s.Addr) < sp && sp <= hostarch.Addr(s.Addr+s.Size)
|
||||
}
|
||||
|
||||
// Top returns the stack's top address.
|
||||
func (s *SignalStack) Top() hostarch.Addr {
|
||||
return hostarch.Addr(s.Addr + s.Size)
|
||||
}
|
||||
|
||||
// IsEnabled returns true iff this signal stack is marked as enabled.
|
||||
func (s *SignalStack) IsEnabled() bool {
|
||||
return s.Flags&SS_DISABLE == 0
|
||||
}
|
||||
|
||||
// Possible values for Sigevent.Notify, aka struct sigevent::sigev_notify.
|
||||
const (
|
||||
SIGEV_SIGNAL = 0
|
||||
|
||||
Reference in New Issue
Block a user