summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Baulig <martin@home-of-linux.org>1999-01-06 19:59:04 +0000
committerMartin Baulig <martin@src.gnome.org>1999-01-06 19:59:04 +0000
commit8ba42b25e07a6b45bfe6e745af7b2ad885a4caba (patch)
tree8698d3dd242024e79806921768b38fe1862d3429
parent3b270123eb7458fd436d96d92011114b47c60093 (diff)
downloadlibgtop-8ba42b25e07a6b45bfe6e745af7b2ad885a4caba.tar.gz
Use `server->os_version_code' instead of GLIBTOP_LINUX_VERSION_CODE.
1999-01-06 Martin Baulig <martin@home-of-linux.org> * netload.c (glibtop_get_netload_s): Use `server->os_version_code' instead of GLIBTOP_LINUX_VERSION_CODE.
-rw-r--r--sysdeps/linux/ChangeLog5
-rw-r--r--sysdeps/linux/netload.c91
2 files changed, 50 insertions, 46 deletions
diff --git a/sysdeps/linux/ChangeLog b/sysdeps/linux/ChangeLog
index 0ade6d8a..a15c308a 100644
--- a/sysdeps/linux/ChangeLog
+++ b/sysdeps/linux/ChangeLog
@@ -1,5 +1,10 @@
1999-01-06 Martin Baulig <martin@home-of-linux.org>
+ * netload.c (glibtop_get_netload_s): Use `server->os_version_code'
+ instead of GLIBTOP_LINUX_VERSION_CODE.
+
+1999-01-06 Martin Baulig <martin@home-of-linux.org>
+
Unconditionally enable SMP support for linux.
* open.c (_glibtop_open_s): Always determine the number of CPUs
diff --git a/sysdeps/linux/netload.c b/sysdeps/linux/netload.c
index 4b553f29..c07f07c7 100644
--- a/sysdeps/linux/netload.c
+++ b/sysdeps/linux/netload.c
@@ -182,83 +182,82 @@ glibtop_get_netload_s (glibtop *server, glibtop_netload *buf,
* need IP accounting.
*/
-#if GLIBTOP_LINUX_VERSION_CODE < 131442
+ if (server->os_version_code < 131442) {
- /* If IP accounting is enabled in the kernel and it is
+ /* If IP accounting is enabled in the kernel and it is
* enabled for the requested interface, we use it to
* get the data. In this case, we don't use /proc/net/dev
* to get errors and collisions.
*/
- f = fopen ("/proc/net/ip_acct", "r");
- if (f) {
- int success = 0;
+ f = fopen ("/proc/net/ip_acct", "r");
+ if (f) {
+ int success = 0;
- /* Skip over the header line. */
- fgets (buffer, BUFSIZ-1, f);
+ /* Skip over the header line. */
+ fgets (buffer, BUFSIZ-1, f);
- while (fgets (buffer, BUFSIZ-1, f)) {
- unsigned long flags, packets, bytes;
- char *p, *dev;
+ while (fgets (buffer, BUFSIZ-1, f)) {
+ unsigned long flags, packets, bytes;
+ char *p, *dev;
- /* Skip over the network thing. */
- dev = skip_token (buffer) + 1;
- p = skip_token (dev);
- *p++ = 0;
+ /* Skip over the network thing. */
+ dev = skip_token (buffer) + 1;
+ p = skip_token (dev);
+ *p++ = 0;
- if (strcmp (dev, interface))
- continue;
+ if (strcmp (dev, interface))
+ continue;
- success = 1;
+ success = 1;
- p = skip_token (p);
+ p = skip_token (p);
- flags = strtoul (p, &p, 16);
+ flags = strtoul (p, &p, 16);
- p = skip_multiple_token (p, 2);
+ p = skip_multiple_token (p, 2);
- packets = strtoul (p, &p, 0);
- bytes = strtoul (p, &p, 0);
+ packets = strtoul (p, &p, 0);
+ bytes = strtoul (p, &p, 0);
- if (flags & _GLIBTOP_IP_FW_ACCTIN) {
- /* Incoming packets only. */
+ if (flags & _GLIBTOP_IP_FW_ACCTIN) {
+ /* Incoming packets only. */
- buf->packets_total += packets;
- buf->packets_in += packets;
+ buf->packets_total += packets;
+ buf->packets_in += packets;
- buf->bytes_total += bytes;
- buf->bytes_in += bytes;
+ buf->bytes_total += bytes;
+ buf->bytes_in += bytes;
- buf->flags |= _glibtop_sysdeps_netload_in;
+ buf->flags |= _glibtop_sysdeps_netload_in;
- } else if (flags & _GLIBTOP_IP_FW_ACCTOUT) {
- /* Outgoing packets only. */
+ } else if (flags & _GLIBTOP_IP_FW_ACCTOUT) {
+ /* Outgoing packets only. */
- buf->packets_total += packets;
- buf->packets_out += packets;
+ buf->packets_total += packets;
+ buf->packets_out += packets;
- buf->bytes_total += bytes;
- buf->bytes_out += bytes;
+ buf->bytes_total += bytes;
+ buf->bytes_out += bytes;
- buf->flags |= _glibtop_sysdeps_netload_out;
+ buf->flags |= _glibtop_sysdeps_netload_out;
- } else {
- /* Only have total values. */
+ } else {
+ /* Only have total values. */
- buf->packets_total += packets;
- buf->bytes_total += bytes;
+ buf->packets_total += packets;
+ buf->bytes_total += bytes;
- buf->flags |= _glibtop_sysdeps_netload_total;
+ buf->flags |= _glibtop_sysdeps_netload_total;
+ }
}
- }
- fclose (f);
+ fclose (f);
- if (success) return;
+ if (success) return;
+ }
}
-#endif
-
/* Ok, either IP accounting is not enabled in the kernel or
* it was not enabled for the requested interface. */