make docker compile on freebsd

Signed-off-by: Alexey Guskov <lexag@mail.ru>
This commit is contained in:
Alexey Guskov 2015-07-29 21:25:56 +03:00
parent 0dc55c7057
commit 4e30080c64
8 changed files with 79 additions and 4 deletions

27
system/stat_freebsd.go Normal file
View file

@ -0,0 +1,27 @@
package system
import (
"syscall"
)
// fromStatT converts a syscall.Stat_t type to a system.Stat_t type
func fromStatT(s *syscall.Stat_t) (*Stat_t, error) {
return &Stat_t{size: s.Size,
mode: uint32(s.Mode),
uid: s.Uid,
gid: s.Gid,
rdev: uint64(s.Rdev),
mtim: s.Mtimespec}, nil
}
// Stat takes a path to a file and returns
// a system.Stat_t type pertaining to that file.
//
// Throws an error if the file does not exist
func Stat(path string) (*Stat_t, error) {
s := &syscall.Stat_t{}
if err := syscall.Stat(path, s); err != nil {
return nil, err
}
return fromStatT(s)
}