-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcow_linux_runtime_linux.go
More file actions
40 lines (36 loc) · 1.08 KB
/
Copy pathcow_linux_runtime_linux.go
File metadata and controls
40 lines (36 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//go:build linux
package isobox
import (
"errors"
"fmt"
"os"
"os/exec"
)
func prepareLinuxNamespaceViewRuntime(_ *fsVirtualizationPlan, plan *Plan, s Spec, view linuxNamespaceView) (*fsVirtualizationRuntime, error) {
if plan == nil || plan.gv == nil {
return nil, fmt.Errorf("isobox: gvisor filesystem scopes require OCI execution")
}
rootfs, mounts, cleanup, err := prepareGvisorOCIFilesystemView(s, view)
if err != nil {
return nil, err
}
plan.gv.Rootfs = rootfs
plan.gv.RootReadonly = true
plan.gv.FSMounts = mounts
return &fsVirtualizationRuntime{Cleanup: cleanup}, nil
}
func linuxPreloadSmokeTest(lib string) error {
const detectStatus = 42
name, args, env := linuxPreloadSmokeCommand(lib, detectStatus)
cmd := exec.Command(name, args...)
cmd.Env = appendEnv(os.Environ(), env)
err := cmd.Run()
var exitErr *exec.ExitError
if errors.As(err, &exitErr) && exitErr.ExitCode() == detectStatus {
return nil
}
if err == nil {
return fmt.Errorf("isobox: preload smoke test exited 0, want %d", detectStatus)
}
return fmt.Errorf("isobox: preload smoke test failed: %w", err)
}