Update c/storage to 9b10041d7b2ef767ce9c42b5862b6c51eeb82214

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
This commit is contained in:
Matthew Heon
2019-06-07 15:11:38 -04:00
parent bcc89e9d08
commit d81fc2e192
18 changed files with 257 additions and 59 deletions

View File

@ -58,3 +58,15 @@ func Stat(path string) (*StatT, error) {
}
return fromStatT(s)
}
// Fstat takes an open file descriptor and returns
// a system.StatT type pertaining to that file.
//
// Throws an error if the file descriptor is invalid
func Fstat(fd int) (*StatT, error) {
s := &syscall.Stat_t{}
if err := syscall.Fstat(fd, s); err != nil {
return nil, err
}
return fromStatT(s)
}