Create inotify fd with close-on-exec#178
Conversation
inotify.go
Outdated
| func NewWatcher() (*Watcher, error) { | ||
| // Create inotify fd | ||
| fd, errno := unix.InotifyInit() | ||
| fd, errno := unix.InotifyInit1(syscall.IN_CLOEXEC) |
There was a problem hiding this comment.
This should be unix.IN_CLOEXEC since unix is a more up-to-date version of the syscall package.
|
Waiting on feedback/testing for ARM and PPC64 before merging. |
|
Can you provide steps to manually test that file descriptors are no longer leaking with this change? |
Notice the child process does not have an inotify fd |
|
I also tested this on ppc64le and it looks like both parent and child have an inotify fd: |
|
@clnperez That's odd. I wonder if the |
|
I don't know why this wouldn't work. https://github.com/golang/sys/blob/master/unix/zsyscall_linux_ppc64le.go#L629 IN_CLOEXEC is defined with the same value as other platforms. So I wonder where the problem is. |
|
Yah, I don't know either. I had to add the syscalls for Pipe2 and InotifyInit, but InotifyInit1 is already there, so, hmm. I hope it just isn't something wonky on my system. |
|
Oh man. I forgot to rebuild fsnotify with this patch after I got my sys updated (since it was an older copy without the other syscalls added for ppc64le). Kiiiind of important. Sorry about the noise. It works fine on ppc64le. :) |
|
ping (sounds like ppc64 is ok. is there any other blocker?) |
|
thx |
resolves #155
(originally from #174)