Use glibtop_warn_io_r () instead of glibtop_error_io_r ().
1998-10-31 Martin Baulig <martin@home-of-linux.org> * *.c: Use glibtop_warn_io_r () instead of glibtop_error_io_r (). * proctime.c, prockernel.c, procargs.c: Don't call kvm_uread () if the /proc filesystem is not mounted.
This commit is contained in:
committed by
Martin Baulig
parent
0fec2b7fb0
commit
82fdca61c2
@@ -71,17 +71,33 @@ glibtop_get_proc_kernel_p (glibtop *server,
|
||||
struct pcb pcb;
|
||||
int count;
|
||||
|
||||
char filename [BUFSIZ];
|
||||
struct stat statb;
|
||||
|
||||
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_KERNEL), 0);
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_proc_kernel));
|
||||
|
||||
glibtop_suid_enter (server);
|
||||
if (server->sysdeps.proc_time == 0)
|
||||
return;
|
||||
|
||||
/* Get the process information */
|
||||
pinfo = kvm_getprocs (server->machine.kd, KERN_PROC_PID, pid, &count);
|
||||
if ((pinfo == NULL) || (count != 1))
|
||||
glibtop_error_io_r (server, "kvm_getprocs (%d)", pid);
|
||||
|
||||
buf->nwchan = (unsigned long) pinfo [0].kp_proc.p_wchan &~ KERNBASE;
|
||||
buf->flags |= (1 << GLIBTOP_PROC_KERNEL_NWCHAN);
|
||||
|
||||
if (pinfo [0].kp_proc.p_wchan && pinfo [0].kp_proc.p_wmesg) {
|
||||
strncpy (buf->wchan, pinfo [0].kp_eproc.e_wmesg,
|
||||
sizeof (buf->wchan) - 1);
|
||||
buf->wchan [sizeof (buf->wchan) - 1] = 0;
|
||||
buf->flags |= (1 << GLIBTOP_PROC_KERNEL_WCHAN);
|
||||
} else {
|
||||
buf->wchan [0] = 0;
|
||||
}
|
||||
|
||||
/* Taken from `saveuser ()' in `/usr/src/bin/ps/ps.c'. */
|
||||
|
||||
/* [FIXME]: /usr/include/sys/user.h tells me that the user area
|
||||
@@ -92,7 +108,12 @@ glibtop_get_proc_kernel_p (glibtop *server,
|
||||
|
||||
/* NOTE: You need to mount the /proc filesystem to make
|
||||
* `kvm_uread' work. */
|
||||
|
||||
|
||||
sprintf (filename, "/proc/%d/mem", pid);
|
||||
if (stat (filename, &statb)) return;
|
||||
|
||||
glibtop_suid_enter (server);
|
||||
|
||||
if ((pinfo [0].kp_proc.p_flag & P_INMEM) &&
|
||||
kvm_uread (server->machine.kd, &(pinfo [0]).kp_proc,
|
||||
(unsigned long) &u_addr->u_stats,
|
||||
@@ -129,16 +150,4 @@ glibtop_get_proc_kernel_p (glibtop *server,
|
||||
/* Taken from `wchan ()' in `/usr/src/bin/ps/print.c'. */
|
||||
|
||||
glibtop_suid_leave (server);
|
||||
|
||||
buf->nwchan = (unsigned long) pinfo [0].kp_proc.p_wchan &~ KERNBASE;
|
||||
|
||||
if (pinfo [0].kp_proc.p_wchan && pinfo [0].kp_proc.p_wmesg) {
|
||||
strncpy (buf->wchan, pinfo [0].kp_eproc.e_wmesg,
|
||||
sizeof (buf->wchan) - 1);
|
||||
buf->wchan [sizeof (buf->wchan) - 1] = 0;
|
||||
} else {
|
||||
buf->wchan [0] = 0;
|
||||
}
|
||||
|
||||
buf->flags |= _glibtop_sysdeps_proc_kernel_wchan;
|
||||
}
|
||||
|
Reference in New Issue
Block a user