]> Cypherpunks.ru repositories - nncp.git/blob - src/df_openbsd.go
OpenBSD compatible IsEnoughSpace()
[nncp.git] / src / df_openbsd.go
1 //go:build openbsd
2 // +build openbsd
3
4 package nncp
5
6 import (
7         "log"
8
9         "golang.org/x/sys/unix"
10 )
11
12 func (ctx *Ctx) IsEnoughSpace(want int64) bool {
13         var s unix.Statfs_t
14         if err := unix.Statfs(ctx.Spool, &s); err != nil {
15                 log.Fatalln("Can not stat spool:", err)
16         }
17         return int64(s.F_bavail)*int64(s.F_bsize) > want
18 }