From d5faeab44275f7f03a08e97fb372b70de7e1e58a Mon Sep 17 00:00:00 2001 From: Amir Rossert Date: Sat, 23 Dec 2023 10:57:26 +0200 Subject: [PATCH] Fix missing DUPLEX_UNKNOWN on older compilers Signed-off-by: Amir Rossert --- CREDITS | 2 +- HISTORY.rst | 1 + psutil/_psutil_linux.c | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CREDITS b/CREDITS index 74e761726..1ade9d3ef 100644 --- a/CREDITS +++ b/CREDITS @@ -808,7 +808,7 @@ I: 2077, 2160 N: Amir Rossert W: https://github.com/arossert -I: 2156 +I: 2156, 2345 N: Lawrence D'Anna W: https://github.com/smoofra diff --git a/HISTORY.rst b/HISTORY.rst index 0f84d59f4..0af24c1c6 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -18,6 +18,7 @@ It could either leak memory or core dump. - 2340_, [NetBSD]: if process is terminated, `Process.cwd()`_ will return an empty string instead of raising `NoSuchProcess`_. +- 2345_, [Linux]: fix compilation on older compiler missing DUPLEX_UNKNOWN 5.9.7 ===== diff --git a/psutil/_psutil_linux.c b/psutil/_psutil_linux.c index 38fa2cbaf..292e1c552 100644 --- a/psutil/_psutil_linux.c +++ b/psutil/_psutil_linux.c @@ -41,6 +41,11 @@ static PyMethodDef mod_methods[] = { {"set_debug", psutil_set_debug, METH_VARARGS}, {NULL, NULL, 0, NULL} }; +// May happen on old RedHat versions, see: +// https://github.com/giampaolo/psutil/issues/607 +#ifndef DUPLEX_UNKNOWN + #define DUPLEX_UNKNOWN 0xff +#endif #if PY_MAJOR_VERSION >= 3