Source file
src/os/stat_openbsd.go
1
2
3
4
5 package os
6
7 import (
8 "internal/filepathlite"
9 "syscall"
10 "time"
11 )
12
13 func fillFileStatFromSys(fs *fileStat, name string) {
14 fs.name = filepathlite.Base(name)
15 fs.size = fs.sys.Size
16 fs.modTime = time.Unix(fs.sys.Mtim.Unix())
17 fs.mode = FileMode(fs.sys.Mode & 0777)
18 switch fs.sys.Mode & syscall.S_IFMT {
19 case syscall.S_IFBLK:
20 fs.mode |= ModeDevice
21 case syscall.S_IFCHR:
22 fs.mode |= ModeDevice | ModeCharDevice
23 case syscall.S_IFDIR:
24 fs.mode |= ModeDir
25 case syscall.S_IFIFO:
26 fs.mode |= ModeNamedPipe
27 case syscall.S_IFLNK:
28 fs.mode |= ModeSymlink
29 case syscall.S_IFREG:
30
31 case syscall.S_IFSOCK:
32 fs.mode |= ModeSocket
33 }
34 if fs.sys.Mode&syscall.S_ISGID != 0 {
35 fs.mode |= ModeSetgid
36 }
37 if fs.sys.Mode&syscall.S_ISUID != 0 {
38 fs.mode |= ModeSetuid
39 }
40 if fs.sys.Mode&syscall.S_ISVTX != 0 {
41 fs.mode |= ModeSticky
42 }
43 }
44
45
46 func atime(fi FileInfo) time.Time {
47 return time.Unix(fi.Sys().(*syscall.Stat_t).Atim.Unix())
48 }
49
View as plain text