Skip to content

Add support for FreeBSD #99

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

Merged
merged 1 commit into from
Jun 30, 2025
Merged

Add support for FreeBSD #99

merged 1 commit into from
Jun 30, 2025

Conversation

jakepetroules
Copy link
Contributor

Also includes speculative support for OpenBSD, which I haven't tested, but which is likely correct as it tends to require the same code paths as FreeBSD.

Also includes speculative support for OpenBSD, which I haven't tested, but which is likely correct as it tends to require the same code paths as FreeBSD.
@jakepetroules jakepetroules merged commit f848a4c into main Jun 30, 2025
286 of 315 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Swift on FreeBSD Jun 30, 2025
@jakepetroules jakepetroules deleted the eng/PR-freebsd branch June 30, 2025 20:54
@@ -285,8 +285,14 @@ internal func monitorProcessTermination(

// Small helper to provide thread-safe access to the child process to continuations map as well as a condition variable to suspend the calling thread when there are no subprocesses to wait for. Note that Mutex cannot be used here because we need the semantics of pthread_cond_wait, which requires passing the pthread_mutex_t instance as a parameter, something the Mutex API does not provide access to.
private final class ChildProcessContinuations: Sendable {
#if os(FreeBSD) || os(OpenBSD)
typealias MutexType = pthread_mutex_t?
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unfortunate. Why would we support an optional lock?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Linux/Glibc, pthread_mutex_t is a union, but on OpenBSD/FreeBSD, it is a pointer.
Unfortunately in the view of swift this could potentially be a null pointer and hence becomes imported as an optional pointer type.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Long-term, once we have a separate module map and platform overlay, we should API-note it with the appropriate nullability information.
swiftlang/swift#81407

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

Successfully merging this pull request may close these issues.

5 participants