Reverted some stuff from 06-07-1998 since it was too buggy.

1998-06-18  Martin Baulig  <baulig@taurus.uni-trier.de>

	* sysdeps/linux/*.c: Reverted some stuff from 06-07-1998
	since it was too buggy.
This commit is contained in:
Martin Baulig
1998-06-18 19:02:49 +00:00
committed by Martin Baulig
parent 3fcc477b25
commit 1b90ed4fcc
11 changed files with 117 additions and 280 deletions

View File

@@ -44,17 +44,10 @@ glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf)
buf->flags = _glibtop_sysdeps_cpu;
#ifdef GLIBTOP_CACHE_OPEN
fd = server->machine.fd_stat;
#endif
if (fd == 0) {
fd = open (FILENAME, O_RDONLY);
if (fd == -1)
glibtop_error_r (server, "open (%s): %s",
FILENAME, strerror (errno));
} else {
lseek (fd, 0, SEEK_SET);
}
fd = open (FILENAME, O_RDONLY);
if (fd == -1)
glibtop_error_r (server, "open (%s): %s",
FILENAME, strerror (errno));
ret = read (fd, buffer, BUFSIZ);
if (ret == -1)
@@ -63,6 +56,7 @@ glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf)
tmp = strchr (buffer, '\n');
tmp = skip_token (tmp); /* "cpu" */
buf->user = strtoul (tmp, &tmp, 10);
buf->nice = strtoul (tmp, &tmp, 10);
buf->sys = strtoul (tmp, &tmp, 10);
@@ -71,10 +65,5 @@ glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf)
buf->total = buf->user + buf->nice + buf->sys + buf->idle;
buf->frequency = 100;
#ifdef GLIBTOP_CACHE_OPEN
server->machine.fd_stat = fd;
#else
close (fd);
#endif
}