Add some documentation to pkg/system
Partially addresses #11581 Signed-off-by: Ankush Agarwal <ankushagarwal11@gmail.com>
This commit is contained in:
parent
dce6f8ba76
commit
eea8abd59e
10 changed files with 24 additions and 2 deletions
|
@ -4,6 +4,7 @@ import (
|
|||
"syscall"
|
||||
)
|
||||
|
||||
// fromStatT converts a syscall.Stat_t type to a system.Stat_t type
|
||||
func fromStatT(s *syscall.Stat_t) (*Stat_t, error) {
|
||||
return &Stat_t{size: s.Size,
|
||||
mode: s.Mode,
|
||||
|
@ -13,6 +14,10 @@ func fromStatT(s *syscall.Stat_t) (*Stat_t, error) {
|
|||
mtim: s.Mtim}, nil
|
||||
}
|
||||
|
||||
// Stat takes a path to a file and returns
|
||||
// a system.Stat_t type pertaining to that file.
|
||||
//
|
||||
// Throws an error if the file does not exist
|
||||
func Stat(path string) (*Stat_t, error) {
|
||||
s := &syscall.Stat_t{}
|
||||
err := syscall.Stat(path, s)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue