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

Commit

Permalink
Merge pull request #156 from osrg/suda/wip
Browse files Browse the repository at this point in the history
Print an error if `sched_setattr` returns EPERM
  • Loading branch information
mitake committed Jun 3, 2016
2 parents 7c76428 + 017b76b commit 4919228
Showing 1 changed file with 8 additions and 3 deletions.
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

0 comments on commit 4919228

Please sign in to comment.