aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmd
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-03-12 01:20:08 +0900
committerOphestra <cat@gensokyo.uk>2026-03-12 02:15:14 +0900
commit620062cca92b6241c15f96f86a9c6f0f7882ecca (patch)
tree400b5e46d0166d954373483fd948055d6f807cac /cmd
parent196b200d0f19c41730db439c62db9b39e424f21f (diff)
hst: expose scheduling priority
This is useful when limits are configured to allow it. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/hakurei/command.go14
-rw-r--r--cmd/hakurei/command_test.go8
2 files changed, 16 insertions, 6 deletions
diff --git a/cmd/hakurei/command.go b/cmd/hakurei/command.go
index 242e1389..bf638e23 100644
--- a/cmd/hakurei/command.go
+++ b/cmd/hakurei/command.go
@@ -16,6 +16,7 @@ import (
"hakurei.app/command"
"hakurei.app/container/check"
"hakurei.app/container/fhs"
+ "hakurei.app/container/std"
"hakurei.app/hst"
"hakurei.app/internal/dbus"
"hakurei.app/internal/env"
@@ -88,7 +89,9 @@ func buildCommand(ctx context.Context, msg message.Msg, early *earlyHardeningErr
flagGroups command.RepeatableFlag
flagHomeDir string
flagUserName string
- flagSched string
+
+ flagSchedPolicy string
+ flagSchedPriority int
flagPrivateRuntime, flagPrivateTmpdir bool
@@ -178,9 +181,12 @@ func buildCommand(ctx context.Context, msg message.Msg, early *earlyHardeningErr
},
}
- if err := config.SchedPolicy.UnmarshalText([]byte(flagSched)); err != nil {
+ if err := config.SchedPolicy.UnmarshalText(
+ []byte(flagSchedPolicy),
+ ); err != nil {
log.Fatal(err)
}
+ config.SchedPriority = std.Int(flagSchedPriority)
// bind GPU stuff
if et&(hst.EX11|hst.EWayland) != 0 {
@@ -292,8 +298,10 @@ func buildCommand(ctx context.Context, msg message.Msg, early *earlyHardeningErr
"Container home directory").
Flag(&flagUserName, "u", command.StringFlag("chronos"),
"Passwd user name within sandbox").
- Flag(&flagSched, "sched", command.StringFlag(""),
+ Flag(&flagSchedPolicy, "policy", command.StringFlag(""),
"Scheduling policy to set for the container").
+ Flag(&flagSchedPriority, "priority", command.IntFlag(0),
+ "Scheduling priority to set for the container").
Flag(&flagPrivateRuntime, "private-runtime", command.BoolFlag(false),
"Do not share XDG_RUNTIME_DIR between containers under the same identity").
Flag(&flagPrivateTmpdir, "private-tmpdir", command.BoolFlag(false),
diff --git a/cmd/hakurei/command_test.go b/cmd/hakurei/command_test.go
index 8b5ae638..67c80697 100644
--- a/cmd/hakurei/command_test.go
+++ b/cmd/hakurei/command_test.go
@@ -36,7 +36,7 @@ Commands:
},
{
"run", []string{"run", "-h"}, `
-Usage: hakurei run [-h | --help] [--dbus-config <value>] [--dbus-system <value>] [--mpris] [--dbus-log] [--id <value>] [-a <int>] [-g <value>] [-d <value>] [-u <value>] [--sched <value>] [--private-runtime] [--private-tmpdir] [--wayland] [-X] [--dbus] [--pipewire] [--pulse] COMMAND [OPTIONS]
+Usage: hakurei run [-h | --help] [--dbus-config <value>] [--dbus-system <value>] [--mpris] [--dbus-log] [--id <value>] [-a <int>] [-g <value>] [-d <value>] [-u <value>] [--policy <value>] [--priority <int>] [--private-runtime] [--private-tmpdir] [--wayland] [-X] [--dbus] [--pipewire] [--pulse] COMMAND [OPTIONS]
Flags:
-X Enable direct connection to X11
@@ -60,14 +60,16 @@ Flags:
Allow owning MPRIS D-Bus path, has no effect if custom config is available
-pipewire
Enable connection to PipeWire via SecurityContext
+ -policy string
+ Scheduling policy to set for the container
+ -priority int
+ Scheduling priority to set for the container
-private-runtime
Do not share XDG_RUNTIME_DIR between containers under the same identity
-private-tmpdir
Do not share TMPDIR between containers under the same identity
-pulse
Enable PulseAudio compatibility daemon
- -sched string
- Scheduling policy to set for the container
-u string
Passwd user name within sandbox (default "chronos")
-wayland