...
Source file
src/os/stat_wasip1.go
Documentation: os
1
2
3
4
5
6
7 package os
8
9 import (
10 "syscall"
11 "time"
12 )
13
14 func fillFileStatFromSys(fs *fileStat, name string) {
15 fs.name = basename(name)
16 fs.size = int64(fs.sys.Size)
17 fs.mode = FileMode(fs.sys.Mode)
18 fs.modTime = time.Unix(0, int64(fs.sys.Mtime))
19
20 switch fs.sys.Filetype {
21 case syscall.FILETYPE_BLOCK_DEVICE:
22 fs.mode |= ModeDevice
23 case syscall.FILETYPE_CHARACTER_DEVICE:
24 fs.mode |= ModeDevice | ModeCharDevice
25 case syscall.FILETYPE_DIRECTORY:
26 fs.mode |= ModeDir
27 case syscall.FILETYPE_SOCKET_DGRAM:
28 fs.mode |= ModeSocket
29 case syscall.FILETYPE_SOCKET_STREAM:
30 fs.mode |= ModeSocket
31 case syscall.FILETYPE_SYMBOLIC_LINK:
32 fs.mode |= ModeSymlink
33 }
34 }
35
36
37 func atime(fi FileInfo) time.Time {
38 st := fi.Sys().(*syscall.Stat_t)
39 return time.Unix(0, int64(st.Atime))
40 }
41
View as plain text