etcimon / libasync

Cross-platform event loop library of asynchronous objects
MIT License
147 stars 30 forks source link

O_EVTONLY doesn't exist on FreeBSD #26

Open MartinNowak opened 9 years ago

MartinNowak commented 9 years ago

The O_EVTONLY you're using is O_NOCTTY on FreeBSD. https://github.com/etcimon/libasync/blob/ac77a6c68f5f0c2512858d811cb8c959fbf8de41/source/libasync/internals/kqueue.d#L62 I'd suggest to use O_RDONLY on FreeBSD as a replacement.

Most of the constants in this file are available in druntime, btw.

MartinNowak commented 9 years ago

https://github.com/D-Programming-Language/druntime/blob/master/src/core/sys/freebsd/sys/event.d

I was sure someone added the corresponding osx header, but apparently it's still missing.

MartinNowak commented 9 years ago

Ah mixed that up with epoll on linux. https://github.com/D-Programming-Language/druntime/pull/301 Could you do me the favor and make a pull for core.sys.osx.sys.event?

etcimon commented 9 years ago

Could you do me the favor and make a pull for core.sys.osx.sys.event?

Yes, I have a pull request on now: https://github.com/etcimon/druntime/commit/933f28160e04f736f7cc85454d9d500f008c8c5e

The O_EVTONLY you're using is O_NOCTTY on FreeBSD.

I haven't had time to look into it much, but O_RDONLY seems to be 0x00. I guess I'll just ignore this for the moment and fix it once druntime has all the headers.

As a side note, the directory watcher on BSD / OSX was a little hard to get right. You should read the notes here: https://github.com/etcimon/libasync/blob/master/source/libasync/posix.d#L1472

MartinNowak commented 9 years ago

It kind of worked out, we don't need detailed changes info in dub right now, only a notification that something changed. Later we might optimize for change infos to speedup rebuilding