From 4dd1e215f3d49fb3a5074b82430bf6199c14898e Mon Sep 17 00:00:00 2001 From: Giampaolo Rodola Date: Mon, 10 Apr 2023 13:20:39 -0700 Subject: move psutil_getpagesize() in a new mem.c file --- psutil/_psutil_windows.c | 11 ----------- psutil/arch/windows/mem.c | 8 ++++++++ psutil/arch/windows/mem.h | 3 ++- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/psutil/_psutil_windows.c b/psutil/_psutil_windows.c index 969c5713..2ed937ee 100644 --- a/psutil/_psutil_windows.c +++ b/psutil/_psutil_windows.c @@ -1515,17 +1515,6 @@ psutil_sensors_battery(PyObject *self, PyObject *args) { } -/* - * System memory page size as an int. - */ -static PyObject * -psutil_getpagesize(PyObject *self, PyObject *args) { - // XXX: we may want to use GetNativeSystemInfo to differentiate - // page size for WoW64 processes (but am not sure). - return Py_BuildValue("I", PSUTIL_SYSTEM_INFO.dwPageSize); -} - - // ------------------------ Python init --------------------------- static PyMethodDef diff --git a/psutil/arch/windows/mem.c b/psutil/arch/windows/mem.c index 8b678254..18b535e6 100644 --- a/psutil/arch/windows/mem.c +++ b/psutil/arch/windows/mem.c @@ -11,6 +11,14 @@ #include "../../_psutil_common.h" +PyObject * +psutil_getpagesize(PyObject *self, PyObject *args) { + // XXX: we may want to use GetNativeSystemInfo to differentiate + // page size for WoW64 processes (but am not sure). + return Py_BuildValue("I", PSUTIL_SYSTEM_INFO.dwPageSize); +} + + PyObject * psutil_virtual_mem(PyObject *self, PyObject *args) { unsigned long long totalPhys, availPhys, totalSys, availSys, pageSize; diff --git a/psutil/arch/windows/mem.h b/psutil/arch/windows/mem.h index 871cd64e..a10781df 100644 --- a/psutil/arch/windows/mem.h +++ b/psutil/arch/windows/mem.h @@ -6,4 +6,5 @@ #include -PyObject *psutil_virtual_mem(PyObject* self, PyObject* args); +PyObject *psutil_getpagesize(PyObject *self, PyObject *args); +PyObject *psutil_virtual_mem(PyObject *self, PyObject *args); -- cgit v1.2.1