Skip to content

Commit

Permalink
[NetBSD] two fixes for swap code (#2128)
Browse files Browse the repository at this point in the history
  • Loading branch information
0-wiz-0 committed Aug 18, 2022
1 parent df3fba5 commit 84219ad
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CREDITS
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ I: 18
N: Thomas Klausner
W: https://github.com/0-wiz-0
D: NetBSD implementation (co-author).
I: 557
I: 557, 2128

N: Ryo Onodera
W: https://github.com/ryoon
Expand Down
1 change: 1 addition & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- 2113, [FreeBSD]: __FreeBSD_version used in mem.c without including
<sys/param.h>
- 2128, [NetBSD]: fix bugs in swap code

5.9.1
=====
Expand Down
6 changes: 3 additions & 3 deletions psutil/arch/netbsd/specific.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ psutil_virtual_mem(PyObject *self, PyObject *args) {
(unsigned long long) uv.active << uv.pageshift, // active
(unsigned long long) uv.inactive << uv.pageshift, // inactive
(unsigned long long) uv.wired << uv.pageshift, // wired
(unsigned long long) uv.filepages + uv.execpages * pagesize, // cached
(unsigned long long) (uv.filepages + uv.execpages) * pagesize, // cached
// These are determined from /proc/meminfo in Python.
(unsigned long long) 0, // buffers
(unsigned long long) 0 // shared
Expand Down Expand Up @@ -495,8 +495,8 @@ psutil_swap_mem(PyObject *self, PyObject *args) {
swap_total = swap_free = 0;
for (i = 0; i < nswap; i++) {
if (swdev[i].se_flags & SWF_ENABLE) {
swap_total += swdev[i].se_nblks * DEV_BSIZE;
swap_free += (swdev[i].se_nblks - swdev[i].se_inuse) * DEV_BSIZE;
swap_total += (uint64_t)swdev[i].se_nblks * DEV_BSIZE;
swap_free += (uint64_t)(swdev[i].se_nblks - swdev[i].se_inuse) * DEV_BSIZE;
}
}
free(swdev);
Expand Down

0 comments on commit 84219ad

Please sign in to comment.