giampaolo / psutil

Cross-platform lib for process and system monitoring in Python
BSD 3-Clause "New" or "Revised" License
10.32k stars 1.39k forks source link

[macOS] error: use of undeclared identifier 'kIOMainPortDefault' #2354

Open jakirkham opened 10 months ago

jakirkham commented 10 months ago

Summary

Description

On macOS pre-12.0 kIOMainPortDefault is undefined. Instead it is called kIOMasterPortDefault. As a result, when building on macOS pre-12.0 with the constant kIOMainPortDefault (as seen below), an error is generated

https://github.com/giampaolo/psutil/blob/27a1432daeacd46b287517c11bfea2af4fd95a88/psutil/arch/osx/cpu.c#L140

Given that both of these constants are equal to NULL, one approach would be to use NULL instead

cc @snOm3ad (who may have authored this code and have thoughts on the approach here)

xref: https://github.com/giampaolo/psutil/pull/2222