Source file
src/os/stat_unix.go
1
2
3
4
5
6
7 package os
8
9 import (
10 "syscall"
11 )
12
13
14
15 func (f *File) Stat() (FileInfo, error) {
16 if f == nil {
17 return nil, ErrInvalid
18 }
19 var fs fileStat
20 err := f.pfd.Fstat(&fs.sys)
21 if err != nil {
22 return nil, &PathError{Op: "stat", Path: f.name, Err: err}
23 }
24 fillFileStatFromSys(&fs, f.name)
25 return &fs, nil
26 }
27
28
29 func statNolog(name string) (FileInfo, error) {
30 var fs fileStat
31 err := ignoringEINTR(func() error {
32 return syscall.Stat(name, &fs.sys)
33 })
34 if err != nil {
35 return nil, &PathError{Op: "stat", Path: name, Err: err}
36 }
37 fillFileStatFromSys(&fs, name)
38 return &fs, nil
39 }
40
41
42 func lstatNolog(name string) (FileInfo, error) {
43 var fs fileStat
44 err := ignoringEINTR(func() error {
45 return syscall.Lstat(name, &fs.sys)
46 })
47 if err != nil {
48 return nil, &PathError{Op: "lstat", Path: name, Err: err}
49 }
50 fillFileStatFromSys(&fs, name)
51 return &fs, nil
52 }
53
View as plain text