github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/src/os/types_anyos.go (about)

     1  //go:build !baremetal && !js
     2  
     3  // Copyright 2009 The Go Authors. All rights reserved.
     4  // Use of this source code is governed by a BSD-style
     5  // license that can be found in the LICENSE file.
     6  
     7  package os
     8  
     9  import "syscall"
    10  
    11  // Getpagesize returns the underlying system's memory page size.
    12  func Getpagesize() int { return syscall.Getpagesize() }
    13  
    14  func (fs *fileStat) Name() string { return fs.name }
    15  func (fs *fileStat) IsDir() bool  { return fs.Mode().IsDir() }
    16  
    17  // SameFile reports whether fi1 and fi2 describe the same file.
    18  // For example, on Unix this means that the device and inode fields
    19  // of the two underlying structures are identical; on other systems
    20  // the decision may be based on the path names.
    21  // SameFile only applies to results returned by this package's Stat.
    22  // It returns false in other cases.
    23  func SameFile(fi1, fi2 FileInfo) bool {
    24  	fs1, ok1 := fi1.(*fileStat)
    25  	fs2, ok2 := fi2.(*fileStat)
    26  	if !ok1 || !ok2 {
    27  		return false
    28  	}
    29  	return sameFile(fs1, fs2)
    30  }