github.com/thy00/storage@v1.12.8/lockfile_linux.go (about)

     1  // +build linux solaris
     2  
     3  package storage
     4  
     5  import (
     6  	"time"
     7  
     8  	"golang.org/x/sys/unix"
     9  )
    10  
    11  // TouchedSince indicates if the lock file has been touched since the specified time
    12  func (l *lockfile) TouchedSince(when time.Time) bool {
    13  	st := unix.Stat_t{}
    14  	err := unix.Fstat(int(l.fd), &st)
    15  	if err != nil {
    16  		return true
    17  	}
    18  	touched := time.Unix(st.Mtim.Unix())
    19  	return when.Before(touched)
    20  }