os, syscall: add Statfs/Fstatfs stubs and Getpagesize for non-hosted targets

This commit is contained in:
v1rtl
2026-08-15 11:50:51 +03:00
committed by Damian Gryski
parent 80506a9cea
commit d74f70bdd0
3 changed files with 45 additions and 5 deletions
+6
View File
@@ -0,0 +1,6 @@
package os
import "syscall"
// Getpagesize returns the underlying system's memory page size.
func Getpagesize() int { return syscall.Getpagesize() }
-5
View File
@@ -6,11 +6,6 @@
package os package os
import "syscall"
// Getpagesize returns the underlying system's memory page size.
func Getpagesize() int { return syscall.Getpagesize() }
func (fs *fileStat) Name() string { return fs.name } func (fs *fileStat) Name() string { return fs.name }
func (fs *fileStat) IsDir() bool { return fs.Mode().IsDir() } func (fs *fileStat) IsDir() bool { return fs.Mode().IsDir() }
+39
View File
@@ -0,0 +1,39 @@
//go:build baremetal || js || wasip1 || wasip2 || wasm_unknown || nintendoswitch
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package syscall
// Statfs_t and Fsid have been copied from the Go source tree
// (syscall/ztypes_linux_amd64.go).
type Statfs_t struct {
Type int64
Bsize int64
Blocks uint64
Bfree uint64
Bavail uint64
Files uint64
Ffree uint64
Fsid Fsid
Namelen int64
Frsize int64
Flags int64
Spare [4]int64
}
type Fsid struct {
X__val [2]int32
}
// This is a stub, it is not functional.
func Statfs(path string, buf *Statfs_t) (err error) {
return ENOSYS
}
// This is a stub, it is not functional.
func Fstatfs(fd int, buf *Statfs_t) (err error) {
return ENOSYS
}