Source File
stat_linux.go
Belonging Package
os
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package os
import (
)
func ( *fileStat, string) {
.name = basename()
.size = .sys.Size
.modTime = time.Unix(.sys.Mtim.Unix())
.mode = FileMode(.sys.Mode & 0777)
switch .sys.Mode & syscall.S_IFMT {
case syscall.S_IFBLK:
.mode |= ModeDevice
case syscall.S_IFCHR:
.mode |= ModeDevice | ModeCharDevice
case syscall.S_IFDIR:
.mode |= ModeDir
case syscall.S_IFIFO:
.mode |= ModeNamedPipe
case syscall.S_IFLNK:
.mode |= ModeSymlink
case syscall.S_IFREG:
// nothing to do
case syscall.S_IFSOCK:
.mode |= ModeSocket
}
if .sys.Mode&syscall.S_ISGID != 0 {
.mode |= ModeSetgid
}
if .sys.Mode&syscall.S_ISUID != 0 {
.mode |= ModeSetuid
}
if .sys.Mode&syscall.S_ISVTX != 0 {
.mode |= ModeSticky
}
}
// For testing.
func ( FileInfo) time.Time {
return time.Unix(.Sys().(*syscall.Stat_t).Atim.Unix())
}
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |