Source file src/os/types_unix.go

     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  
     7  package os
     8  
     9  import (
    10  	"syscall"
    11  	"time"
    12  )
    13  
    14  // A fileStat is the implementation of FileInfo returned by Stat and Lstat.
    15  type fileStat struct {
    16  	name    string
    17  	size    int64
    18  	mode    FileMode
    19  	modTime time.Time
    20  	sys     syscall.Stat_t
    21  }
    22  
    23  func (fs *fileStat) Size() int64        { return fs.size }
    24  func (fs *fileStat) Mode() FileMode     { return fs.mode }
    25  func (fs *fileStat) ModTime() time.Time { return fs.modTime }
    26  func (fs *fileStat) Sys() any           { return &fs.sys }
    27  
    28  func sameFile(fs1, fs2 *fileStat) bool {
    29  	return fs1.sys.Dev == fs2.sys.Dev && fs1.sys.Ino == fs2.sys.Ino
    30  }
    31  

View as plain text