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

Conversation

Projects
None yet
5 participants
@MartinNowak
Contributor

MartinNowak commented Jul 28, 2014

No description provided.

@s-ludwig

This comment has been minimized.

Show comment
Hide comment
@s-ludwig

s-ludwig Jul 28, 2014

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.

Member

s-ludwig commented Jul 28, 2014

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

Merge pull request #743 from MartinNowak/inotify
implement inotify directory watcher

@s-ludwig s-ludwig merged commit 58fd812 into vibe-d:master Jul 28, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details

@MartinNowak MartinNowak deleted the MartinNowak:inotify branch Jul 28, 2014

@MartinNowak

This comment has been minimized.

Show comment
Hide comment
@MartinNowak

MartinNowak Jul 28, 2014

Contributor

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

Contributor

MartinNowak commented Jul 28, 2014

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

@w0rp

This comment has been minimized.

Show comment
Hide comment
@w0rp

w0rp 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.

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

This comment has been minimized.

Show comment
Hide comment
@s-ludwig

s-ludwig Jul 28, 2014

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.

Member

s-ludwig commented Jul 28, 2014

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

This comment has been minimized.

Show comment
Hide comment
@Kapps

Kapps 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.

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];

This comment has been minimized.

@ibuclaw

ibuclaw Jul 30, 2014

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

@ibuclaw

ibuclaw Jul 30, 2014

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

This comment has been minimized.

@MartinNowak

MartinNowak Jul 30, 2014

Contributor

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

@MartinNowak

MartinNowak Jul 30, 2014

Contributor

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

This comment has been minimized.

@ibuclaw

ibuclaw Jul 30, 2014

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.

@ibuclaw

ibuclaw Jul 30, 2014

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.

This comment has been minimized.

@MartinNowak

MartinNowak Jul 30, 2014

Contributor

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

@MartinNowak

MartinNowak Jul 30, 2014

Contributor

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