oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1package mac
2
3import (
4 "io/fs"
5 "syscall"
6)
7
8// fileKey names one state of one file: its device and inode, size,
9// modification and change times. The change time moves on any write,
10// chmod or rename, and no process can set it back.
11func fileKey(fi fs.FileInfo) (statKey, bool) {
12 st, ok := fi.Sys().(*syscall.Stat_t)
13 if !ok {
14 return statKey{}, false
15 }
16 return statKey{dev: uint64(st.Dev), ino: uint64(st.Ino), size: st.Size, mtime: st.Mtim.Nano(), ctime: st.Ctim.Nano()}, true
17}
18
19// fileOwner is the uid that owns fi (-1 when unknown).
20func fileOwner(fi fs.FileInfo) int {
21 if st, ok := fi.Sys().(*syscall.Stat_t); ok {
22 return int(st.Uid)
23 }
24 return -1
25}
26