types_unix.mx raw
1 //go:build darwin || (linux && !baremetal && !wasm_unknown && !nintendoswitch) || wasip1 || wasip2
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 (
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() interface{} { 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