Source file
src/os/stat_aix.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 = int64(fs.sys.Size)
16 fs.modTime = stTimespecToTime(fs.sys.Mtim)
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 func stTimespecToTime(ts syscall.StTimespec_t) time.Time {
46 return time.Unix(int64(ts.Sec), int64(ts.Nsec))
47 }
48
49
50 func atime(fi FileInfo) time.Time {
51 return stTimespecToTime(fi.Sys().(*syscall.Stat_t).Atim)
52 }
53
View as plain text