giampaolo / psutil

Cross-platform lib for process and system monitoring in Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

jakirkham opened this issue · comments

Summary

  • OS: macOS
  • Architecture: x86_64 or aarch64
  • Psutil version: 5.9.8 (did not happen in 5.9.7)
  • Python version: 3.8-3.12
  • Type: installation (build)

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

status = IOServiceGetMatchingServices(kIOMainPortDefault, matching, &iter);

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: #2222