Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement inotify directory watcher #743

Merged
merged 1 commit into from
Jul 28, 2014
Merged

Conversation

MartinNowak
Copy link
Contributor

No description provided.

@s-ludwig
Copy link
Member

Thanks a lot! So the "let's pretend D is a scripting language" game can finally start ;) Looks like the wrong IN_NONBLOCK value may have caused some grief?

BTW, for Mac OS it looks like Obj-C is necessary (pathDidChange selector), so that's something I'd add when Michel's/Jacob's D-ObjC support is integrated into DMD.

s-ludwig added a commit that referenced this pull request Jul 28, 2014
implement inotify directory watcher
@s-ludwig s-ludwig merged commit 58fd812 into vibe-d:master Jul 28, 2014
@MartinNowak MartinNowak deleted the inotify branch July 28, 2014 11:39
@MartinNowak
Copy link
Contributor Author

I think it can be done with kqueue on OSX/FreeBSD.

@w0rp
Copy link

w0rp commented Jul 28, 2014

kqueue on FreeBSD and Mac is the way to go from what I've read. I'm basing that largely on what Nginx does. Nginx uses epoll by default for monitoring on Linux and kqueue by default for monitoring on FreeBSD and Mac OSX, etc.

@s-ludwig
Copy link
Member

Yes, looks like kqueue can do that, too, and it definitely is the target for server/command line applications. My misconception came from an earlier need to have something that integrates well with a Cocoa application. This will still be important in the future, but that's a different topic.

@Kapps
Copy link

Kapps commented Jul 30, 2014

If recursion is desired, I believe FSEvents is what would be used:
https://developer.apple.com/library/mac/documentation/Darwin/Reference/FSEvents_Ref/Reference/reference.html

Being notified which file changed is only supported in OSX 10.7 or higher, but that's probably a reasonable requirement.

type = DirectoryChangeType.modified;

import std.path : buildPath;
auto name = ev.name.ptr[0 .. ev.name.ptr.strlen];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I seem to be getting a SEGV here on my 32bit server, but not on my 64bit dev machine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmh, the inotify_event struct looks declaration seems to be correct. Can you print out nread?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... seem to have been a bug when built with the gdc-2.064 binaries. I've switched to gdc-2.065 and it's gone away. This might be difficult to track down.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it also works for me with -m32 on dmd.2.065.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants