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