2022-03-28 20:23:47 +00:00
|
|
|
//go:build !windows
|
2020-05-24 17:30:20 +00:00
|
|
|
// +build !windows
|
2015-08-14 13:57:47 +00:00
|
|
|
|
2024-08-26 21:03:25 +00:00
|
|
|
package fs
|
2015-08-14 13:57:47 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"syscall"
|
|
|
|
)
|
|
|
|
|
2021-05-27 19:29:51 +00:00
|
|
|
func lchown(name string, uid, gid int) error {
|
|
|
|
return os.Lchown(name, uid, gid)
|
|
|
|
}
|
2015-08-14 13:57:47 +00:00
|
|
|
|
2020-10-18 21:39:42 +00:00
|
|
|
type statT syscall.Stat_t
|
2015-08-14 13:57:47 +00:00
|
|
|
|
2020-10-18 21:39:42 +00:00
|
|
|
func toStatT(i interface{}) (*statT, bool) {
|
2015-08-14 13:57:47 +00:00
|
|
|
s, ok := i.(*syscall.Stat_t)
|
|
|
|
if ok && s != nil {
|
2020-10-18 21:39:42 +00:00
|
|
|
return (*statT)(s), true
|
2015-08-14 13:57:47 +00:00
|
|
|
}
|
|
|
|
return nil, false
|
|
|
|
}
|
|
|
|
|
2020-10-18 21:39:42 +00:00
|
|
|
func (s statT) dev() uint64 { return uint64(s.Dev) }
|
|
|
|
func (s statT) ino() uint64 { return uint64(s.Ino) }
|
|
|
|
func (s statT) nlink() uint64 { return uint64(s.Nlink) }
|
|
|
|
func (s statT) uid() uint32 { return uint32(s.Uid) }
|
|
|
|
func (s statT) gid() uint32 { return uint32(s.Gid) }
|
|
|
|
func (s statT) rdev() uint64 { return uint64(s.Rdev) }
|
|
|
|
func (s statT) size() int64 { return int64(s.Size) }
|