Date: Wed, 17 Oct 2012 05:21:55 +0600 From: Jan Beich <jbeich@tormail.org> To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/172803: [patch] sysutils/py-psutil: get_virtual_mem() fails without COMPAT_FREEBSD[4-7] Message-ID: <1TOIZW-000GhH-HX@internal.tormail.org> Resent-Message-ID: <201210170140.q9H1e2gh031483@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 172803 >Category: ports >Synopsis: [patch] sysutils/py-psutil: get_virtual_mem() fails without COMPAT_FREEBSD[4-7] >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Oct 17 01:40:02 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Jan Beich >Release: FreeBSD 10.0-CURRENT amd64 >Organization: >Environment: $ sysctl -n vfs.bufspace 0 $ lsvfs Filesystem Refs Flags -------------------------------- ----- --------------- zfs 37 jail, delegated-administration devfs 4 synthetic, jail tmpfs 5 procfs 3 synthetic, jail linprocfs 4 synthetic nullfs 12 loopback, jail linsysfs 3 synthetic >Description: vfs.bufspace type was changed from `int' to `long' in r189595. ref. http://svnweb.freebsd.org/changeset/base/189595 http://svnweb.freebsd.org/changeset/base/189627 https://code.google.com/p/psutil/issues/detail?id=325 >How-To-Repeat: >Fix: --- bufspace_type.diff begins here --- Index: sysutils/py-psutil/files/patch-psutil-_psutil_bsd.c =================================================================== --- sysutils/py-psutil/files/patch-psutil-_psutil_bsd.c (revision 305988) +++ sysutils/py-psutil/files/patch-psutil-_psutil_bsd.c (working copy) @@ -1,5 +1,35 @@ --- psutil/_psutil_bsd.c.orig 2012-08-16 23:07:37.000000000 +0800 +++ psutil/_psutil_bsd.c 2012-09-27 14:50:20.843763756 +0800 +@@ -576,12 +576,19 @@ get_process_memory_info(PyObject* self, + static PyObject* + get_virtual_mem(PyObject* self, PyObject* args) + { +- unsigned int total, active, inactive, wired, cached, free, buffers; ++ unsigned int total, active, inactive, wired, cached, free; + size_t size = sizeof(total); + struct vmtotal vm; + int mib[] = {CTL_VM, VM_METER}; + long pagesize = getpagesize(); + ++#if __FreeBSD_version > 702101 ++ long buffers; ++#else ++ int buffers; ++#endif ++ size_t buffers_size = sizeof(buffers); ++ + if (sysctlbyname("vm.stats.vm.v_page_count", &total, &size, NULL, 0)) + goto error; + if (sysctlbyname("vm.stats.vm.v_active_count", &active, &size, NULL, 0)) +@@ -594,7 +601,7 @@ get_virtual_mem(PyObject* self, PyObject + goto error; + if (sysctlbyname("vm.stats.vm.v_free_count", &free, &size, NULL, 0)) + goto error; +- if (sysctlbyname("vfs.bufspace", &buffers, &size, NULL, 0)) ++ if (sysctlbyname("vfs.bufspace", &buffers, &buffers_size, NULL, 0)) + goto error; + + size = sizeof(vm); @@ -1376,8 +1376,10 @@ strlcat(opts, ",noclusterr", sizeof(opts)); if (flags & MNT_NOCLUSTERW) --- bufspace_type.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted: >>> import psutil Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python2.7/site-packages/psutil/__init__.py", line 88, in <module> import psutil._psbsd as _psplatform File "/usr/local/lib/python2.7/site-packages/psutil/_psbsd.py", line 28, in <module> TOTAL_PHYMEM = _psutil_bsd.get_virtual_mem()[0] SystemError: error return without exception set >>> import _psutil_bsd >>> _psutil_bsd.get_virtual_mem() Traceback (most recent call last): File "<stdin>", line 1, in <module> SystemError: error return without exception set
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1TOIZW-000GhH-HX>