Black Lives Matter. Support the Equal Justice Initiative.

Source file src/os/types_unix.go

Documentation: os

     1  // Copyright 2009 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  //go:build !windows && !plan9
     6  // +build !windows,!plan9
     7  
     8  package os
     9  
    10  import (
    11  	"syscall"
    12  	"time"
    13  )
    14  
    15  // A fileStat is the implementation of FileInfo returned by Stat and Lstat.
    16  type fileStat struct {
    17  	name    string
    18  	size    int64
    19  	mode    FileMode
    20  	modTime time.Time
    21  	sys     syscall.Stat_t
    22  }
    23  
    24  func (fs *fileStat) Size() int64        { return fs.size }
    25  func (fs *fileStat) Mode() FileMode     { return fs.mode }
    26  func (fs *fileStat) ModTime() time.Time { return fs.modTime }
    27  func (fs *fileStat) Sys() interface{}   { return &fs.sys }
    28  
    29  func sameFile(fs1, fs2 *fileStat) bool {
    30  	return fs1.sys.Dev == fs2.sys.Dev && fs1.sys.Ino == fs2.sys.Ino
    31  }
    32  

View as plain text