2021-08-23 13:14:53 +00:00
|
|
|
//go:build !windows
|
2014-11-13 20:00:04 +00:00
|
|
|
// +build !windows
|
|
|
|
|
2018-02-05 21:05:59 +00:00
|
|
|
package system // import "github.com/docker/docker/pkg/system"
|
2014-11-13 20:00:04 +00:00
|
|
|
|
2017-05-23 14:22:32 +00:00
|
|
|
import (
|
2018-10-23 00:17:51 +00:00
|
|
|
"os"
|
2017-05-23 14:22:32 +00:00
|
|
|
"syscall"
|
|
|
|
)
|
2014-11-13 20:00:04 +00:00
|
|
|
|
2015-03-31 08:03:31 +00:00
|
|
|
// Lstat takes a path to a file and returns
|
2015-07-28 16:13:12 +00:00
|
|
|
// a system.StatT type pertaining to that file.
|
2015-03-31 08:03:31 +00:00
|
|
|
//
|
|
|
|
// Throws an error if the file does not exist
|
2015-07-28 16:13:12 +00:00
|
|
|
func Lstat(path string) (*StatT, error) {
|
2014-11-13 20:00:04 +00:00
|
|
|
s := &syscall.Stat_t{}
|
2015-04-26 16:50:25 +00:00
|
|
|
if err := syscall.Lstat(path, s); err != nil {
|
2018-12-19 22:57:06 +00:00
|
|
|
return nil, &os.PathError{Op: "Lstat", Path: path, Err: err}
|
2014-11-13 20:00:04 +00:00
|
|
|
}
|
2014-11-13 20:36:05 +00:00
|
|
|
return fromStatT(s)
|
2014-11-13 20:00:04 +00:00
|
|
|
}
|