github.com/resin-io/docker@v1.13.1/pkg/system/stat_solaris.go (about) 1 // +build solaris 2 3 package system 4 5 import ( 6 "syscall" 7 ) 8 9 // fromStatT creates a system.StatT type from a syscall.Stat_t type 10 func fromStatT(s *syscall.Stat_t) (*StatT, error) { 11 return &StatT{size: s.Size, 12 mode: uint32(s.Mode), 13 uid: s.Uid, 14 gid: s.Gid, 15 rdev: uint64(s.Rdev), 16 mtim: s.Mtim}, nil 17 } 18 19 // FromStatT loads a system.StatT from a syscal.Stat_t. 20 func FromStatT(s *syscall.Stat_t) (*StatT, error) { 21 return fromStatT(s) 22 } 23 24 // Stat takes a path to a file and returns 25 // a system.StatT type pertaining to that file. 26 // 27 // Throws an error if the file does not exist 28 func Stat(path string) (*StatT, error) { 29 s := &syscall.Stat_t{} 30 if err := syscall.Stat(path, s); err != nil { 31 return nil, err 32 } 33 return fromStatT(s) 34 }