Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Fix FreeBSD support #561

wants to merge 1 commit into from

Conversation

drexin
Copy link
Contributor

@drexin drexin commented Jul 12, 2021

No description provided.

@drexin
Copy link
Contributor Author

drexin commented Jul 12, 2021

@swift-ci test

@3405691582
Copy link
Contributor

3405691582 commented Jul 16, 2021

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__)
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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);
Copy link
Contributor

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
Copy link
Contributor

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__)
Copy link
Contributor

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 #ifdefput 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)
Copy link
Contributor

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)

@lin72h
Copy link

lin72h commented Feb 4, 2023

libdispatch port is back online Thanks for @fluffykhv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants