diff options
author | Jamie Liu <jamieliu@google.com> | 2018-08-23 16:31:25 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-08-23 16:32:36 -0700 |
commit | 64403265a04aa0c8be3ebb652a09f6e2d7a84ca7 (patch) | |
tree | 8191f06fca712de5588cd418a70707e9df0f2c25 /pkg/sentry/kernel/task_signals.go | |
parent | e855e9cebc45f5fd7a9583f476c8965fc395a15e (diff) |
Implement POSIX per-process interval timers.
PiperOrigin-RevId: 210021612
Change-Id: If7c161e6fd08cf17942bfb6bc5a8d2c4e271c61e
Diffstat (limited to 'pkg/sentry/kernel/task_signals.go')
-rw-r--r-- | pkg/sentry/kernel/task_signals.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/pkg/sentry/kernel/task_signals.go b/pkg/sentry/kernel/task_signals.go index 62ec530be..4a66bce6b 100644 --- a/pkg/sentry/kernel/task_signals.go +++ b/pkg/sentry/kernel/task_signals.go @@ -396,6 +396,10 @@ func (tg *ThreadGroup) SendTimerSignal(info *arch.SignalInfo, includeSys bool) e } func (t *Task) sendSignalLocked(info *arch.SignalInfo, group bool) error { + return t.sendSignalTimerLocked(info, group, nil) +} + +func (t *Task) sendSignalTimerLocked(info *arch.SignalInfo, group bool, timer *IntervalTimer) error { if t.exitState == TaskExitDead { return syserror.ESRCH } @@ -429,6 +433,9 @@ func (t *Task) sendSignalLocked(info *arch.SignalInfo, group bool) error { ignored := computeAction(sig, t.tg.signalHandlers.actions[sig]) == SignalActionIgnore if linux.SignalSetOf(sig)&t.tr.SignalMask == 0 && ignored && !t.hasTracer() { t.Debugf("Discarding ignored signal %d", sig) + if timer != nil { + timer.signalRejectedLocked() + } return nil } @@ -436,11 +443,14 @@ func (t *Task) sendSignalLocked(info *arch.SignalInfo, group bool) error { if group { q = &t.tg.pendingSignals } - if !q.enqueue(info) { + if !q.enqueue(info, timer) { if sig.IsRealtime() { return syserror.EAGAIN } t.Debugf("Discarding duplicate signal %d", sig) + if timer != nil { + timer.signalRejectedLocked() + } return nil } |