diff options
author | vser1 <etienne@voucoux.fr> | 2019-12-17 14:54:55 +0100 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2019-12-17 14:54:55 +0100 |
commit | 5deeca9e7a104105e17cc16ad4f79b1c5cdca29e (patch) | |
tree | 5d7c0fb9c41a28bb876abb4db25806cea0fc0739 /psutil/_psutil_sunos.c | |
parent | 0e1c78671b0ea0328bc87ea77081ef52e30b1d06 (diff) | |
download | psutil-5deeca9e7a104105e17cc16ad4f79b1c5cdca29e.tar.gz |
[Solaris] Fix #1637 (#1638)
Diffstat (limited to 'psutil/_psutil_sunos.c')
-rw-r--r-- | psutil/_psutil_sunos.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/psutil/_psutil_sunos.c b/psutil/_psutil_sunos.c index 31d6f364..bcfb448f 100644 --- a/psutil/_psutil_sunos.c +++ b/psutil/_psutil_sunos.c @@ -12,12 +12,8 @@ /* fix compilation issue on SunOS 5.10, see: * https://github.com/giampaolo/psutil/issues/421 * https://github.com/giampaolo/psutil/issues/1077 - * http://us-east.manta.joyent.com/jmc/public/opensolaris/ARChive/PSARC/2010/111/materials/s10ceval.txt - * - * Because LEGACY_MIB_SIZE defined in the same file there is no way to make autoconfiguration =\ */ -#define NEW_MIB_COMPLIANT 1 #define _STRUCTURED_PROC 1 #include <Python.h> @@ -44,6 +40,14 @@ #include <sys/tihdr.h> #include <stropts.h> #include <inet/tcp.h> +#ifndef NEW_MIB_COMPLIANT +/* + * Solaris introduced NEW_MIB_COMPLIANT macro with Update 4. + * See https://github.com/giampaolo/psutil/issues/421 + * Prior to Update 4, one has to include mib2 by hand. + */ +#include <inet/mib2.h> +#endif #include <arpa/inet.h> #include <net/if.h> #include <math.h> // fabs() @@ -1747,7 +1751,14 @@ void init_psutil_sunos(void) PyModule_AddIntConstant(module, "SSTOP", SSTOP); PyModule_AddIntConstant(module, "SIDL", SIDL); PyModule_AddIntConstant(module, "SONPROC", SONPROC); +#ifdef SWAIT PyModule_AddIntConstant(module, "SWAIT", SWAIT); +#else + /* sys/proc.h started defining SWAIT somewhere + * after Update 3 and prior to Update 5 included. + */ + PyModule_AddIntConstant(module, "SWAIT", 0); +#endif PyModule_AddIntConstant(module, "PRNODEV", PRNODEV); // for process tty |