-
Notifications
You must be signed in to change notification settings - Fork 78
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
EPOLL_CTL_ADD
used when trying to modify a file descriptor
#29
Comments
Also encountered under Darling macOS emulation. The problem is the descriptor is added into 2 different filters and libkqueue has no idea the fd has already been added into epoll. |
This is my solution: darlinghq@67c22f9 The idea is to If the application using kqueue expects fds to be automatically removed from kqueue when closed, more hacks will be required to mimick the behavior. |
This surprises me as there should be one epoll instance per kqueue/filter. Could you provide some example code to reproduce the issue? |
|
Ugh, you're right. OK, well I guess we should maintain separate epoll instances for each filter. I don't think there's really an issue with that other than we burn an extra fd per kqueue. |
I tried using libkqueue as an alternative to buying an overpriced Apple computer only to have the kqueue API. libkqueue does not work for my application as, just like pointed out here, EV_ADD translates to EPOLL_CTL_ADD and not (EPOLL_CTL_ADD/EPOLL_CTL_MOD). This makes it basically impossible to implement the most basic network application as the flow goes like this:
|
Kqueue isn't osx exclusive feature.
Additionally FreeBSD allows to crosscompile apps for osx |
…o avoid conflicts between EVFILT_READ and EVFILT_WRITE Closes mheily#29 Closes mheily#59 There's more work required, but at least this fixes the outstanding issues. Known limitations: - Need to verify correct behaviour of EV_DISPATCH when both filters are registered for events. This now needs to be implemented internally by libkqueue instead of relying on EPOLLET, as EPOLLET applies to both EPOLLIN and EPOLLOUT. - If the number of events we are to return does not have sufficient space for at least two entries when polling an FD registered for both read and write events, the write event will be lost. We can fix this by implementing a linked list of pending events we return before calling the platform's wait function. Will probably copy the dlist implementation from FreeRADIUS across, as it's been well tested, and is a header only implementation like the current rbtree. A dlist is needed to store entries for EVFILT_PROC anyway, which is the next filter that needs major attention.
basically if a file descriptor is first only used for reading (
EPOLLIN
) and later on switches to reading and writing (EPOLLOUT
), there's currently no way to modify the epoll set asEPOLL_CTL_ADD
is used unconditionally (but it should beEPOLL_CTL_MOD
). Full details here: https://bugs.swift.org/browse/SR-3360The text was updated successfully, but these errors were encountered: