only try to calculate swap usage if it's enabled. still needs some work
to get a proper avail/inuse though.
This commit is contained in:
parent
62f50350ca
commit
2e03503c62
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Makefile,v 1.60 2011/05/23 19:31:19 jasper Exp $
|
||||
# $OpenBSD: Makefile,v 1.61 2011/05/23 21:26:41 jasper Exp $
|
||||
|
||||
COMMENT= portable library for obtaining system information
|
||||
|
||||
@ -6,7 +6,7 @@ GNOME_VERSION= 2.28.3
|
||||
GNOME_PROJECT= libgtop
|
||||
PKGNAME= libgtop2-${VERSION}
|
||||
|
||||
REVISION= 3
|
||||
REVISION= 4
|
||||
|
||||
SHARED_LIBS= gtop-2.0 9.0 # .9.0
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: swap.c,v 1.3 2011/05/23 19:35:56 jasper Exp $ */
|
||||
/* $OpenBSD: swap.c,v 1.4 2011/05/23 21:26:41 jasper Exp $ */
|
||||
|
||||
/* Copyright (C) 1998-99 Martin Baulig
|
||||
This file is part of LibGTop 1.0.
|
||||
@ -91,7 +91,7 @@ glibtop_get_swap_p (glibtop *server, glibtop_swap *buf)
|
||||
swappgsin = uvmexp.swapins;
|
||||
swappgsout = uvmexp.swapouts;
|
||||
|
||||
nswap = swapctl (SWAP_NSWAP, NULL, 0);
|
||||
nswap = swapctl (SWAP_NSWAP, 0, 0);
|
||||
if (nswap < 0) {
|
||||
glibtop_warn_io_r (server, "swapctl (SWAP_NSWAP)");
|
||||
return;
|
||||
@ -106,8 +106,10 @@ glibtop_get_swap_p (glibtop *server, glibtop_swap *buf)
|
||||
}
|
||||
|
||||
for (i = 0; i < nswap; i++) {
|
||||
avail += swaplist[i].se_nblks;
|
||||
inuse += swaplist[i].se_inuse;
|
||||
if (swaplist[i].se_flags & SWF_ENABLE) {
|
||||
avail += swaplist[i].se_nblks;
|
||||
inuse += swaplist[i].se_inuse;
|
||||
}
|
||||
}
|
||||
|
||||
g_free (swaplist);
|
||||
|
Loading…
Reference in New Issue
Block a user