kvm_read () returns the number of bytes read and not zero on success.
This commit is contained in:
@@ -66,7 +66,7 @@ glibtop_get_cpu_p (glibtop *server, glibtop_cpu *buf)
|
|||||||
memset (buf, 0, sizeof (glibtop_cpu));
|
memset (buf, 0, sizeof (glibtop_cpu));
|
||||||
|
|
||||||
if (kvm_read (server->machine.kd, nlst [0].n_value,
|
if (kvm_read (server->machine.kd, nlst [0].n_value,
|
||||||
&cpts, sizeof (cpts)))
|
&cpts, sizeof (cpts)) != sizeof (cpts))
|
||||||
glibtop_error_io_r (server, "kvm_read (cp_time)");
|
glibtop_error_io_r (server, "kvm_read (cp_time)");
|
||||||
|
|
||||||
/* Get the clockrate data */
|
/* Get the clockrate data */
|
||||||
|
@@ -55,7 +55,6 @@ glibtop_init_mem_p (glibtop *server)
|
|||||||
|
|
||||||
if (kvm_nlist (server->machine.kd, nlst) != 0)
|
if (kvm_nlist (server->machine.kd, nlst) != 0)
|
||||||
glibtop_error_io_r (server, "kvm_nlist");
|
glibtop_error_io_r (server, "kvm_nlist");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -78,11 +77,11 @@ glibtop_get_mem_p (glibtop *server, glibtop_mem *buf)
|
|||||||
|
|
||||||
/* Get the data from kvm_* */
|
/* Get the data from kvm_* */
|
||||||
if (kvm_read (server->machine.kd, nlst[0].n_value,
|
if (kvm_read (server->machine.kd, nlst[0].n_value,
|
||||||
&vmm, sizeof (vmm)))
|
&vmm, sizeof (vmm)) != sizeof (vmm))
|
||||||
glibtop_error_io_r (server, "kvm_read (cnt)");
|
glibtop_error_io_r (server, "kvm_read (cnt)");
|
||||||
|
|
||||||
if (kvm_read (server->machine.kd, nlst[1].n_value,
|
if (kvm_read (server->machine.kd, nlst[1].n_value,
|
||||||
&bufspace, sizeof (bufspace)))
|
&bufspace, sizeof (bufspace)) != sizeof (bufspace))
|
||||||
glibtop_error_io_r (server, "kvm_read (bufspace)");
|
glibtop_error_io_r (server, "kvm_read (bufspace)");
|
||||||
|
|
||||||
/* Set the values to return */
|
/* Set the values to return */
|
||||||
|
Reference in New Issue
Block a user