MCPcopy Index your code
hub / github.com/coder/envbox / SetOOMScore

Function SetOOMScore

xunix/proc.go:11–23  ·  view source on GitHub ↗
(ctx context.Context, pid, score string)

Source from the content-addressed store, hash-verified

9)
10
11func SetOOMScore(ctx context.Context, pid, score string) error {
12 var (
13 fs = GetFS(ctx)
14 file = fmt.Sprintf("/proc/%v/oom_score_adj", pid)
15 )
16
17 err := afero.WriteFile(fs, file, []byte(score), 0o644)
18 if err != nil {
19 return xerrors.Errorf("write file: %w", err)
20 }
21
22 return nil
23}

Callers 2

runDockerCVMFunction · 0.92
TestSetOOMScoreFunction · 0.92

Calls 2

GetFSFunction · 0.85
ErrorfMethod · 0.65

Tested by 1

TestSetOOMScoreFunction · 0.74