2014-02-21 09:12:25 +00:00
|
|
|
package system
|
|
|
|
|
|
|
|
import (
|
|
|
|
"syscall"
|
|
|
|
)
|
|
|
|
|
2015-03-11 15:42:49 +00:00
|
|
|
func fromStatT(s *syscall.Stat_t) (*Stat_t, error) {
|
|
|
|
return &Stat_t{size: s.Size,
|
2014-11-13 20:36:05 +00:00
|
|
|
mode: s.Mode,
|
|
|
|
uid: s.Uid,
|
|
|
|
gid: s.Gid,
|
|
|
|
rdev: s.Rdev,
|
|
|
|
mtim: s.Mtim}, nil
|
2014-02-21 09:12:25 +00:00
|
|
|
}
|
2015-03-11 15:42:49 +00:00
|
|
|
|
|
|
|
func Stat(path string) (*Stat_t, error) {
|
|
|
|
s := &syscall.Stat_t{}
|
|
|
|
err := syscall.Stat(path, s)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return fromStatT(s)
|
|
|
|
}
|