aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/app/app.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-02-19 01:10:37 +0900
committerOphestra <cat@gensokyo.uk>2025-02-19 01:10:37 +0900
commit53571f030e86884bc13fe1d3760ac6bf51d2938b (patch)
treefaf32418ba2d8ba98f4254c19e61c40b23b9f88f /internal/app/app.go
parentaa164081e1c2c477059d9e321675c217eb8ebeb6 (diff)
app: embed appSeal in app struct
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/app/app.go')
-rw-r--r--internal/app/app.go19
1 files changed, 9 insertions, 10 deletions
diff --git a/internal/app/app.go b/internal/app/app.go
index aa798af6..9dd082b9 100644
--- a/internal/app/app.go
+++ b/internal/app/app.go
@@ -11,7 +11,7 @@ import (
func New(os sys.State) (fst.App, error) {
a := new(app)
- a.os = os
+ a.sys = os
id := new(fst.ID)
err := fst.NewAppID(id)
@@ -24,13 +24,12 @@ type app struct {
// application unique identifier
id *stringPair[fst.ID]
// operating system interface
- os sys.State
+ sys sys.State
// shim process manager
shim *shim.Shim
- // child process related information
- seal *appSeal
- lock sync.RWMutex
+ mu sync.RWMutex
+ *appSeal
}
func (a *app) ID() fst.ID { return a.id.unwrap() }
@@ -40,18 +39,18 @@ func (a *app) String() string {
return "(invalid app)"
}
- a.lock.RLock()
- defer a.lock.RUnlock()
+ a.mu.RLock()
+ defer a.mu.RUnlock()
if a.shim != nil {
return a.shim.String()
}
- if a.seal != nil {
- if a.seal.sys.user.uid == nil {
+ if a.appSeal != nil {
+ if a.appSeal.sys.user.uid == nil {
return fmt.Sprintf("(sealed app %s with invalid uid)", a.id)
}
- return fmt.Sprintf("(sealed app %s as uid %s)", a.id, a.seal.sys.user.uid)
+ return fmt.Sprintf("(sealed app %s as uid %s)", a.id, a.appSeal.sys.user.uid)
}
return fmt.Sprintf("(unsealed app %s)", a.id)