1
0
mirror of https://github.com/golang/go synced 2024-11-20 11:04:56 -07:00

freebsd: fix build, maybe

R=r
CC=golang-dev
https://golang.org/cl/909041
This commit is contained in:
Russ Cox 2010-04-09 14:37:53 -07:00
parent 3c3e68ba32
commit 08852ffe80

View File

@ -10,29 +10,29 @@ func isSymlink(stat *syscall.Stat_t) bool {
return stat.Mode&syscall.S_IFMT == syscall.S_IFLNK
}
func dirFromStat(name string, dir *Dir, lstat, stat *syscall.Stat_t) *Dir {
dir.Dev = uint64(stat.Dev)
dir.Ino = uint64(stat.Ino)
dir.Nlink = uint64(stat.Nlink)
dir.Mode = uint32(stat.Mode)
dir.Uid = stat.Uid
dir.Gid = stat.Gid
dir.Rdev = uint64(stat.Rdev)
dir.Size = uint64(stat.Size)
dir.Blksize = uint64(stat.Blksize)
dir.Blocks = uint64(stat.Blocks)
dir.Atime_ns = uint64(syscall.TimespecToNsec(stat.Atimespec))
dir.Mtime_ns = uint64(syscall.TimespecToNsec(stat.Mtimespec))
dir.Ctime_ns = uint64(syscall.TimespecToNsec(stat.Ctimespec))
func fileInfoFromStat(name string, fi *FileInfo, lstat, stat *syscall.Stat_t) *FileInfo {
fi.Dev = uint64(stat.Dev)
fi.Ino = uint64(stat.Ino)
fi.Nlink = uint64(stat.Nlink)
fi.Mode = uint32(stat.Mode)
fi.Uid = stat.Uid
fi.Gid = stat.Gid
fi.Rdev = uint64(stat.Rdev)
fi.Size = uint64(stat.Size)
fi.Blksize = uint64(stat.Blksize)
fi.Blocks = uint64(stat.Blocks)
fi.Atime_ns = uint64(syscall.TimespecToNsec(stat.Atimespec))
fi.Mtime_ns = uint64(syscall.TimespecToNsec(stat.Mtimespec))
fi.Ctime_ns = uint64(syscall.TimespecToNsec(stat.Ctimespec))
for i := len(name) - 1; i >= 0; i-- {
if name[i] == '/' {
name = name[i+1:]
break
}
}
dir.Name = name
fi.Name = name
if isSymlink(lstat) && !isSymlink(stat) {
dir.FollowedSymlink = true
fi.FollowedSymlink = true
}
return dir
return fi
}