Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compilation failure on Linux < 2.6.27 / CentOS 5 #2171

Merged
merged 1 commit into from
Nov 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
on the situation.
"""

from __future__ import print_function

import functools
import json
import os
Expand Down
5 changes: 5 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
*Bug tracker at https://github.com/giampaolo/psutil/issues*

5.9.5 (IN DEVELOPMENT)
======================

- 2164_, [Linux]: compilation fails on kernels < 2.6.27 (e.g. CentOS 5).

5.9.4
=====

Expand Down
2 changes: 1 addition & 1 deletion psutil/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
AF_LINK = _psplatform.AF_LINK

__author__ = "Giampaolo Rodola'"
__version__ = "5.9.4"
__version__ = "5.9.5"
version_info = tuple([int(num) for num in __version__.split('.')])

_timer = getattr(time, 'monotonic', time.time)
Expand Down
8 changes: 7 additions & 1 deletion psutil/_psutil_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,16 @@ ioprio_set(int which, int who, int ioprio) {
return syscall(__NR_ioprio_set, which, who, ioprio);
}

// defined in linux/ethtool.h but not always available (e.g. Android)
// * defined in linux/ethtool.h but not always available (e.g. Android)
// * #ifdef check needed for old kernels, see:
// https://github.com/giampaolo/psutil/issues/2164
static inline uint32_t
psutil_ethtool_cmd_speed(const struct ethtool_cmd *ecmd) {
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27)
return ecmd->speed;
#else
return (ecmd->speed_hi << 16) | ecmd->speed;
#endif
}

#define IOPRIO_CLASS_SHIFT 13
Expand Down
2 changes: 1 addition & 1 deletion psutil/tests/test_windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import psutil
from psutil import WINDOWS
from psutil._compat import FileNotFoundError
from psutil._compat import which
from psutil._compat import super
from psutil._compat import which
from psutil.tests import APPVEYOR
from psutil.tests import GITHUB_ACTIONS
from psutil.tests import HAS_BATTERY
Expand Down