diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2019-03-03 22:24:01 +0100 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2019-03-03 22:24:01 +0100 |
commit | 9e008299bf8389603b5232baee7a55aa700ade36 (patch) | |
tree | 8facbb787adc562968fa0aaf74f86162962e9b8c | |
parent | 7a9e7969f172c80507416a0fb1df98bf72e71139 (diff) | |
download | psutil-dragonfly-bsd.tar.gz |
first step towards successful compilationdragonfly-bsd
-rw-r--r-- | INSTALL.rst | 8 | ||||
-rw-r--r-- | psutil/_common.py | 5 | ||||
-rw-r--r-- | psutil/_psutil_bsd.c | 16 | ||||
-rwxr-xr-x | setup.py | 11 |
4 files changed, 34 insertions, 6 deletions
diff --git a/INSTALL.rst b/INSTALL.rst index 567758c9..bafe7ec4 100644 --- a/INSTALL.rst +++ b/INSTALL.rst @@ -102,11 +102,19 @@ NetBSD ====== :: + export PKG_PATH="ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/`uname -m`/`uname -r`/All" pkg_add -v pkgin pkgin install python gcc python -m pip install psutil +DragonflyBSD +============ + +:: + + pkg install python3 + Solaris ======= diff --git a/psutil/_common.py b/psutil/_common.py index 6d430388..f9ba714e 100644 --- a/psutil/_common.py +++ b/psutil/_common.py @@ -43,7 +43,7 @@ PY3 = sys.version_info[0] == 3 __all__ = [ # constants 'FREEBSD', 'BSD', 'LINUX', 'NETBSD', 'OPENBSD', 'MACOS', 'OSX', 'POSIX', - 'SUNOS', 'WINDOWS', + 'SUNOS', 'WINDOWS', 'DRAGONFLYBSD', 'ENCODING', 'ENCODING_ERRS', 'AF_INET6', # connection constants 'CONN_CLOSE', 'CONN_CLOSE_WAIT', 'CONN_CLOSING', 'CONN_ESTABLISHED', @@ -80,7 +80,8 @@ OSX = MACOS # deprecated alias FREEBSD = sys.platform.startswith("freebsd") OPENBSD = sys.platform.startswith("openbsd") NETBSD = sys.platform.startswith("netbsd") -BSD = FREEBSD or OPENBSD or NETBSD +DRAGONFLYBSD = sys.platform.startswith("dragonfly") +BSD = FREEBSD or OPENBSD or NETBSD or DRAGONFLYBSD SUNOS = sys.platform.startswith(("sunos", "solaris")) AIX = sys.platform.startswith("aix") diff --git a/psutil/_psutil_bsd.c b/psutil/_psutil_bsd.c index efb933fb..b810b784 100644 --- a/psutil/_psutil_bsd.c +++ b/psutil/_psutil_bsd.c @@ -42,20 +42,21 @@ #include <netinet/in.h> #include <netinet/in_systm.h> #include <netinet/ip.h> -#include <netinet/in_pcb.h> #include <netinet/tcp.h> #include <netinet/tcp_timer.h> #include <netinet/ip_var.h> + +#ifndef PSUTIL_DRAGONFLYBSD +#include <netinet/in_pcb.h> #include <netinet/tcp_var.h> // for struct xtcpcb +#endif + #include <netinet/tcp_fsm.h> // for TCP connection states #include <arpa/inet.h> // for inet_ntop() - #include <sys/mount.h> - #include <net/if.h> // net io counters #include <net/if_dl.h> #include <net/route.h> - #include <netinet/in.h> // process open files/connections #include <sys/un.h> @@ -94,9 +95,16 @@ #ifndef DTYPE_VNODE #define DTYPE_VNODE 1 #endif +// #elif PSUTIL_DRAGONFLYBSD +// #include <kcore.h> #endif +#include <kcore.h> +#include <sys/kinfo.h> +#include <kvm.h> + + // convert a timeval struct to a double #define PSUTIL_TV2DOUBLE(t) ((t).tv_sec + (t).tv_usec / 1000000.0) @@ -30,6 +30,7 @@ sys.path.insert(0, os.path.join(HERE, "psutil")) from _common import AIX # NOQA from _common import BSD # NOQA +from _common import DRAGONFLYBSD # NOQA from _common import FREEBSD # NOQA from _common import LINUX # NOQA from _common import MACOS # NOQA @@ -195,6 +196,16 @@ elif NETBSD: define_macros=macros, libraries=["kvm"]) +elif DRAGONFLYBSD: + macros.append(("PSUTIL_DRAGONFLYBSD", 1)) + ext = Extension( + 'psutil._psutil_bsd', + sources=sources + [ + 'psutil/_psutil_bsd.c', + ], + define_macros=macros, + libraries=["kvm"]) + elif LINUX: def get_ethtool_macro(): # see: https://github.com/giampaolo/psutil/issues/659 |