I would like to expose the use of kqueue for file change monitoring on
freebsd and darwin. Currently, on freebsd and darwin syscall.Kqueue is
wrapped in net.pollster which is then wrapped in a more general
net.pollserver. Before I invest too much time I wanted to ask the
opinion of the group on possible approaches, possibly:
a. Refactor net/fd_darwin.go and net/fd_freebsd into a new package,
os/kqueue, then refactor the os/kqueue package to support other types
of event flags enabling file change monitoring. This would probably
result in the creation of os/epoll for linux (although this wouldn't
be used to replace os/ionotify)
-or-
b. Build the required functionality to support file change monitoring
in a new package, os/kqueue, then at a later stage port net/fd_darwin
and net/fd_freebsd to use os/kqueue.
My preference is for the first option, but the second has merit as
well. I would be very appreciative of any advice the group could give.
Cheers
Dave
Russ
Cheers
Dave
I agree this isn't optimal. As my original proposal was to implement file change monitoring rather than exposing a generalised kqueue implementation, does it make sense to instead implement os/fsnotify for kqueue OSs with a view to incorporating win32 and Linux thereafter?
Cheers
Dace
Sent from my C64
Agreed
> We probably shouldn't allow recursive directory
> watching.
If possible recursive directory watching would be ideal, think dropbox.go
> Then we should expose a limited subset of the most useful flags in
> inotify.
> These would probably be create, delete, modify and rename (within the
> directory only). Conveniently this is the intersection of flags that
> Linux
> and Windows supports
Having come from a Java world where a large part of any codebase is
copying fields from one object to another I would be interested in
seeing if the API could avoid copying data from the internal structure
like syscall.Kevent_t to a portable structure that normalises the
returned data. I'm hoping something in the style of os.Waitmsg is
possible.
Cheers
Dave