It does not work to get information about the swapper task on FreeBSD

1998-11-11  Martin Baulig  <martin@home-of-linux.org>

	* *.c: It does not work to get information about the swapper task
	on FreeBSD 2.2.6, so we simple return if pid == 0.
This commit is contained in:
Martin Baulig
1998-11-11 15:58:22 +00:00
committed by Martin Baulig
parent fffabe63b7
commit d46c6227fb
9 changed files with 43 additions and 7 deletions

View File

@@ -1,3 +1,8 @@
1998-11-11 Martin Baulig <martin@home-of-linux.org>
* *.c: It does not work to get information about the swapper task
on FreeBSD 2.2.6, so we simple return if pid == 0.
1998-10-31 Martin Baulig <martin@home-of-linux.org> 1998-10-31 Martin Baulig <martin@home-of-linux.org>
* *.c: Use glibtop_warn_io_r () instead of glibtop_error_io_r (). * *.c: Use glibtop_warn_io_r () instead of glibtop_error_io_r ().

View File

@@ -59,20 +59,26 @@ glibtop_get_proc_args_p (glibtop *server, glibtop_proc_args *buf,
memset (buf, 0, sizeof (glibtop_proc_args)); memset (buf, 0, sizeof (glibtop_proc_args));
/* swapper, init, pagedaemon, vmdaemon, update - this doen't work. */
if (pid < 5) return NULL;
sprintf (filename, "/proc/%d/mem", pid); sprintf (filename, "/proc/%d/mem", pid);
if (stat (filename, &statb)) return NULL; if (stat (filename, &statb)) return NULL;
glibtop_suid_enter (server);
/* Get the process data */ /* Get the process data */
pinfo = kvm_getprocs (server->machine.kd, KERN_PROC_PID, pid, &count); pinfo = kvm_getprocs (server->machine.kd, KERN_PROC_PID, pid, &count);
if ((pinfo == NULL) || (count < 1)) if ((pinfo == NULL) || (count < 1)) {
glibtop_error_io_r (server, "kvm_getprocs (proc_args)"); glibtop_suid_leave (server);
glibtop_warn_io_r (server, "kvm_getprocs (%d)", pid);
glibtop_suid_enter (server); return NULL;
}
args = kvm_getargv (server->machine.kd, pinfo, max_len); args = kvm_getargv (server->machine.kd, pinfo, max_len);
if (args == NULL) { if (args == NULL) {
glibtop_warn_io_r (server, "kvm_getargv");
glibtop_suid_leave (server); glibtop_suid_leave (server);
glibtop_warn_io_r (server, "kvm_getargv (%d)", pid);
return NULL; return NULL;
} }

View File

@@ -81,6 +81,9 @@ glibtop_get_proc_kernel_p (glibtop *server,
if (server->sysdeps.proc_time == 0) if (server->sysdeps.proc_time == 0)
return; return;
/* It does not work for the swapper task. */
if (pid == 0) return;
/* Get the process information */ /* Get the process information */
pinfo = kvm_getprocs (server->machine.kd, KERN_PROC_PID, pid, &count); pinfo = kvm_getprocs (server->machine.kd, KERN_PROC_PID, pid, &count);
if ((pinfo == NULL) || (count != 1)) if ((pinfo == NULL) || (count != 1))

View File

@@ -78,12 +78,19 @@ glibtop_get_proc_map_p (glibtop *server, glibtop_proc_map *buf,
int count, i = 0; int count, i = 0;
int update = 0; int update = 0;
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_MAP), 0);
memset (buf, 0, sizeof (glibtop_proc_map));
/* It does not work for the swapper task. */
if (pid == 0) return NULL;
glibtop_suid_enter (server); glibtop_suid_enter (server);
/* Get the process data */ /* Get the process data */
pinfo = kvm_getprocs (server->machine.kd, KERN_PROC_PID, pid, &count); pinfo = kvm_getprocs (server->machine.kd, KERN_PROC_PID, pid, &count);
if ((pinfo == NULL) || (count < 1)) if ((pinfo == NULL) || (count < 1))
glibtop_error_io_r (server, "kvm_getprocs (proclist)"); glibtop_error_io_r (server, "kvm_getprocs (%d)", pid);
/* Now we get the memory maps. */ /* Now we get the memory maps. */

View File

@@ -101,10 +101,13 @@ glibtop_get_proc_mem_p (glibtop *server, glibtop_proc_mem *buf,
if (server->sysdeps.proc_mem == 0) if (server->sysdeps.proc_mem == 0)
return; return;
/* It does not work for the swapper task. */
if (pid == 0) return;
/* Get the process data */ /* Get the process data */
pinfo = kvm_getprocs (server->machine.kd, KERN_PROC_PID, pid, &count); pinfo = kvm_getprocs (server->machine.kd, KERN_PROC_PID, pid, &count);
if ((pinfo == NULL) || (count < 1)) { if ((pinfo == NULL) || (count < 1)) {
glibtop_warn_io_r (server, "kvm_getprocs (proclist)"); glibtop_warn_io_r (server, "kvm_getprocs (%d)", pid);
return; return;
} }

View File

@@ -51,6 +51,9 @@ glibtop_get_proc_signal_p (glibtop *server,
memset (buf, 0, sizeof (glibtop_proc_signal)); memset (buf, 0, sizeof (glibtop_proc_signal));
/* It does not work for the swapper task. */
if (pid == 0) return;
/* Get the process information */ /* Get the process information */
pinfo = kvm_getprocs (server->machine.kd, KERN_PROC_PID, pid, &count); pinfo = kvm_getprocs (server->machine.kd, KERN_PROC_PID, pid, &count);
if ((pinfo == NULL) || (count != 1)) { if ((pinfo == NULL) || (count != 1)) {

View File

@@ -53,6 +53,9 @@ glibtop_get_proc_state_p (glibtop *server,
memset (buf, 0, sizeof (glibtop_proc_state)); memset (buf, 0, sizeof (glibtop_proc_state));
/* It does not work for the swapper task. */
if (pid == 0) return;
/* Get the process information */ /* Get the process information */
pinfo = kvm_getprocs (server->machine.kd, KERN_PROC_PID, pid, &count); pinfo = kvm_getprocs (server->machine.kd, KERN_PROC_PID, pid, &count);
if ((pinfo == NULL) || (count != 1)) { if ((pinfo == NULL) || (count != 1)) {

View File

@@ -117,6 +117,9 @@ glibtop_get_proc_time_p (glibtop *server, glibtop_proc_time *buf,
if (server->sysdeps.proc_time == 0) if (server->sysdeps.proc_time == 0)
return; return;
/* It does not work for the swapper task. */
if (pid == 0) return;
sprintf (filename, "/proc/%d/mem", pid); sprintf (filename, "/proc/%d/mem", pid);
if (stat (filename, &statb)) return; if (stat (filename, &statb)) return;

View File

@@ -53,6 +53,9 @@ glibtop_get_proc_uid_p (glibtop *server, glibtop_proc_uid *buf,
memset (buf, 0, sizeof (glibtop_proc_uid)); memset (buf, 0, sizeof (glibtop_proc_uid));
/* It does not work for the swapper task. */
if (pid == 0) return;
/* Get the process information */ /* Get the process information */
pinfo = kvm_getprocs (server->machine.kd, KERN_PROC_PID, pid, &count); pinfo = kvm_getprocs (server->machine.kd, KERN_PROC_PID, pid, &count);
if ((pinfo == NULL) || (count != 1)) { if ((pinfo == NULL) || (count != 1)) {