internal/app: relocate state initialisation

This is useful for testing.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-10-10 20:12:05 +09:00
parent f6dd9dab6a
commit 24de7c50a0
5 changed files with 19 additions and 24 deletions

View File

@@ -29,6 +29,8 @@ type syscallDispatcher interface {
// just synchronising access is not enough, as this is for test instrumentation.
new(f func(k syscallDispatcher))
// getpid provides [os.Getpid].
getpid() int
// getuid provides [os.Getuid].
getuid() int
// getgid provides [os.Getgid].
@@ -70,6 +72,7 @@ type direct struct{}
func (k direct) new(f func(k syscallDispatcher)) { go f(k) }
func (direct) getpid() int { return os.Getpid() }
func (direct) getuid() int { return os.Getuid() }
func (direct) getgid() int { return os.Getgid() }
func (direct) lookupEnv(key string) (string, bool) { return os.LookupEnv(key) }