Initial commit
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
//go:build unix
|
||||
|
||||
package server
|
||||
|
||||
import "syscall"
|
||||
|
||||
// freeBytes reports the space available to an unprivileged writer on the
|
||||
// filesystem holding path.
|
||||
func freeBytes(path string) (int64, bool) {
|
||||
var st syscall.Statfs_t
|
||||
if err := syscall.Statfs(path, &st); err != nil {
|
||||
return 0, false
|
||||
}
|
||||
return int64(st.Bavail) * int64(st.Bsize), true
|
||||
}
|
||||
Reference in New Issue
Block a user