sys: un-export runningPrivileged(), remove runningUnprivileged()
These are currently only used inside this package, so we might as well un-export them until we need them elsewhere. Also updated SetOOMScore() to first check for privileged; check for privileged looks to be the "faster" path, and checking it first could (in case of non- privileged) save having to read and parse /proc/self/uid_map. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -37,7 +37,7 @@ func TestSetPositiveOomScoreAdjustment(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSetNegativeOomScoreAdjustmentWhenPrivileged(t *testing.T) {
|
||||
if RunningUnprivileged() {
|
||||
if !runningPrivileged() {
|
||||
t.Skip("Needs to be run as root")
|
||||
return
|
||||
}
|
||||
@@ -51,7 +51,7 @@ func TestSetNegativeOomScoreAdjustmentWhenPrivileged(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSetNegativeOomScoreAdjustmentWhenUnprivilegedHasNoEffect(t *testing.T) {
|
||||
if RunningPrivileged() {
|
||||
if runningPrivileged() {
|
||||
t.Skip("Needs to be run as non-root")
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user