-
Notifications
You must be signed in to change notification settings - Fork 460
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
Fix FreeBSD support #561
base: main
Are you sure you want to change the base?
Fix FreeBSD support #561
Conversation
@swift-ci test |
FYI: some of this is already captured in #559. You may want to review that, and then perhaps some of this can be streamlined. In the alternative, maybe we can shard out some of the common stuff and leave the platform-specific stuff. |
@@ -389,15 +389,23 @@ _dispatch_kevent_print_error(dispatch_kevent_t ke) | |||
case 0: | |||
return; | |||
case ERANGE: /* A broken QoS was passed to kevent_id() */ | |||
#if defined(__APPLE__) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have DISPATCH_USE_KEVENT_QOS
in src/event/event_config.h
that might be more declarative here.
DISPATCH_INTERNAL_CRASH(ke->qos, "Invalid kevent priority"); | ||
#else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kevent on FreeBSD won't return ERANGE here, so we shouldn't need to trap this.
default: | ||
#if HAVE_MACH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We actually don't need to wrap HAVE_MACH here; we can remove the conditional in src/init.c
(see 72eb2b2). Keeping the logging would be useful.
@@ -1048,7 +1048,7 @@ _dispatch_bug_kevent_vanished(dispatch_unote_t du) | |||
"{ %p[%s], ident: %" PRIdPTR " / 0x%" PRIxPTR ", handler: %p }", | |||
dux_type(du._du)->dst_kind, dou._dq, | |||
dou._dq->dq_label ? dou._dq->dq_label : "<unknown>", | |||
du._du->du_ident, du._du->du_ident, func); | |||
(intptr_t)du._du->du_ident, (intptr_t)du._du->du_ident, func); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're going to cast here, we might as well choose uintmax_t
(in the alternative, I had suggested on the other pr defining some custom format strings because the type of dispatch_unote_ident_t
is platform defined, but casting is a reasonable alternative here.)
@@ -36,7 +36,7 @@ | |||
#define __DISPATCH_BUILDING_DISPATCH__ | |||
#define __DISPATCH_INDIRECT__ | |||
|
|||
#ifdef __APPLE__ | |||
#ifdef __APPLE__DISPATCH_USE_KEVENT_WORKLOOP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/__APPLE__//
?
@@ -56,6 +56,21 @@ _dispatch_thread_switch(dispatch_lock value, dispatch_lock_options_t flags, | |||
#endif | |||
#endif | |||
|
|||
#if defined(__FreeBSD__) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be merged above and the #ifdef
put in the function body.
@@ -174,7 +174,7 @@ extension DispatchSource { | |||
} | |||
#endif | |||
|
|||
#if !os(Linux) && !os(Android) && !os(Windows) | |||
#if !os(Linux) && !os(Android) && !os(Windows) && !os(FreeBSD) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...and then we're going to have to eventually && !os(OpenBSD)
-- should we just bite the bullet and rewrite this os(macOS)
? (throughout)
libdispatch port is back online Thanks for @fluffykhv |
No description provided.