Conversation
|
Thanks for contributing this and tackling the issue yourself. |
|
I haven't performed a full review yet but I think having some very brief documentation of the current status of BSD support would probably be useful. |
I added a line in README.md in the section describing platform support. |
|
Anything else necessary here? |
|
Hmm, sorry @3405691582 this seems to have gotten stuck. If you can fix up the conflicts we can try to shepherd this through. |
I reviewed the conflicting files from the incoming merge and resolved them. |
db5c279 to
919d3d9
Compare
|
I'm sorry, it looks like we're hitting a bunch new compilation failures |
|
I've rebased atop HEAD and it seems OK to me. I'll double-check on a Linux machine soon and let you know. |
|
Ah, I see the previous failing check run. I'll take a look. |
|
This should be fixed now. The code state seemed to get reverted to an older state when I was trying to rebase and keep this up to date with HEAD. Please rerun checks. |
|
The static Swift SDK tests are failing with issues like |
### Motivation Additional partial platform support. ### Modifications * Create a new CNIOBSD module for OpenBSD, for general cleanliness, and make use of it throughout. Some of the changes are borrowed directly from CNIOLinux; some may technically be unnecessary; I am erring somewhat on expediency to functionality. * Since `malloc_size` is unavailable on OpenBSD, and some of the helpers make use of ManagedBufferPointer which makes use of it, mark some of this as unavailable as well. * Usual pthread optional typing changes, since pthread types are pointers on this platform. * Add conditionals to exclude other functionality not available here, like IP_RECVPKTINFO or IP_PKTINFO. * d_ino is a backwards-compatibility macro valued token for dirent, so instead, just expand with a conditional. * Use kqueue on OpenBSD. This necessitates adding some conditionals for type and feature compatibility. * The vsock API is unavailable on OpenBSD. ### Result Tested the NIOTCPEchoClient and NIOTCPEchoServer appears to work and that swift-nio-ssh (hopefully wlog) builds with a local repository with these changes. Because NIOFS/_NIOFileSystem depend on some non-portable components, such as extended attributes, sendfile, non-portable linkat flags, and renameat2, this is only just partial OpenBSD support, which means that `swift build` on the full swift-nio project won't build cleanly, but at least the portable parts can be used to build servers and clients. This commit will mark the linked bug as fixed; I will open a new bug for file system support. Fixes apple#3383.
Co-authored-by: Rick Newton-Rogers <rnro@apple.com>
Fixed; caused by a typo. Sorry for the noise! |
| InitializeSRWLock(self.mutex) | ||
| #elseif os(OpenBSD) | ||
| var attr = pthread_mutexattr_t(bitPattern: 0) | ||
| let err = pthread_mutex_init(self.mutex, &attr) |
There was a problem hiding this comment.
This attr is used before it's initialized. pthread_mutexattr_init(&attr) should be called before, right?
related: apple/swift-log#387 (comment)
There was a problem hiding this comment.
Probably. I'll fix this in a new pr. Please at me if you're finding more incorrect usages on OpenBSD.
Motivation:
Additional partial platform support.
Modifications:
Create a new CNIOBSD module for OpenBSD, for general cleanliness, and make use of it throughout. Some of the changes are borrowed directly from CNIOLinux; some may technically be unnecessary; I am erring somewhat on expediency to functionality.
Since
malloc_sizeis unavailable on OpenBSD, and some of the helpers make use of ManagedBufferPointer which makes use of it, mark some of this as unavailable as well.Usual pthread optional typing changes, since pthread types are pointers on this platform.
Add conditionals to exclude other functionality not available here, like IP_RECVPKTINFO or IP_PKTINFO.
d_ino is a backwards-compatibility macro valued token for dirent, so instead, just expand with a conditional.
Use kqueue on OpenBSD. This necessitates adding some conditionals for type and feature compatibility.
The vsock API is unavailable on OpenBSD.
Result:
Tested the NIOTCPEchoClient and NIOTCPEchoServer appears to work and that swift-nio-ssh (hopefully wlog) builds with a local repository with these changes.
Because NIOFS/_NIOFileSystem depend on some non-portable components, such as extended attributes, sendfile, non-portable linkat flags, and renameat2, this is only just partial OpenBSD support, which means that
swift buildon the full swift-nio project won't build cleanly, but at least the portable parts can be used to build servers and clients. This commit will mark the linked bug as fixed; I will open a new bug for file system support.Fixes #3383.