Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
lima-vm
GitHub Repository: lima-vm/lima
Path: blob/master/pkg/osutil/osutil_linux.go
2606 views
1
// SPDX-FileCopyrightText: Copyright The Lima Authors
2
// SPDX-License-Identifier: Apache-2.0
3
4
package osutil
5
6
import (
7
"io/fs"
8
"syscall"
9
)
10
11
// UnixPathMax is the value of UNIX_PATH_MAX.
12
const UnixPathMax = 108
13
14
// Stat is a selection of syscall.Stat_t.
15
type Stat struct {
16
Uid uint32
17
Gid uint32
18
}
19
20
func SysStat(fi fs.FileInfo) (Stat, bool) {
21
stat, ok := fi.Sys().(*syscall.Stat_t)
22
return Stat{Uid: stat.Uid, Gid: stat.Gid}, ok
23
}
24
25
// SigInt is the value of SIGINT.
26
const SigInt = Signal(syscall.SIGINT)
27
28
// SigKill is the value of SIGKILL.
29
const SigKill = Signal(syscall.SIGKILL)
30
31
type Signal syscall.Signal
32
33
func SysKill(pid int, sig Signal) error {
34
return syscall.Kill(pid, syscall.Signal(sig))
35
}
36
37