Skip to content
This repository has been archived by the owner on Dec 13, 2021. It is now read-only.

Print an error if sched_setattr returns EPERM #156

Merged
merged 1 commit into from
Jun 3, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions nmz/inspector/proc/proc.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package proc
import (
"fmt"
"strconv"
"syscall"
"time"

"github.com/AkihiroSuda/go-linuxsched"
Expand Down Expand Up @@ -155,9 +156,13 @@ func (this *ProcInspector) onAction(action *signal.ProcSetSchedAction) error {
continue
}
if warn := linuxsched.SetAttr(pid, attr); warn != nil {
// this happens frequently, but does not matter.
// so use log.Debugf rather than log.Warnf
log.Debugf("could not apply %#v to %d: %s", attr, pid, warn)
if warn == syscall.EPERM {
log.Errorf("could not apply %#v to %d: %v", attr, pid, warn)
} else {
// this happens frequently, but does not matter.
// so use log.Debugf rather than log.Warnf
log.Debugf("could not apply %#v to %d: %v", attr, pid, warn)
}
}
}
return nil
Expand Down