diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-08-28 00:04:58 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-08-28 00:04:58 +0900 |
| commit | 0f41d9667133401f48fb54174cb2b120ed7a769c (patch) | |
| tree | d9e896d1d42e49743ebb29cc3f375e9cf956ffae /internal/app | |
| parent | 92f510a6472064f4e4cb47ffb4f81898fc0a62ae (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/app')
| -rw-r--r-- | internal/app/seal_linux.go | 3 | ||||
| -rw-r--r-- | internal/app/sysconf.go | 8 |
2 files changed, 9 insertions, 2 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)) } |
