Open ALPHA-60 opened 5 years ago
Thanks @ALPHA-60! Do you think you could make a pull request? I think the re-ordering of the event registration is ok, but for the Kevent structure I think we need some kind of conditional logic for FreeBSD 12.0.
I am curious how it is that FreeBSD 12.0 could introduce such a structure change without breaking many existing applications? Any idea?
Sure, no problem! I'll be able to work on it in around 2 weeks, not before. I hope that's OK.
About FreeBSD 12.0 -- well, I'm not sure. Their handbook explicitly instructs the user who upgrades to a new major revision to recompile all packages (ports). If the user is using binary packages, I guess everything is already handled when the package for a new major revision is built on their CI. Since EV_SET did not change, this should not require changes to source. So, I guess this ABI change DID break a lot of applications, but only if one forgot to update them either by recompiling, or downloading packages built for a particular OS revision.
FreeBSD 12.0 introduced the
ext
field inkevent
struct.Also, I noticed that events are processed in such order that process exit event is handled first, removing process from the
pidProcessMap
map, which in turn prevents processing of other events. This happens in a simple case of listening to output of "echo hello": bothEVFILT_READ
andNOTE_EXIT
are retrieved at the same time (from their respective events), but exit is processed first.I'm attaching a quick hack for FreeBSD which made most tests pass on my machine (there's still an issue of MacOS specific
__pthread_chdir
use). I just added theext
field and changed the order of registered events. This might be brittle, I'm not sure if the order of registered events is preserved when reporting, so the logic ofprocessEvent
might need to change instead of theevents
order.