mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-28 18:01:01 -06:00
22 lines
363 B
Go
22 lines
363 B
Go
// +build freebsd
|
|
|
|
package initwd
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"syscall"
|
|
)
|
|
|
|
// lookup the inode of a file on posix systems
|
|
func inode(path string) (uint64, error) {
|
|
stat, err := os.Stat(path)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
if st, ok := stat.Sys().(*syscall.Stat_t); ok {
|
|
return uint64(st.Ino), nil
|
|
}
|
|
return 0, fmt.Errorf("could not determine file inode")
|
|
}
|