-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Unbreak FreeBSD cross-build on MacOS broken in 051460b8b #16167
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
Conversation
MacOS used FreeBSD-compatible getprogname() and pthread_getname_np(). But pthread_getthreadid_np() does not exist on MacOS. This implements libspl_gettid() using pthread_threadid_np() to get the thread id of the current thread. Tested with FreeBSD GitHub actions freebsd-src/.github/workflows/cross-bootstrap-tools.yml Signed-off-by: Martin Matuska <[email protected]>
@robn if you have a better solution, I am of course open for it |
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.
Interesting. If this gets things moving, I'm ok with it, so approved.
I'm interested in what you're actually doing though. Are you compiling for FreeBSD on macOS? "cross-build" sounds like yes, but if that's true, I don't understand why __APPLE__
would be defined if you're targetting FreeBSD userspace. But maybe you're compiling FreeBSD userspace on macOS for macOS, and macOS defines __FreeBSD__
as well? Or, something else entirely?
It won't make a difference to this PR, but it might change how I approach a couple of things in the future if __FreeBSD__
is not enough of an indicator of a platform target.
The kernel-toolchain is compiled as MacOS binaries and libspl is part of it. |
MacOS used FreeBSD-compatible getprogname() and pthread_getname_np(). But pthread_getthreadid_np() does not exist on MacOS. This implements libspl_gettid() using pthread_threadid_np() to get the thread id of the current thread. Tested with FreeBSD GitHub actions freebsd-src/.github/workflows/cross-bootstrap-tools.yml Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Rob Norris <[email protected]> Signed-off-by: Martin Matuska <[email protected]> Closes openzfs#16167 (cherry picked from commit 414acbd)
MacOS used FreeBSD-compatible getprogname() and pthread_getname_np(). But pthread_getthreadid_np() does not exist on MacOS. This implements libspl_gettid() using pthread_threadid_np() to get the thread id of the current thread. Tested with FreeBSD GitHub actions freebsd-src/.github/workflows/cross-bootstrap-tools.yml Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Rob Norris <[email protected]> Signed-off-by: Martin Matuska <[email protected]> Closes openzfs#16167 (cherry picked from commit 414acbd)
MacOS used FreeBSD-compatible getprogname() and pthread_getname_np(). But pthread_getthreadid_np() does not exist on MacOS. This implements libspl_gettid() using pthread_threadid_np() to get the thread id of the current thread. Tested with FreeBSD GitHub actions freebsd-src/.github/workflows/cross-bootstrap-tools.yml Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Rob Norris <[email protected]> Signed-off-by: Martin Matuska <[email protected]> Closes openzfs#16167 (cherry picked from commit 414acbd)
MacOS used FreeBSD-compatible getprogname() and pthread_getname_np(). But pthread_getthreadid_np() does not exist on MacOS. This implements libspl_gettid() using pthread_threadid_np() to get the thread id of the current thread. Tested with FreeBSD GitHub actions freebsd-src/.github/workflows/cross-bootstrap-tools.yml Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Rob Norris <[email protected]> Signed-off-by: Martin Matuska <[email protected]> Closes openzfs#16167
MacOS used FreeBSD-compatible getprogname() and pthread_getname_np(). But pthread_getthreadid_np() does not exist on MacOS. This implements libspl_gettid() using pthread_threadid_np() to get the thread id of the current thread. Tested with FreeBSD GitHub actions freebsd-src/.github/workflows/cross-bootstrap-tools.yml Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Rob Norris <[email protected]> Signed-off-by: Martin Matuska <[email protected]> Closes openzfs#16167
Motivation and Context
Fix FreeBSD cross-build on MacOS broken in 051460b
Minimizing code diff between OpenZFS and FreeBSD
Description
MacOS used FreeBSD-compatible getprogname() and pthread_getname_np(). But pthread_getthreadid_np() does not exist on MacOS. This implements libspl_gettid() using pthread_threadid_np() to get the thread id of the current thread.
How Has This Been Tested?
Tested with FreeBSD GitHub actions
freebsd/freebsd-src@3c1be0b
https://github.com/freebsd/freebsd-src/actions/runs/8946387771/job/24576944970
https://github.com/freebsd/freebsd-src/actions/runs/8946387771/job/24576945408
Types of changes
Checklist:
Signed-off-by
.