pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/sysutils/py-psutil py-psutil: Use KERN_PROC_CWD on Net...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/53662d8db190
branches:  trunk
changeset: 334593:53662d8db190
user:      kamil <kamil%pkgsrc.org@localhost>
date:      Sat Jun 01 01:11:57 2019 +0000

description:
py-psutil: Use KERN_PROC_CWD on NetBSD >= 8.99.42

diffstat:

 sysutils/py-psutil/Makefile                                    |   3 +-
 sysutils/py-psutil/distinfo                                    |   8 +-
 sysutils/py-psutil/patches/patch-psutil___psbsd.py             |  23 +++++++
 sysutils/py-psutil/patches/patch-psutil___psutil__bsd.c        |  15 ++++-
 sysutils/py-psutil/patches/patch-psutil_arch_netbsd_specific.c |  31 +++++++++-
 sysutils/py-psutil/patches/patch-psutil_arch_netbsd_specific.h |  13 ++++
 6 files changed, 85 insertions(+), 8 deletions(-)

diffs (148 lines):

diff -r 51277c022e42 -r 53662d8db190 sysutils/py-psutil/Makefile
--- a/sysutils/py-psutil/Makefile       Fri May 31 20:57:28 2019 +0000
+++ b/sysutils/py-psutil/Makefile       Sat Jun 01 01:11:57 2019 +0000
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.28 2019/04/30 09:32:07 adam Exp $
+# $NetBSD: Makefile,v 1.29 2019/06/01 01:11:57 kamil Exp $
 
 DISTNAME=      psutil-5.6.2
+PKGREVISION=   1
 PKGNAME=       ${PYPKGPREFIX}-${DISTNAME}
 CATEGORIES=    sysutils python
 MASTER_SITES=  ${MASTER_SITE_PYPI:=p/psutil/}
diff -r 51277c022e42 -r 53662d8db190 sysutils/py-psutil/distinfo
--- a/sysutils/py-psutil/distinfo       Fri May 31 20:57:28 2019 +0000
+++ b/sysutils/py-psutil/distinfo       Sat Jun 01 01:11:57 2019 +0000
@@ -1,8 +1,10 @@
-$NetBSD: distinfo,v 1.28 2019/04/30 09:32:07 adam Exp $
+$NetBSD: distinfo,v 1.29 2019/06/01 01:11:57 kamil Exp $
 
 SHA1 (psutil-5.6.2.tar.gz) = c01d48a103196eb513b72d32fbc7cee1ed64a38c
 RMD160 (psutil-5.6.2.tar.gz) = 5450a028ad787d3e274a2c0e11c127bf5cd7e9da
 SHA512 (psutil-5.6.2.tar.gz) = ff41428b43c59ad948b8b4e6824943258abb30dc76cd042bdf7fe72d5aceb9bcbd2a2038a6a43d2b4c36eccae9007ef78779fe0cb5ee3caa68da9b1ba687b66d
 Size (psutil-5.6.2.tar.gz) = 432907 bytes
-SHA1 (patch-psutil___psutil__bsd.c) = 3d1166abdd74e3f3b4bec3098b03e7d05a67df04
-SHA1 (patch-psutil_arch_netbsd_specific.c) = bc38af6ba1c360a12fb3d7112026425ca0cf4a92
+SHA1 (patch-psutil___psbsd.py) = f8888b8f386a1928446c7d588a7a46f2674c69f6
+SHA1 (patch-psutil___psutil__bsd.c) = 5516c6c257b389c7e977074d2a6eeb3c23f565d1
+SHA1 (patch-psutil_arch_netbsd_specific.c) = 3809727dcf605af44ec15f0ef5924acd65be5ea9
+SHA1 (patch-psutil_arch_netbsd_specific.h) = 4d6b3c96eefeec4908e1006b96ab175d64714dd2
diff -r 51277c022e42 -r 53662d8db190 sysutils/py-psutil/patches/patch-psutil___psbsd.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/py-psutil/patches/patch-psutil___psbsd.py        Sat Jun 01 01:11:57 2019 +0000
@@ -0,0 +1,23 @@
+$NetBSD: patch-psutil___psbsd.py,v 1.3 2019/06/01 01:11:57 kamil Exp $
+
+Use proc_cwd on NetBSD >= 8.99.42.
+
+--- psutil/_psbsd.py.orig      2019-04-11 21:10:12.000000000 +0000
++++ psutil/_psbsd.py
+@@ -105,6 +105,7 @@ HAS_PER_CPU_TIMES = hasattr(cext, "per_c
+ HAS_PROC_NUM_THREADS = hasattr(cext, "proc_num_threads")
+ HAS_PROC_OPEN_FILES = hasattr(cext, 'proc_open_files')
+ HAS_PROC_NUM_FDS = hasattr(cext, 'proc_num_fds')
++HAS_PROC_CWD = hasattr(cext, 'proc_cwd')
+ 
+ kinfo_proc_map = dict(
+     ppid=0,
+@@ -845,6 +846,8 @@ class Process(object):
+         if OPENBSD and self.pid == 0:
+             return None  # ...else it would raise EINVAL
+         elif NETBSD:
++            if HAS_PROC_CWD:
++                return cext.proc_cwd(self.pid) or None
+             with wrap_exceptions_procfs(self):
+                 return os.readlink("/proc/%s/cwd" % self.pid)
+         elif HAS_PROC_OPEN_FILES:
diff -r 51277c022e42 -r 53662d8db190 sysutils/py-psutil/patches/patch-psutil___psutil__bsd.c
--- a/sysutils/py-psutil/patches/patch-psutil___psutil__bsd.c   Fri May 31 20:57:28 2019 +0000
+++ b/sysutils/py-psutil/patches/patch-psutil___psutil__bsd.c   Sat Jun 01 01:11:57 2019 +0000
@@ -1,9 +1,11 @@
-$NetBSD: patch-psutil___psutil__bsd.c,v 1.8 2017/06/22 22:01:47 kamil Exp $
+$NetBSD: patch-psutil___psutil__bsd.c,v 1.9 2019/06/01 01:11:57 kamil Exp $
 
 Don't include <sys/user.h> on every BSD.
 It's absent on NetBSD and unused on OpenBSD.
 
---- psutil/_psutil_bsd.c.orig  2017-03-26 08:09:27.000000000 +0000
+Define proc_cwd on NetBSD >= 8.99.42.
+
+--- psutil/_psutil_bsd.c.orig  2019-04-11 21:10:12.000000000 +0000
 +++ psutil/_psutil_bsd.c
 @@ -30,7 +30,9 @@
  #include <sys/types.h>
@@ -15,3 +17,12 @@
  #include <sys/proc.h>
  #include <sys/file.h>
  #include <sys/socket.h>
+@@ -919,6 +921,8 @@ PsutilMethods[] = {
+ #if defined(PSUTIL_FREEBSD) || defined(PSUTIL_OPENBSD)
+     {"proc_connections", psutil_proc_connections, METH_VARARGS,
+      "Return connections opened by process"},
++#endif
++#if defined(PSUTIL_FREEBSD) || defined(PSUTIL_OPENBSD) || (defined(PSUTIL_NETBSD) && __NetBSD_Version__ >= 899004200)
+     {"proc_cwd", psutil_proc_cwd, METH_VARARGS,
+      "Return process current working directory."},
+ #endif
diff -r 51277c022e42 -r 53662d8db190 sysutils/py-psutil/patches/patch-psutil_arch_netbsd_specific.c
--- a/sysutils/py-psutil/patches/patch-psutil_arch_netbsd_specific.c    Fri May 31 20:57:28 2019 +0000
+++ b/sysutils/py-psutil/patches/patch-psutil_arch_netbsd_specific.c    Sat Jun 01 01:11:57 2019 +0000
@@ -1,8 +1,10 @@
-$NetBSD: patch-psutil_arch_netbsd_specific.c,v 1.1 2018/05/15 22:22:01 minskim Exp $
+$NetBSD: patch-psutil_arch_netbsd_specific.c,v 1.2 2019/06/01 01:11:57 kamil Exp $
 
 Don't include <sys/user.h> on NetBSD. Include <sys/iostat.h> instead.
 
---- psutil/arch/netbsd/specific.c.orig 2018-04-12 08:37:17.000000000 +0000
+Use proc_cwd on NetBSD >= 8.99.42.
+
+--- psutil/arch/netbsd/specific.c.orig 2019-03-02 20:46:28.000000000 +0000
 +++ psutil/arch/netbsd/specific.c
 @@ -22,7 +22,7 @@
  #include <sys/types.h>
@@ -13,3 +15,28 @@
  #include <sys/proc.h>
  #include <sys/swap.h>  // for swap_mem
  #include <signal.h>
+@@ -112,6 +112,24 @@ kinfo_getfile(pid_t pid, int* cnt) {
+     return kf;
+ }
+ 
++#ifdef KERN_PROC_CWD /* Introduced in NetBSD-8.99.42 */
++PyObject *
++psutil_proc_cwd(PyObject *self, PyObject *args) {
++    long pid;
++    char path[MAXPATHLEN];
++    size_t pathlen = sizeof path;
++
++    if (! PyArg_ParseTuple(args, "l", &pid))
++        return NULL;
++    
++    int name[] = { CTL_KERN, KERN_PROC_ARGS, pid, KERN_PROC_CWD};
++    if (sysctl(name, 4, path, &pathlen, NULL, 0) != 0) {
++        PyErr_SetFromErrno(PyExc_OSError);
++        return NULL;
++    }
++    return PyUnicode_DecodeFSDefault(path);
++}
++#endif
+ 
+ // XXX: This is no longer used as per
+ // https://github.com/giampaolo/psutil/pull/557#issuecomment-171912820
diff -r 51277c022e42 -r 53662d8db190 sysutils/py-psutil/patches/patch-psutil_arch_netbsd_specific.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/py-psutil/patches/patch-psutil_arch_netbsd_specific.h    Sat Jun 01 01:11:57 2019 +0000
@@ -0,0 +1,13 @@
+$NetBSD: patch-psutil_arch_netbsd_specific.h,v 1.1 2019/06/01 01:11:57 kamil Exp $
+
+Use proc_cwd on NetBSD >= 8.99.42.
+
+--- psutil/arch/netbsd/specific.h.orig 2019-03-02 20:46:28.000000000 +0000
++++ psutil/arch/netbsd/specific.h
+@@ -26,3 +26,6 @@ PyObject* psutil_disk_io_counters(PyObje
+ PyObject* psutil_proc_exe(PyObject* self, PyObject* args);
+ PyObject* psutil_proc_num_threads(PyObject* self, PyObject* args);
+ PyObject* psutil_cpu_stats(PyObject* self, PyObject* args);
++#if (__NetBSD_Version__ - 0) >= 899004200
++PyObject *psutil_proc_cwd(PyObject *self, PyObject *args);
++#endif



Home | Main Index | Thread Index | Old Index