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