diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-10-19 03:53:20 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-10-19 04:11:38 +0900 |
| commit | 699c19e972a3cbcc714403aedffcb5ff74386cfc (patch) | |
| tree | 4f279d0e917d21dc8e40409691b93bbbf44c7667 /hst/container.go | |
| parent | b5b30aea2eca15b8a0c9e01d6e3d0e844c99890c (diff) | |
hst/container: optional runtime and tmpdir sharing
Sharing and persisting these directories do not always make sense. Make it optional here.
Closes #16.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'hst/container.go')
| -rw-r--r-- | hst/container.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/hst/container.go b/hst/container.go index 94017bf8..617d22db 100644 --- a/hst/container.go +++ b/hst/container.go @@ -63,6 +63,11 @@ const ( // FDevice mount /dev/ from the init mount namespace as-is in the container mount namespace. FDevice + // FShareRuntime shares XDG_RUNTIME_DIR between containers under the same identity. + FShareRuntime + // FShareTmpdir shares TMPDIR between containers under the same identity. + FShareTmpdir + fMax // FAll is [ContainerConfig.Flags] with all currently defined bits set. @@ -133,6 +138,11 @@ type containerConfigJSON = struct { // Corresponds to [FDevice]. Device bool `json:"device,omitempty"` + + // Corresponds to [FShareRuntime]. + ShareRuntime bool `json:"share_runtime,omitempty"` + // Corresponds to [FShareTmpdir] + ShareTmpdir bool `json:"share_tmpdir,omitempty"` } func (c *ContainerConfig) MarshalJSON() ([]byte, error) { @@ -151,6 +161,8 @@ func (c *ContainerConfig) MarshalJSON() ([]byte, error) { Multiarch: c.Flags&FMultiarch != 0, MapRealUID: c.Flags&FMapRealUID != 0, Device: c.Flags&FDevice != 0, + ShareRuntime: c.Flags&FShareRuntime != 0, + ShareTmpdir: c.Flags&FShareTmpdir != 0, }) } @@ -192,5 +204,11 @@ func (c *ContainerConfig) UnmarshalJSON(data []byte) error { if v.Device { c.Flags |= FDevice } + if v.ShareRuntime { + c.Flags |= FShareRuntime + } + if v.ShareTmpdir { + c.Flags |= FShareTmpdir + } return nil } |
