mirror of
https://github.com/simon-ding/polaris.git
synced 2026-05-11 13:07:29 +08:00
feat: add goreleaser
This commit is contained in:
25
pkg/utils/linux.go
Normal file
25
pkg/utils/linux.go
Normal file
@@ -0,0 +1,25 @@
|
||||
//go:build linux
|
||||
// +build linux
|
||||
|
||||
package utils
|
||||
|
||||
import (
|
||||
"golang.org/x/sys/unix"
|
||||
"math"
|
||||
"runtime"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
func AvailableSpace(dir string) uint64 {
|
||||
if runtime.GOOS != "linux" {
|
||||
return math.MaxUint64
|
||||
}
|
||||
var stat unix.Statfs_t
|
||||
|
||||
unix.Statfs(dir, &stat)
|
||||
return stat.Bavail * uint64(stat.Bsize)
|
||||
}
|
||||
|
||||
func MaxPermission() {
|
||||
syscall.Umask(0) //max permission 0777
|
||||
}
|
||||
Reference in New Issue
Block a user