Fix bug #14076.
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:
committed by
Martin Baulig
parent
67c9c8e3e3
commit
38e55efd2d
@@ -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>
|
2000-01-22 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
* procargs.c (glibtop_get_proc_args_s): Set correct `buf->size' and
|
* procargs.c (glibtop_get_proc_args_s): Set correct `buf->size' and
|
||||||
|
@@ -62,6 +62,7 @@ glibtop_open_s (glibtop *server, const char *program_name,
|
|||||||
const unsigned flags)
|
const unsigned flags)
|
||||||
{
|
{
|
||||||
char buffer [BUFSIZ], *p;
|
char buffer [BUFSIZ], *p;
|
||||||
|
struct stat statb;
|
||||||
int fd, len, i;
|
int fd, len, i;
|
||||||
|
|
||||||
server->name = program_name;
|
server->name = program_name;
|
||||||
@@ -71,6 +72,13 @@ glibtop_open_s (glibtop *server, const char *program_name,
|
|||||||
|
|
||||||
server->ncpu = 0;
|
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);
|
fd = open (FILENAME, O_RDONLY);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
glibtop_error_io_r (server, "open (%s)", FILENAME);
|
glibtop_error_io_r (server, "open (%s)", FILENAME);
|
||||||
|
Reference in New Issue
Block a user