public inbox for
Atom feed
From: John Goerzen <jgoerzen@complete•org>
To: Sergey Matveev <stargrave@stargrave•org>
Subject: Re: Build error on NetBSD
Date: Wed, 04 Aug 2021 11:02:27 -0500	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On Wed, Aug 04 2021, Sergey Matveev wrote:

>     package main
>     import "syscall"
>     func main() {
>         var s syscall.Statfs_t
>         if err := syscall.Statfs("/", &s); err != nil { 
>         panic(err) }
>         println(int64(s.Bavail) * int64(s.Bsize))
>     }

That fails to compile, in a very similar manner to the NNCP code:

jgoerzen@sverige:~/t$ go build foo.go
# command-line-arguments
./foo.go:5:26: undefined: syscall.Statfs
./foo.go:6:32: s.Bavail undefined (type syscall.Statfs_t has no 
field or method Bavail)
./foo.go:6:50: s.Bsize undefined (type syscall.Statfs_t has no 
field or method Bsize)

NetBSD does have a C statvfs() call, and does not have statfs(). 
According to the Linux statfs(2) manpage, POSIX calls for 
statvfs() and doesn't mention statfs().  I don't know if Go is 
really using statvfs() on some platforms, but from what I could 
see at 
, there is simply no implementation for statfs on NetBSD in Go. 
Compare to, say, 
.  Weird that it seems to not even be using libc here and going 
with a direct syscall interface (!)

I got it to compile and work by just replacing that entire 
function with "return true".  I mean, that's not ideal, but I 
don't see what else you'll be able to do on NetBSD.  It will still 
work, I think, though abort less early if a disk is getting full.


  reply	other threads:[~2021-08-04 16:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-04  3:17 Build error on NetBSD John Goerzen
2021-08-04 15:04 ` Sergey Matveev
2021-08-04 16:02   ` John Goerzen [this message]
2021-08-04 17:58     ` Sergey Matveev