aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-08-28 00:04:58 +0900
committerOphestra <cat@gensokyo.uk>2025-08-28 00:04:58 +0900
commit0f41d9667133401f48fb54174cb2b120ed7a769c (patch)
treed9e896d1d42e49743ebb29cc3f375e9cf956ffae /internal
parent92f510a6472064f4e4cb47ffb4f81898fc0a62ae (diff)
internal: move sysconf wrapper to app
This should not be used and is not useful in other packages. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal')
-rw-r--r--internal/app/seal_linux.go3
-rw-r--r--internal/app/sysconf.go8
-rw-r--r--internal/sysconf.go8
3 files changed, 9 insertions, 10 deletions
diff --git a/internal/app/seal_linux.go b/internal/app/seal_linux.go
index 1b363178..9572e9f0 100644
--- a/internal/app/seal_linux.go
+++ b/internal/app/seal_linux.go
@@ -20,7 +20,6 @@ import (
"hakurei.app/container"
"hakurei.app/hst"
- "hakurei.app/internal"
"hakurei.app/internal/app/state"
"hakurei.app/internal/hlog"
"hakurei.app/internal/sys"
@@ -187,7 +186,7 @@ func (seal *outcome) finalise(ctx context.Context, sys sys.State, config *hst.Co
if seal.user.username == "" {
seal.user.username = "chronos"
} else if !posixUsername.MatchString(seal.user.username) ||
- len(seal.user.username) >= internal.Sysconf(internal.SC_LOGIN_NAME_MAX) {
+ len(seal.user.username) >= sysconf(_SC_LOGIN_NAME_MAX) {
return hlog.WrapErr(ErrName,
fmt.Sprintf("invalid user name %q", seal.user.username))
}
diff --git a/internal/app/sysconf.go b/internal/app/sysconf.go
new file mode 100644
index 00000000..4c5714a9
--- /dev/null
+++ b/internal/app/sysconf.go
@@ -0,0 +1,8 @@
+package app
+
+//#include <unistd.h>
+import "C"
+
+const _SC_LOGIN_NAME_MAX = C._SC_LOGIN_NAME_MAX
+
+func sysconf(name C.int) int { return int(C.sysconf(name)) }
diff --git a/internal/sysconf.go b/internal/sysconf.go
deleted file mode 100644
index 712dce78..00000000
--- a/internal/sysconf.go
+++ /dev/null
@@ -1,8 +0,0 @@
-package internal
-
-//#include <unistd.h>
-import "C"
-
-const SC_LOGIN_NAME_MAX = C._SC_LOGIN_NAME_MAX
-
-func Sysconf(name C.int) int { return int(C.sysconf(name)) }