-
-
Notifications
You must be signed in to change notification settings - Fork 482
macOS: OSX 10.4 Tiger compatibility #1687
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
base: main
Are you sure you want to change the base?
Conversation
2 changes to make htop compatible with OSX 10.4 Tiger 1. `mach_host_self()` and `vm_page_size` are defined in `mach_init.h`. 2. `<libproc.h>` API is not available, related functionality is disabled. htop builds and works but cannot display per-process CPU% and task%. This can hopefully be improved in the future but at least it builds for now.
Disabling huge chunks of the existing code may have very adverse effects. Please refine this patch in a way that it works more localized. |
I have no idea how to make it more localized, considering that the entire |
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.
That's what I mean by "too broad" …
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 | ||
char path[PROC_PIDPATHINFO_MAXSIZE]; | ||
|
||
int r = proc_pidpath(pid, path, sizeof(path)); | ||
if (r <= 0) | ||
return; | ||
|
||
Process_updateExe(proc, path); | ||
#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.
This leaves Process_updateExe
uninitialized; at least call this explicitly as NULL
, so things can be set up correctly as "unavailable".
free_and_xStrdup(&proc->procCwd, vpi.pvi_cdir.vip_path); | ||
#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.
Same here. at least call free_and_xStrdup(&proc->procCwd, NULL);
so things are defined.
#else | ||
proc->taskAccess = false; | ||
#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.
Try to fill all the other fields here too; and be it with sensible "defaults" like "no time passed" for "one task"/"none running". Mark a todo to implement these with older APIs as necessary.
@@ -510,6 +524,7 @@ void DarwinProcess_scanThreads(DarwinProcess* dp, DarwinProcessTable* dpt) { | |||
|
|||
vm_deallocate(mach_task_self(), (vm_address_t) thread_list, sizeof(thread_port_array_t) * thread_count); | |||
mach_port_deallocate(mach_task_self(), task); | |||
#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.
Same here. If there's not even essential information filled in we can also just declare things fully incompatible with such old versions of MacOS …
@@ -18,6 +18,7 @@ in the source distribution for its full text. | |||
#include <net/if_types.h> | |||
#include <net/route.h> | |||
#include <sys/socket.h> | |||
#include <mach/mach_init.h> |
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.
Why is this here, when it's not used through new code? Or is was this missing before; and by which code?
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 | ||
#include <libproc.h> | ||
#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.
See docs/styleguide.md. Conditional includes should be below headers that are always included.
Thank you for the review, I'll get back to it next weekend. In the meantime, I figured out how to get some of the info on Tiger (though it requires root for privileged processes). |
|
2 changes to make htop compatible with OSX 10.4 Tiger
mach_host_self()
andvm_page_size
are defined inmach_init.h
.<libproc.h>
API is not available, related functionality is disabled.htop builds and works but cannot display per-process CPU% and task%. This can hopefully be improved in the future but at least it builds for now.
/cc @barracuda156