runtime/internal/clite/os: fix stat for macOS
This commit is contained in:
@@ -87,12 +87,6 @@ func Remove(path *c.Char) c.Int
|
||||
//go:linkname Rename C.rename
|
||||
func Rename(oldpath *c.Char, newpath *c.Char) c.Int
|
||||
|
||||
//go:linkname Stat C.stat
|
||||
func Stat(path *c.Char, buf *StatT) c.Int
|
||||
|
||||
//go:linkname Lstat C.lstat
|
||||
func Lstat(path *c.Char, buf *StatT) c.Int
|
||||
|
||||
//go:linkname Truncate C.truncate
|
||||
func Truncate(path *c.Char, length OffT) c.Int
|
||||
|
||||
@@ -285,7 +279,7 @@ func Exit(c.Int)
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// Upon successful completion, the value 0 is returned; otherwise the value -1
|
||||
// Upon successful completion, the value 0 is returned; otherwise the value -1
|
||||
// is returned and the global variable errno is set to indicate the error.
|
||||
//
|
||||
//go:linkname Sysctl C.sysctl
|
||||
|
||||
16
runtime/internal/clite/os/stat.go
Normal file
16
runtime/internal/clite/os/stat.go
Normal file
@@ -0,0 +1,16 @@
|
||||
//go:build !darwin
|
||||
// +build !darwin
|
||||
|
||||
package os
|
||||
|
||||
import (
|
||||
_ "unsafe"
|
||||
|
||||
c "github.com/goplus/llgo/runtime/internal/clite"
|
||||
)
|
||||
|
||||
//go:linkname Stat C.stat
|
||||
func Stat(path *c.Char, buf *StatT) c.Int
|
||||
|
||||
//go:linkname Lstat C.lstat
|
||||
func Lstat(path *c.Char, buf *StatT) c.Int
|
||||
13
runtime/internal/clite/os/stat_darwin.go
Normal file
13
runtime/internal/clite/os/stat_darwin.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package os
|
||||
|
||||
import (
|
||||
_ "unsafe"
|
||||
|
||||
c "github.com/goplus/llgo/runtime/internal/clite"
|
||||
)
|
||||
|
||||
//go:linkname Stat C.stat64
|
||||
func Stat(path *c.Char, buf *StatT) c.Int
|
||||
|
||||
//go:linkname Lstat C.lstat64
|
||||
func Lstat(path *c.Char, buf *StatT) c.Int
|
||||
@@ -35,6 +35,7 @@ func statNolog(name string) (FileInfo, error) {
|
||||
if err != nil {
|
||||
return nil, &PathError{Op: "stat", Path: name, Err: err}
|
||||
}
|
||||
fillFileStatFromSys(&fs, name)
|
||||
return &fs, nil
|
||||
}
|
||||
|
||||
@@ -47,5 +48,6 @@ func lstatNolog(name string) (FileInfo, error) {
|
||||
if err != nil {
|
||||
return nil, &PathError{Op: "lstat", Path: name, Err: err}
|
||||
}
|
||||
fillFileStatFromSys(&fs, name)
|
||||
return &fs, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user