// 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())
}