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