Skip to content

Commit

Permalink
mimic vm_stat.c
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed Jan 14, 2025
1 parent 4fe8d74 commit 2f44d79
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions psutil/arch/osx/mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
// from psutil/_psutil_osx.c in 2023. This is the GIT blame before the move:
// https://github.com/giampaolo/psutil/blame/efd7ed3/psutil/_psutil_osx.c

// See:
// https://github.com/apple-open-source/macos/blob/master/system_cmds/vm_stat/vm_stat.c

#include <Python.h>
#include <mach/host_info.h>
#include <sys/sysctl.h>
Expand All @@ -19,10 +22,10 @@
static int
psutil_sys_vminfo(vm_statistics_data_t *vmstat) {
kern_return_t ret;
mach_msg_type_number_t count = HOST_VM_INFO_COUNT;
unsigned int count = HOST_VM_INFO64_COUNT;
mach_port_t mport = mach_host_self();

ret = host_statistics(mport, HOST_VM_INFO, (host_info_t)vmstat, &count);
ret = host_statistics(mport, HOST_VM_INFO64, (host_info64_t)vmstat, &count);
if (ret != KERN_SUCCESS) {
PyErr_Format(
PyExc_RuntimeError,
Expand Down

0 comments on commit 2f44d79

Please sign in to comment.