-
-
Notifications
You must be signed in to change notification settings - Fork 456
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 MacOS X <12 build issue and the regression from PR1609 #1612
Conversation
// Since macOS 12.0, IOMasterPort is deprecated and replaced by IOMainPort | ||
#if !defined(MAC_OS_VERSION_12_0) || (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_VERSION_12_0) | ||
#define IOMainPort IOMasterPort | ||
#endif |
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.
I may be missing something, but AFAICS IOMainPort
is used nowhere in the remainder of this file, thus this source/define is unused.
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.
Based on no visible usage in the file apart from this macro definition or anywhere else inside the Darwin platform code …
$ grep -C3 IOMasterPort -R darwin/
darwin/Platform.c- const double nanos_per_sec = 1e9;
darwin/Platform.c- Platform_nanosecondsPerSchedulerTick = nanos_per_sec / scheduler_ticks_per_sec;
darwin/Platform.c-
darwin/Platform.c: // Since macOS 12.0, IOMasterPort is deprecated and replaced by IOMainPort
darwin/Platform.c- #if !defined(MAC_OS_VERSION_12_0) || (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_VERSION_12_0)
darwin/Platform.c: #define IOMainPort IOMasterPort
darwin/Platform.c- #endif
darwin/Platform.c-
darwin/Platform.c- return true;
I propose to apply the following cleanup instead:
// Since macOS 12.0, IOMasterPort is deprecated and replaced by IOMainPort | |
#if !defined(MAC_OS_VERSION_12_0) || (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_VERSION_12_0) | |
#define IOMainPort IOMasterPort | |
#endif |
Can someone with Darwin please check or point the location this gets used (indirectly)?
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
AC_CHECK_DECLS([IOMainPort], [], [], [[#include <IOKit/IOKitLib.h>]])
AC_CHECK_DECLS([IOMasterPort], [], [], [[#include <IOKit/IOKitLib.h>]])
in configure.ac
coming from ed7eac5 . I removed the test for iokit_available as that seems to be true for any OS X 10.x and higher. We can probably prune more cruft. Would be good if somebody that actually uses OS X could check.
Partially committed as 5954fa0 |
Supersedes 2e62fae from PR htop-dev#1612 Closes htop-dev#1612
#1614 is the "full prune" alternative to the remainder of this PR |
Supersedes 2e62fae from PR htop-dev#1612 Closes htop-dev#1612 Co-authored-by: Benny Baumann <[email protected]>
Closes #1611
Thank you to Explorer09 and aestriplex for debugging.
Commit 2e62fae includes some housekeeping:
IOKit is available since MacOS X was born, so remove the guarding. Fix the defines to actually work compiling on MacOS X v11.