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