2021-12-21 19:32:40 +00:00
|
|
|
|
|
|
|
//go:build freebsd || darwin
|
|
|
|
|
|
|
|
|
2021-12-25 08:55:33 +00:00
|
|
|
package common
|
2021-12-21 19:32:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
import "fmt"
|
|
|
|
import "os"
|
|
|
|
import "syscall"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-12-25 08:55:33 +00:00
|
|
|
func SysStatExtract (_stat os.FileInfo) (_dev uint64, _inode uint64, _size uint64, _timestamp uint64, _error error) {
|
2021-12-21 19:32:40 +00:00
|
|
|
if _stat, _ok := _stat.Sys () .(*syscall.Stat_t); _ok {
|
|
|
|
_dev = uint64 (_stat.Dev)
|
|
|
|
_inode = uint64 (_stat.Ino)
|
|
|
|
_size = uint64 (_stat.Size)
|
|
|
|
_timestamp = (uint64 (_stat.Mtimespec.Sec) * 1000000) + (uint64 (_stat.Mtimespec.Nsec) / 1000)
|
|
|
|
} else {
|
|
|
|
_error = fmt.Errorf ("[7739aed3] failed `stat`-ing`!")
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|