Use k8s.io/utils/inotify and resolved godep conflicts (#2269)
Use k8s.io/utils/inotify and resolved godep conflicts Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>
This commit is contained in:
parent
83240cc997
commit
daa036418b
41
Godeps/Godeps.json
generated
41
Godeps/Godeps.json
generated
@ -487,6 +487,21 @@
|
||||
"ImportPath": "github.com/karrick/godirwalk",
|
||||
"Rev": "2de2192f9e35ce981c152a873ed943b93b79ced4"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/karrick/godirwalk/examples/clean-empties",
|
||||
"Comment": "v1.7.5",
|
||||
"Rev": "2de2192f9e35ce981c152a873ed943b93b79ced4"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/karrick/godirwalk/examples/walk-fast",
|
||||
"Comment": "v1.7.5",
|
||||
"Rev": "2de2192f9e35ce981c152a873ed943b93b79ced4"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/karrick/godirwalk/examples/walk-stdlib",
|
||||
"Comment": "v1.7.5",
|
||||
"Rev": "2de2192f9e35ce981c152a873ed943b93b79ced4"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/klauspost/crc32",
|
||||
"Rev": "a3b15ae34567abb20a22992b989cd76f48d09c47"
|
||||
@ -729,6 +744,11 @@
|
||||
"Comment": "v0.9.1",
|
||||
"Rev": "abad2d1bd44235a26707c172eab6bca5bf2dbad3"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/prometheus/client_golang/prometheus/internal",
|
||||
"Comment": "v0.9.1",
|
||||
"Rev": "abad2d1bd44235a26707c172eab6bca5bf2dbad3"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/prometheus/client_golang/prometheus/promhttp",
|
||||
"Comment": "v0.9.1",
|
||||
@ -763,10 +783,6 @@
|
||||
"ImportPath": "github.com/seccomp/libseccomp-golang",
|
||||
"Rev": "1b506fc7c24eec5a3693cdcbed40d9c226cfc6a1"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/sigma/go-inotify",
|
||||
"Rev": "c87b6cf5033d2c6486046f045eeebdc3d910fd38"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/sirupsen/logrus",
|
||||
"Comment": "v1.0.3-11-g89742ae",
|
||||
@ -863,13 +879,17 @@
|
||||
"ImportPath": "golang.org/x/sys/unix",
|
||||
"Rev": "a5b02f93d862f065920dd6a40dddc66b60d0dec4"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/sys/unix/linux",
|
||||
"Rev": "a5b02f93d862f065920dd6a40dddc66b60d0dec4"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/sys/windows",
|
||||
"Rev": "95c6576299259db960f6c5b9b69ea52422860fce"
|
||||
"Rev": "a5b02f93d862f065920dd6a40dddc66b60d0dec4"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/sys/windows/registry",
|
||||
"Rev": "95c6576299259db960f6c5b9b69ea52422860fce"
|
||||
"Rev": "a5b02f93d862f065920dd6a40dddc66b60d0dec4"
|
||||
},
|
||||
{
|
||||
"ImportPath": "golang.org/x/text/secure/bidirule",
|
||||
@ -1004,16 +1024,15 @@
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/utils/clock",
|
||||
"Rev": "aedf551cdb8b0119df3a19c65fde413a13b34997"
|
||||
"Rev": "3dccf664f023863740c508fb4284e49742bedfa4"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/utils/clock/testing",
|
||||
"Rev": "aedf551cdb8b0119df3a19c65fde413a13b34997"
|
||||
"Rev": "3dccf664f023863740c508fb4284e49742bedfa4"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/prometheus/client_golang/prometheus/internal",
|
||||
"Comment": "v0.9.1",
|
||||
"Rev": "abad2d1bd44235a26707c172eab6bca5bf2dbad3"
|
||||
"ImportPath": "k8s.io/utils/inotify",
|
||||
"Rev": "3dccf664f023863740c508fb4284e49742bedfa4"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ package common
|
||||
import (
|
||||
"sync"
|
||||
|
||||
inotify "github.com/sigma/go-inotify"
|
||||
inotify "k8s.io/utils/inotify"
|
||||
)
|
||||
|
||||
// Watcher for container-related inotify events in the cgroup hierarchy.
|
||||
@ -55,7 +55,7 @@ func (iw *InotifyWatcher) AddWatch(containerName, dir string) (bool, error) {
|
||||
|
||||
// Register an inotify notification.
|
||||
if !cgroupsWatched[dir] {
|
||||
err := iw.watcher.AddWatch(dir, inotify.IN_CREATE|inotify.IN_DELETE|inotify.IN_MOVE)
|
||||
err := iw.watcher.AddWatch(dir, inotify.InCreate|inotify.InDelete|inotify.InMove)
|
||||
if err != nil {
|
||||
return alreadyWatched, err
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ import (
|
||||
"github.com/google/cadvisor/container/common"
|
||||
"github.com/google/cadvisor/container/libcontainer"
|
||||
"github.com/google/cadvisor/watcher"
|
||||
inotify "github.com/sigma/go-inotify"
|
||||
inotify "k8s.io/utils/inotify"
|
||||
|
||||
"k8s.io/klog"
|
||||
)
|
||||
@ -172,13 +172,13 @@ func (self *rawContainerWatcher) processEvent(event *inotify.Event, events chan
|
||||
// Convert the inotify event type to a container create or delete.
|
||||
var eventType watcher.ContainerEventType
|
||||
switch {
|
||||
case (event.Mask & inotify.IN_CREATE) > 0:
|
||||
case (event.Mask & inotify.InCreate) > 0:
|
||||
eventType = watcher.ContainerAdd
|
||||
case (event.Mask & inotify.IN_DELETE) > 0:
|
||||
case (event.Mask & inotify.InDelete) > 0:
|
||||
eventType = watcher.ContainerDelete
|
||||
case (event.Mask & inotify.IN_MOVED_FROM) > 0:
|
||||
case (event.Mask & inotify.InMovedFrom) > 0:
|
||||
eventType = watcher.ContainerDelete
|
||||
case (event.Mask & inotify.IN_MOVED_TO) > 0:
|
||||
case (event.Mask & inotify.InMovedTo) > 0:
|
||||
eventType = watcher.ContainerAdd
|
||||
default:
|
||||
// Ignore other events.
|
||||
|
@ -24,8 +24,8 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
inotify "github.com/sigma/go-inotify"
|
||||
"k8s.io/klog"
|
||||
inotify "k8s.io/utils/inotify"
|
||||
)
|
||||
|
||||
type Tail struct {
|
||||
@ -141,7 +141,7 @@ func (t *Tail) watchFile() error {
|
||||
defer t.file.Close()
|
||||
|
||||
watchDir := filepath.Dir(t.filename)
|
||||
err = t.watcher.AddWatch(watchDir, inotify.IN_MOVED_FROM|inotify.IN_DELETE)
|
||||
err = t.watcher.AddWatch(watchDir, inotify.InMovedFrom|inotify.InDelete)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to add watch to directory %s: %v", watchDir, err)
|
||||
}
|
||||
|
5
vendor/k8s.io/utils/clock/clock.go
generated
vendored
5
vendor/k8s.io/utils/clock/clock.go
generated
vendored
@ -44,21 +44,24 @@ func (RealClock) Since(ts time.Time) time.Duration {
|
||||
return time.Since(ts)
|
||||
}
|
||||
|
||||
// Same as time.After(d).
|
||||
// After is the same as time.After(d).
|
||||
func (RealClock) After(d time.Duration) <-chan time.Time {
|
||||
return time.After(d)
|
||||
}
|
||||
|
||||
// NewTimer is the same as time.NewTimer(d)
|
||||
func (RealClock) NewTimer(d time.Duration) Timer {
|
||||
return &realTimer{
|
||||
timer: time.NewTimer(d),
|
||||
}
|
||||
}
|
||||
|
||||
// Tick is the same as time.Tick(d)
|
||||
func (RealClock) Tick(d time.Duration) <-chan time.Time {
|
||||
return time.Tick(d)
|
||||
}
|
||||
|
||||
// Sleep is the same as time.Sleep(d)
|
||||
func (RealClock) Sleep(d time.Duration) {
|
||||
time.Sleep(d)
|
||||
}
|
||||
|
56
vendor/k8s.io/utils/clock/testing/fake_clock.go
generated
vendored
56
vendor/k8s.io/utils/clock/testing/fake_clock.go
generated
vendored
@ -34,7 +34,7 @@ type FakeClock struct {
|
||||
time time.Time
|
||||
|
||||
// waiters are waiting for the fake time to pass their specified time
|
||||
waiters []fakeClockWaiter
|
||||
waiters []*fakeClockWaiter
|
||||
}
|
||||
|
||||
type fakeClockWaiter struct {
|
||||
@ -45,6 +45,7 @@ type fakeClockWaiter struct {
|
||||
fired bool
|
||||
}
|
||||
|
||||
// NewFakeClock constructs a fake clock set to the provided time.
|
||||
func NewFakeClock(t time.Time) *FakeClock {
|
||||
return &FakeClock{
|
||||
time: t,
|
||||
@ -65,20 +66,20 @@ func (f *FakeClock) Since(ts time.Time) time.Duration {
|
||||
return f.time.Sub(ts)
|
||||
}
|
||||
|
||||
// Fake version of time.After(d).
|
||||
// After is the fake version of time.After(d).
|
||||
func (f *FakeClock) After(d time.Duration) <-chan time.Time {
|
||||
f.lock.Lock()
|
||||
defer f.lock.Unlock()
|
||||
stopTime := f.time.Add(d)
|
||||
ch := make(chan time.Time, 1) // Don't block!
|
||||
f.waiters = append(f.waiters, fakeClockWaiter{
|
||||
f.waiters = append(f.waiters, &fakeClockWaiter{
|
||||
targetTime: stopTime,
|
||||
destChan: ch,
|
||||
})
|
||||
return ch
|
||||
}
|
||||
|
||||
// Fake version of time.NewTimer(d).
|
||||
// NewTimer constructs a fake timer, akin to time.NewTimer(d).
|
||||
func (f *FakeClock) NewTimer(d time.Duration) clock.Timer {
|
||||
f.lock.Lock()
|
||||
defer f.lock.Unlock()
|
||||
@ -91,16 +92,20 @@ func (f *FakeClock) NewTimer(d time.Duration) clock.Timer {
|
||||
destChan: ch,
|
||||
},
|
||||
}
|
||||
f.waiters = append(f.waiters, timer.waiter)
|
||||
f.waiters = append(f.waiters, &timer.waiter)
|
||||
return timer
|
||||
}
|
||||
|
||||
// Tick constructs a fake ticker, akin to time.Tick
|
||||
func (f *FakeClock) Tick(d time.Duration) <-chan time.Time {
|
||||
if d <= 0 {
|
||||
return nil
|
||||
}
|
||||
f.lock.Lock()
|
||||
defer f.lock.Unlock()
|
||||
tickTime := f.time.Add(d)
|
||||
ch := make(chan time.Time, 1) // hold one tick
|
||||
f.waiters = append(f.waiters, fakeClockWaiter{
|
||||
f.waiters = append(f.waiters, &fakeClockWaiter{
|
||||
targetTime: tickTime,
|
||||
stepInterval: d,
|
||||
skipIfBlocked: true,
|
||||
@ -110,14 +115,15 @@ func (f *FakeClock) Tick(d time.Duration) <-chan time.Time {
|
||||
return ch
|
||||
}
|
||||
|
||||
// Move clock by Duration, notify anyone that's called After, Tick, or NewTimer
|
||||
// Step moves the clock by Duration and notifies anyone that's called After,
|
||||
// Tick, or NewTimer.
|
||||
func (f *FakeClock) Step(d time.Duration) {
|
||||
f.lock.Lock()
|
||||
defer f.lock.Unlock()
|
||||
f.setTimeLocked(f.time.Add(d))
|
||||
}
|
||||
|
||||
// Sets the time.
|
||||
// SetTime sets the time.
|
||||
func (f *FakeClock) SetTime(t time.Time) {
|
||||
f.lock.Lock()
|
||||
defer f.lock.Unlock()
|
||||
@ -127,9 +133,9 @@ func (f *FakeClock) SetTime(t time.Time) {
|
||||
// Actually changes the time and checks any waiters. f must be write-locked.
|
||||
func (f *FakeClock) setTimeLocked(t time.Time) {
|
||||
f.time = t
|
||||
newWaiters := make([]fakeClockWaiter, 0, len(f.waiters))
|
||||
newWaiters := make([]*fakeClockWaiter, 0, len(f.waiters))
|
||||
for i := range f.waiters {
|
||||
w := &f.waiters[i]
|
||||
w := f.waiters[i]
|
||||
if !w.targetTime.After(t) {
|
||||
|
||||
if w.skipIfBlocked {
|
||||
@ -147,7 +153,7 @@ func (f *FakeClock) setTimeLocked(t time.Time) {
|
||||
for !w.targetTime.After(t) {
|
||||
w.targetTime = w.targetTime.Add(w.stepInterval)
|
||||
}
|
||||
newWaiters = append(newWaiters, *w)
|
||||
newWaiters = append(newWaiters, w)
|
||||
}
|
||||
|
||||
} else {
|
||||
@ -157,7 +163,7 @@ func (f *FakeClock) setTimeLocked(t time.Time) {
|
||||
f.waiters = newWaiters
|
||||
}
|
||||
|
||||
// Returns true if After has been called on f but not yet satisfied (so you can
|
||||
// HasWaiters returns true if After has been called on f but not yet satisfied (so you can
|
||||
// write race-free tests).
|
||||
func (f *FakeClock) HasWaiters() bool {
|
||||
f.lock.RLock()
|
||||
@ -165,6 +171,7 @@ func (f *FakeClock) HasWaiters() bool {
|
||||
return len(f.waiters) > 0
|
||||
}
|
||||
|
||||
// Sleep is akin to time.Sleep
|
||||
func (f *FakeClock) Sleep(d time.Duration) {
|
||||
f.Step(d)
|
||||
}
|
||||
@ -186,24 +193,25 @@ func (i *IntervalClock) Since(ts time.Time) time.Duration {
|
||||
return i.Time.Sub(ts)
|
||||
}
|
||||
|
||||
// Unimplemented, will panic.
|
||||
// After is unimplemented, will panic.
|
||||
// TODO: make interval clock use FakeClock so this can be implemented.
|
||||
func (*IntervalClock) After(d time.Duration) <-chan time.Time {
|
||||
panic("IntervalClock doesn't implement After")
|
||||
}
|
||||
|
||||
// Unimplemented, will panic.
|
||||
// NewTimer is unimplemented, will panic.
|
||||
// TODO: make interval clock use FakeClock so this can be implemented.
|
||||
func (*IntervalClock) NewTimer(d time.Duration) clock.Timer {
|
||||
panic("IntervalClock doesn't implement NewTimer")
|
||||
}
|
||||
|
||||
// Unimplemented, will panic.
|
||||
// Tick is unimplemented, will panic.
|
||||
// TODO: make interval clock use FakeClock so this can be implemented.
|
||||
func (*IntervalClock) Tick(d time.Duration) <-chan time.Time {
|
||||
panic("IntervalClock doesn't implement Tick")
|
||||
}
|
||||
|
||||
// Sleep is unimplemented, will panic.
|
||||
func (*IntervalClock) Sleep(d time.Duration) {
|
||||
panic("IntervalClock doesn't implement Sleep")
|
||||
}
|
||||
@ -226,11 +234,11 @@ func (f *fakeTimer) Stop() bool {
|
||||
f.fakeClock.lock.Lock()
|
||||
defer f.fakeClock.lock.Unlock()
|
||||
|
||||
newWaiters := make([]fakeClockWaiter, 0, len(f.fakeClock.waiters))
|
||||
newWaiters := make([]*fakeClockWaiter, 0, len(f.fakeClock.waiters))
|
||||
for i := range f.fakeClock.waiters {
|
||||
w := &f.fakeClock.waiters[i]
|
||||
w := f.fakeClock.waiters[i]
|
||||
if w != &f.waiter {
|
||||
newWaiters = append(newWaiters, *w)
|
||||
newWaiters = append(newWaiters, w)
|
||||
}
|
||||
}
|
||||
|
||||
@ -250,5 +258,17 @@ func (f *fakeTimer) Reset(d time.Duration) bool {
|
||||
f.waiter.fired = false
|
||||
f.waiter.targetTime = f.fakeClock.time.Add(d)
|
||||
|
||||
var isWaiting bool
|
||||
for i := range f.fakeClock.waiters {
|
||||
w := f.fakeClock.waiters[i]
|
||||
if w == &f.waiter {
|
||||
isWaiting = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !isWaiting {
|
||||
f.fakeClock.waiters = append(f.fakeClock.waiters, &f.waiter)
|
||||
}
|
||||
|
||||
return active
|
||||
}
|
||||
|
0
vendor/github.com/sigma/go-inotify/LICENSE → vendor/k8s.io/utils/inotify/LICENSE
generated
vendored
0
vendor/github.com/sigma/go-inotify/LICENSE → vendor/k8s.io/utils/inotify/LICENSE
generated
vendored
0
vendor/github.com/sigma/go-inotify/PATENTS → vendor/k8s.io/utils/inotify/PATENTS
generated
vendored
0
vendor/github.com/sigma/go-inotify/PATENTS → vendor/k8s.io/utils/inotify/PATENTS
generated
vendored
0
vendor/github.com/sigma/go-inotify/README.md → vendor/k8s.io/utils/inotify/README.md
generated
vendored
0
vendor/github.com/sigma/go-inotify/README.md → vendor/k8s.io/utils/inotify/README.md
generated
vendored
@ -36,6 +36,7 @@ import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// Event represents a notification
|
||||
type Event struct {
|
||||
Mask uint32 // Mask of events
|
||||
Cookie uint32 // Unique cookie associating related events (for rename(2))
|
||||
@ -47,6 +48,7 @@ type watch struct {
|
||||
flags uint32 // inotify flags of this watch (see inotify(7) for the list of valid flags)
|
||||
}
|
||||
|
||||
// Watcher represents an inotify instance
|
||||
type Watcher struct {
|
||||
mu sync.Mutex
|
||||
fd int // File descriptor (as returned by the inotify_init() syscall)
|
||||
@ -60,7 +62,7 @@ type Watcher struct {
|
||||
|
||||
// NewWatcher creates and returns a new inotify instance using inotify_init(2)
|
||||
func NewWatcher() (*Watcher, error) {
|
||||
fd, errno := syscall.InotifyInit()
|
||||
fd, errno := syscall.InotifyInit1(syscall.IN_CLOEXEC)
|
||||
if fd == -1 {
|
||||
return nil, os.NewSyscallError("inotify_init", errno)
|
||||
}
|
||||
@ -130,14 +132,14 @@ func (w *Watcher) AddWatch(path string, flags uint32) error {
|
||||
|
||||
// Watch adds path to the watched file set, watching all events.
|
||||
func (w *Watcher) Watch(path string) error {
|
||||
return w.AddWatch(path, IN_ALL_EVENTS)
|
||||
return w.AddWatch(path, InAllEvents)
|
||||
}
|
||||
|
||||
// RemoveWatch removes path from the watched file set.
|
||||
func (w *Watcher) RemoveWatch(path string) error {
|
||||
watch, ok := w.watches[path]
|
||||
if !ok {
|
||||
return errors.New(fmt.Sprintf("can't remove non-existent inotify watch for: %s", path))
|
||||
return fmt.Errorf("can't remove non-existent inotify watch for: %s", path)
|
||||
}
|
||||
success, errno := syscall.InotifyRmWatch(w.fd, watch.wd)
|
||||
if success == -1 {
|
||||
@ -186,7 +188,7 @@ func (w *Watcher) readEvents() {
|
||||
continue
|
||||
}
|
||||
|
||||
var offset uint32 = 0
|
||||
var offset uint32
|
||||
// We don't know how many events we just read into the buffer
|
||||
// While the offset points to at least one whole event...
|
||||
for offset <= uint32(n-syscall.SizeofInotifyEvent) {
|
||||
@ -223,7 +225,7 @@ func (w *Watcher) readEvents() {
|
||||
// String formats the event e in the form
|
||||
// "filename: 0xEventMask = IN_ACCESS|IN_ATTRIB_|..."
|
||||
func (e *Event) String() string {
|
||||
var events string = ""
|
||||
var events string
|
||||
|
||||
m := e.Mask
|
||||
for _, b := range eventBits {
|
||||
@ -249,58 +251,83 @@ const (
|
||||
// IN_NONBLOCK uint32 = syscall.IN_NONBLOCK
|
||||
|
||||
// Options for AddWatch
|
||||
IN_DONT_FOLLOW uint32 = syscall.IN_DONT_FOLLOW
|
||||
IN_ONESHOT uint32 = syscall.IN_ONESHOT
|
||||
IN_ONLYDIR uint32 = syscall.IN_ONLYDIR
|
||||
|
||||
// InDontFollow : Don't dereference pathname if it is a symbolic link
|
||||
InDontFollow uint32 = syscall.IN_DONT_FOLLOW
|
||||
// InOneshot : Monitor the filesystem object corresponding to pathname for one event, then remove from watch list
|
||||
InOneshot uint32 = syscall.IN_ONESHOT
|
||||
// InOnlydir : Watch pathname only if it is a directory
|
||||
InOnlydir uint32 = syscall.IN_ONLYDIR
|
||||
|
||||
// The "IN_MASK_ADD" option is not exported, as AddWatch
|
||||
// adds it automatically, if there is already a watch for the given path
|
||||
// IN_MASK_ADD uint32 = syscall.IN_MASK_ADD
|
||||
|
||||
// Events
|
||||
IN_ACCESS uint32 = syscall.IN_ACCESS
|
||||
IN_ALL_EVENTS uint32 = syscall.IN_ALL_EVENTS
|
||||
IN_ATTRIB uint32 = syscall.IN_ATTRIB
|
||||
IN_CLOSE uint32 = syscall.IN_CLOSE
|
||||
IN_CLOSE_NOWRITE uint32 = syscall.IN_CLOSE_NOWRITE
|
||||
IN_CLOSE_WRITE uint32 = syscall.IN_CLOSE_WRITE
|
||||
IN_CREATE uint32 = syscall.IN_CREATE
|
||||
IN_DELETE uint32 = syscall.IN_DELETE
|
||||
IN_DELETE_SELF uint32 = syscall.IN_DELETE_SELF
|
||||
IN_MODIFY uint32 = syscall.IN_MODIFY
|
||||
IN_MOVE uint32 = syscall.IN_MOVE
|
||||
IN_MOVED_FROM uint32 = syscall.IN_MOVED_FROM
|
||||
IN_MOVED_TO uint32 = syscall.IN_MOVED_TO
|
||||
IN_MOVE_SELF uint32 = syscall.IN_MOVE_SELF
|
||||
IN_OPEN uint32 = syscall.IN_OPEN
|
||||
|
||||
// InAccess : File was accessed
|
||||
InAccess uint32 = syscall.IN_ACCESS
|
||||
// InAllEvents : Bit mask for all notify events
|
||||
InAllEvents uint32 = syscall.IN_ALL_EVENTS
|
||||
// InAttrib : Metadata changed
|
||||
InAttrib uint32 = syscall.IN_ATTRIB
|
||||
// InClose : Equates to IN_CLOSE_WRITE | IN_CLOSE_NOWRITE
|
||||
InClose uint32 = syscall.IN_CLOSE
|
||||
// InCloseNowrite : File or directory not opened for writing was closed
|
||||
InCloseNowrite uint32 = syscall.IN_CLOSE_NOWRITE
|
||||
// InCloseWrite : File opened for writing was closed
|
||||
InCloseWrite uint32 = syscall.IN_CLOSE_WRITE
|
||||
// InCreate : File/directory created in watched directory
|
||||
InCreate uint32 = syscall.IN_CREATE
|
||||
// InDelete : File/directory deleted from watched directory
|
||||
InDelete uint32 = syscall.IN_DELETE
|
||||
// InDeleteSelf : Watched file/directory was itself deleted
|
||||
InDeleteSelf uint32 = syscall.IN_DELETE_SELF
|
||||
// InModify : File was modified
|
||||
InModify uint32 = syscall.IN_MODIFY
|
||||
// InMove : Equates to IN_MOVED_FROM | IN_MOVED_TO
|
||||
InMove uint32 = syscall.IN_MOVE
|
||||
// InMovedFrom : Generated for the directory containing the old filename when a file is renamed
|
||||
InMovedFrom uint32 = syscall.IN_MOVED_FROM
|
||||
// InMovedTo : Generated for the directory containing the new filename when a file is renamed
|
||||
InMovedTo uint32 = syscall.IN_MOVED_TO
|
||||
// InMoveSelf : Watched file/directory was itself moved
|
||||
InMoveSelf uint32 = syscall.IN_MOVE_SELF
|
||||
// InOpen : File or directory was opened
|
||||
InOpen uint32 = syscall.IN_OPEN
|
||||
|
||||
// Special events
|
||||
IN_ISDIR uint32 = syscall.IN_ISDIR
|
||||
IN_IGNORED uint32 = syscall.IN_IGNORED
|
||||
IN_Q_OVERFLOW uint32 = syscall.IN_Q_OVERFLOW
|
||||
IN_UNMOUNT uint32 = syscall.IN_UNMOUNT
|
||||
|
||||
// InIsdir : Subject of this event is a directory
|
||||
InIsdir uint32 = syscall.IN_ISDIR
|
||||
// InIgnored : Watch was removed explicitly or automatically
|
||||
InIgnored uint32 = syscall.IN_IGNORED
|
||||
// InQOverflow : Event queue overflowed
|
||||
InQOverflow uint32 = syscall.IN_Q_OVERFLOW
|
||||
// InUnmount : Filesystem containing watched object was unmounted
|
||||
InUnmount uint32 = syscall.IN_UNMOUNT
|
||||
)
|
||||
|
||||
var eventBits = []struct {
|
||||
Value uint32
|
||||
Name string
|
||||
}{
|
||||
{IN_ACCESS, "IN_ACCESS"},
|
||||
{IN_ATTRIB, "IN_ATTRIB"},
|
||||
{IN_CLOSE, "IN_CLOSE"},
|
||||
{IN_CLOSE_NOWRITE, "IN_CLOSE_NOWRITE"},
|
||||
{IN_CLOSE_WRITE, "IN_CLOSE_WRITE"},
|
||||
{IN_CREATE, "IN_CREATE"},
|
||||
{IN_DELETE, "IN_DELETE"},
|
||||
{IN_DELETE_SELF, "IN_DELETE_SELF"},
|
||||
{IN_MODIFY, "IN_MODIFY"},
|
||||
{IN_MOVE, "IN_MOVE"},
|
||||
{IN_MOVED_FROM, "IN_MOVED_FROM"},
|
||||
{IN_MOVED_TO, "IN_MOVED_TO"},
|
||||
{IN_MOVE_SELF, "IN_MOVE_SELF"},
|
||||
{IN_OPEN, "IN_OPEN"},
|
||||
{IN_ISDIR, "IN_ISDIR"},
|
||||
{IN_IGNORED, "IN_IGNORED"},
|
||||
{IN_Q_OVERFLOW, "IN_Q_OVERFLOW"},
|
||||
{IN_UNMOUNT, "IN_UNMOUNT"},
|
||||
{InAccess, "IN_ACCESS"},
|
||||
{InAttrib, "IN_ATTRIB"},
|
||||
{InClose, "IN_CLOSE"},
|
||||
{InCloseNowrite, "IN_CLOSE_NOWRITE"},
|
||||
{InCloseWrite, "IN_CLOSE_WRITE"},
|
||||
{InCreate, "IN_CREATE"},
|
||||
{InDelete, "IN_DELETE"},
|
||||
{InDeleteSelf, "IN_DELETE_SELF"},
|
||||
{InModify, "IN_MODIFY"},
|
||||
{InMove, "IN_MOVE"},
|
||||
{InMovedFrom, "IN_MOVED_FROM"},
|
||||
{InMovedTo, "IN_MOVED_TO"},
|
||||
{InMoveSelf, "IN_MOVE_SELF"},
|
||||
{InOpen, "IN_OPEN"},
|
||||
{InIsdir, "IN_ISDIR"},
|
||||
{InIgnored, "IN_IGNORED"},
|
||||
{InQOverflow, "IN_Q_OVERFLOW"},
|
||||
{InUnmount, "IN_UNMOUNT"},
|
||||
}
|
Loading…
Reference in New Issue
Block a user