2001-02-13  Martin Baulig  <baulig@suse.de>

	Fix bug #14076.

	* open.c (glibtop_open_s): Check whether /proc/1/cpu exists to
	detect SMP support rather than reading /proc/stat; on Linux 2.4.x,
	/proc/stat has "cpu" and "cpu0" entries even for non-SMP systems.
This commit is contained in:
Martin Baulig
2001-02-13 12:31:57 +00:00
committed by Martin Baulig
parent 67c9c8e3e3
commit 38e55efd2d
2 changed files with 16 additions and 0 deletions

View File

@@ -1,3 +1,11 @@
2001-02-13 Martin Baulig <baulig@suse.de>
Fix bug #14076.
* open.c (glibtop_open_s): Check whether /proc/1/cpu exists to
detect SMP support rather than reading /proc/stat; on Linux 2.4.x,
/proc/stat has "cpu" and "cpu0" entries even for non-SMP systems.
2000-01-22 Martin Baulig <martin@home-of-linux.org>
* procargs.c (glibtop_get_proc_args_s): Set correct `buf->size' and

View File

@@ -62,6 +62,7 @@ glibtop_open_s (glibtop *server, const char *program_name,
const unsigned flags)
{
char buffer [BUFSIZ], *p;
struct stat statb;
int fd, len, i;
server->name = program_name;
@@ -71,6 +72,13 @@ glibtop_open_s (glibtop *server, const char *program_name,
server->ncpu = 0;
/* On Linux 2.4.x, /proc/stat has "cpu" and "cpu0" entries even
* for non-SMP systems. Checking whether /proc/<pid>/cpu exists
* is a much better way to detect SMP. */
if (stat ("/proc/1/cpu", &statb))
return;
fd = open (FILENAME, O_RDONLY);
if (fd < 0)
glibtop_error_io_r (server, "open (%s)", FILENAME);