in wrap.go [46:70]
func fsevtCallback(stream C.FSEventStreamRef, info uintptr, numEvents C.size_t, cpaths **C.char, cflags *C.FSEventStreamEventFlags, cids *C.FSEventStreamEventId) {
l := int(numEvents)
events := make([]Event, l)
es := registry.Get(info)
if es == nil {
log.Printf("failed to retrieve registry %d", info)
return
}
// These slices are backed by C data. Ensure data is copied out
// if it expected to exist outside of this function.
paths := (*[1 << 30]*C.char)(unsafe.Pointer(cpaths))[:l:l]
ids := (*[1 << 30]C.FSEventStreamEventId)(unsafe.Pointer(cids))[:l:l]
flags := (*[1 << 30]C.FSEventStreamEventFlags)(unsafe.Pointer(cflags))[:l:l]
for i := range events {
events[i] = Event{
Path: C.GoString(paths[i]),
Flags: EventFlags(flags[i]),
ID: uint64(ids[i]),
}
es.EventID = uint64(ids[i])
}
es.Events <- events
}