Reverted some stuff from 06-07-1998 since it was too buggy.
1998-06-18 Martin Baulig <baulig@taurus.uni-trier.de> * sysdeps/linux/*.c: Reverted some stuff from 06-07-1998 since it was too buggy.
This commit is contained in:
committed by
Martin Baulig
parent
3fcc477b25
commit
1b90ed4fcc
@@ -44,17 +44,10 @@ glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf)
|
||||
|
||||
buf->flags = _glibtop_sysdeps_cpu;
|
||||
|
||||
#ifdef GLIBTOP_CACHE_OPEN
|
||||
fd = server->machine.fd_stat;
|
||||
#endif
|
||||
if (fd == 0) {
|
||||
fd = open (FILENAME, O_RDONLY);
|
||||
if (fd == -1)
|
||||
glibtop_error_r (server, "open (%s): %s",
|
||||
FILENAME, strerror (errno));
|
||||
} else {
|
||||
lseek (fd, 0, SEEK_SET);
|
||||
}
|
||||
fd = open (FILENAME, O_RDONLY);
|
||||
if (fd == -1)
|
||||
glibtop_error_r (server, "open (%s): %s",
|
||||
FILENAME, strerror (errno));
|
||||
|
||||
ret = read (fd, buffer, BUFSIZ);
|
||||
if (ret == -1)
|
||||
@@ -63,6 +56,7 @@ glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf)
|
||||
|
||||
tmp = strchr (buffer, '\n');
|
||||
tmp = skip_token (tmp); /* "cpu" */
|
||||
|
||||
buf->user = strtoul (tmp, &tmp, 10);
|
||||
buf->nice = strtoul (tmp, &tmp, 10);
|
||||
buf->sys = strtoul (tmp, &tmp, 10);
|
||||
@@ -71,10 +65,5 @@ glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf)
|
||||
buf->total = buf->user + buf->nice + buf->sys + buf->idle;
|
||||
|
||||
buf->frequency = 100;
|
||||
|
||||
#ifdef GLIBTOP_CACHE_OPEN
|
||||
server->machine.fd_stat = fd;
|
||||
#else
|
||||
close (fd);
|
||||
#endif
|
||||
}
|
||||
|
@@ -42,17 +42,10 @@ glibtop_get_loadavg_s (glibtop *server, glibtop_loadavg *buf)
|
||||
|
||||
buf->flags = _glibtop_sysdeps_loadavg;
|
||||
|
||||
#ifdef GLIBTOP_CACHE_OPEN
|
||||
fd = server->machine.fd_loadavg;
|
||||
#endif
|
||||
if (fd == 0) {
|
||||
fd = open (FILENAME, O_RDONLY);
|
||||
if (fd == -1)
|
||||
glibtop_error_r (server, "open (%s): %s",
|
||||
FILENAME, strerror (errno));
|
||||
} else {
|
||||
lseek (fd, 0, SEEK_SET);
|
||||
}
|
||||
fd = open (FILENAME, O_RDONLY);
|
||||
if (fd == -1)
|
||||
glibtop_error_r (server, "open (%s): %s",
|
||||
FILENAME, strerror (errno));
|
||||
|
||||
ret = read (fd, buffer, BUFSIZ);
|
||||
if (ret == -1)
|
||||
@@ -63,9 +56,5 @@ glibtop_get_loadavg_s (glibtop *server, glibtop_loadavg *buf)
|
||||
buf->loadavg [1] = strtod (tmp, &tmp);
|
||||
buf->loadavg [2] = strtod (tmp, &tmp);
|
||||
|
||||
#ifdef GLIBTOP_CACHE_OPEN
|
||||
server->machine.fd_loadavg = fd;
|
||||
#else
|
||||
close (fd);
|
||||
#endif
|
||||
}
|
||||
|
@@ -45,17 +45,10 @@ glibtop_get_mem_s (glibtop *server, glibtop_mem *buf)
|
||||
|
||||
buf->flags = _glibtop_sysdeps_mem;
|
||||
|
||||
#ifdef GLIBTOP_CACHE_OPEN
|
||||
fd = server->machine.fd_meminfo;
|
||||
#endif
|
||||
if (fd == 0) {
|
||||
fd = open (FILENAME, O_RDONLY);
|
||||
if (fd == -1)
|
||||
glibtop_error_r (server, "open (%s): %s",
|
||||
FILENAME, strerror (errno));
|
||||
} else {
|
||||
lseek (fd, 0, SEEK_SET);
|
||||
}
|
||||
fd = open (FILENAME, O_RDONLY);
|
||||
if (fd == -1)
|
||||
glibtop_error_r (server, "open (%s): %s",
|
||||
FILENAME, strerror (errno));
|
||||
|
||||
ret = read (fd, buffer, BUFSIZ);
|
||||
if (ret == -1)
|
||||
@@ -75,9 +68,5 @@ glibtop_get_mem_s (glibtop *server, glibtop_mem *buf)
|
||||
|
||||
buf->user = buf->total - buf->free - buf->shared - buf->buffer;
|
||||
|
||||
#ifdef GLIBTOP_CACHE_OPEN
|
||||
server->machine.fd_meminfo = fd;
|
||||
#else
|
||||
close (fd);
|
||||
#endif
|
||||
}
|
||||
|
@@ -47,36 +47,20 @@ glibtop_get_proc_kernel_s (glibtop *server, glibtop_proc_kernel *buf, pid_t pid)
|
||||
return;
|
||||
}
|
||||
|
||||
if (pid != server->machine.last_pid) {
|
||||
server->machine.last_pid = pid;
|
||||
server->machine.no_update = 0;
|
||||
}
|
||||
sprintf (input, "/proc/%d/stat", pid);
|
||||
|
||||
if (!server->machine.no_update) {
|
||||
server->machine.proc_status [0] = 0;
|
||||
server->machine.proc_statm [0] = 0;
|
||||
server->machine.proc_stat [0] = 0;
|
||||
}
|
||||
fd = open (input, O_RDONLY);
|
||||
if (fd == -1)
|
||||
glibtop_error_r (server, "open (%s): %s",
|
||||
input, strerror (errno));
|
||||
|
||||
if (server->machine.proc_stat [0]) {
|
||||
strcpy (buffer, server->machine.proc_stat);
|
||||
} else {
|
||||
sprintf (input, "/proc/%d/stat", pid);
|
||||
nread = read (fd, buffer, BUFSIZ);
|
||||
if (nread == -1)
|
||||
glibtop_error_r (server, "read (%s): %s",
|
||||
input, strerror (errno));
|
||||
|
||||
fd = open (input, O_RDONLY);
|
||||
if (fd == -1)
|
||||
glibtop_error_r (server, "open (%s): %s",
|
||||
input, strerror (errno));
|
||||
|
||||
nread = read (fd, buffer, BUFSIZ);
|
||||
if (nread == -1)
|
||||
glibtop_error_r (server, "read (%s): %s",
|
||||
input, strerror (errno));
|
||||
|
||||
buffer [nread] = 0;
|
||||
strcpy (server->machine.proc_stat, buffer);
|
||||
close (fd);
|
||||
}
|
||||
buffer [nread] = 0;
|
||||
close (fd);
|
||||
|
||||
/* This is from guile-utils/gtop/proc/readproc.c */
|
||||
|
||||
|
@@ -46,36 +46,20 @@ glibtop_get_proc_mem_s (glibtop *server, glibtop_proc_mem *buf, pid_t pid)
|
||||
return;
|
||||
}
|
||||
|
||||
if (pid != server->machine.last_pid) {
|
||||
server->machine.last_pid = pid;
|
||||
server->machine.no_update = 0;
|
||||
}
|
||||
sprintf (input, "/proc/%d/stat", pid);
|
||||
|
||||
if (!server->machine.no_update) {
|
||||
server->machine.proc_status [0] = 0;
|
||||
server->machine.proc_statm [0] = 0;
|
||||
server->machine.proc_stat [0] = 0;
|
||||
}
|
||||
fd = open (input, O_RDONLY);
|
||||
if (fd == -1)
|
||||
glibtop_error_r (server, "open (%s): %s",
|
||||
input, strerror (errno));
|
||||
|
||||
if (server->machine.proc_stat [0]) {
|
||||
strcpy (buffer, server->machine.proc_stat);
|
||||
} else {
|
||||
sprintf (input, "/proc/%d/stat", pid);
|
||||
nread = read (fd, buffer, BUFSIZ);
|
||||
if (nread == -1)
|
||||
glibtop_error_r (server, "read (%s): %s",
|
||||
input, strerror (errno));
|
||||
|
||||
fd = open (input, O_RDONLY);
|
||||
if (fd == -1)
|
||||
glibtop_error_r (server, "open (%s): %s",
|
||||
input, strerror (errno));
|
||||
|
||||
nread = read (fd, buffer, BUFSIZ);
|
||||
if (nread == -1)
|
||||
glibtop_error_r (server, "read (%s): %s",
|
||||
input, strerror (errno));
|
||||
|
||||
buffer [nread] = 0;
|
||||
strcpy (server->machine.proc_stat, buffer);
|
||||
close (fd);
|
||||
}
|
||||
buffer [nread] = 0;
|
||||
close (fd);
|
||||
|
||||
/* This is from guile-utils/gtop/proc/readproc.c */
|
||||
|
||||
@@ -88,25 +72,20 @@ glibtop_get_proc_mem_s (glibtop *server, glibtop_proc_mem *buf, pid_t pid)
|
||||
"%*d %*d %*d %*d %*d %*d %*u %*u %*d %lu "
|
||||
"%lu %lu", &buf->vsize, &buf->rss, &buf->rss_rlim);
|
||||
|
||||
if (server->machine.proc_statm [0]) {
|
||||
strcpy (buffer, server->machine.proc_statm);
|
||||
} else {
|
||||
sprintf (input, "/proc/%d/statm", pid);
|
||||
sprintf (input, "/proc/%d/statm", pid);
|
||||
|
||||
fd = open (input, O_RDONLY);
|
||||
if (fd == -1)
|
||||
glibtop_error_r (server, "open (%s): %s",
|
||||
input, strerror (errno));
|
||||
fd = open (input, O_RDONLY);
|
||||
if (fd == -1)
|
||||
glibtop_error_r (server, "open (%s): %s",
|
||||
input, strerror (errno));
|
||||
|
||||
nread = read (fd, buffer, BUFSIZ);
|
||||
if (nread == -1)
|
||||
glibtop_error_r (server, "read (%s): %s",
|
||||
input, strerror (errno));
|
||||
nread = read (fd, buffer, BUFSIZ);
|
||||
if (nread == -1)
|
||||
glibtop_error_r (server, "read (%s): %s",
|
||||
input, strerror (errno));
|
||||
|
||||
buffer [nread] = 0;
|
||||
strcpy (server->machine.proc_statm, buffer);
|
||||
close (fd);
|
||||
}
|
||||
buffer [nread] = 0;
|
||||
close (fd);
|
||||
|
||||
sscanf (buffer, "%ld %ld %ld",
|
||||
&buf->size, &buf->resident, &buf->share);
|
||||
|
@@ -48,36 +48,20 @@ glibtop_get_proc_segment_s (glibtop *server, glibtop_proc_segment *buf,
|
||||
return;
|
||||
}
|
||||
|
||||
if (pid != server->machine.last_pid) {
|
||||
server->machine.last_pid = pid;
|
||||
server->machine.no_update = 0;
|
||||
}
|
||||
sprintf (input, "/proc/%d/stat", pid);
|
||||
|
||||
if (!server->machine.no_update) {
|
||||
server->machine.proc_status [0] = 0;
|
||||
server->machine.proc_statm [0] = 0;
|
||||
server->machine.proc_stat [0] = 0;
|
||||
}
|
||||
fd = open (input, O_RDONLY);
|
||||
if (fd == -1)
|
||||
glibtop_error_r (server, "open (%s): %s",
|
||||
input, strerror (errno));
|
||||
|
||||
if (server->machine.proc_stat [0]) {
|
||||
strcpy (buffer, server->machine.proc_stat);
|
||||
} else {
|
||||
sprintf (input, "/proc/%d/stat", pid);
|
||||
nread = read (fd, buffer, BUFSIZ);
|
||||
if (nread == -1)
|
||||
glibtop_error_r (server, "read (%s): %s",
|
||||
input, strerror (errno));
|
||||
|
||||
fd = open (input, O_RDONLY);
|
||||
if (fd == -1)
|
||||
glibtop_error_r (server, "open (%s): %s",
|
||||
input, strerror (errno));
|
||||
|
||||
nread = read (fd, buffer, BUFSIZ);
|
||||
if (nread == -1)
|
||||
glibtop_error_r (server, "read (%s): %s",
|
||||
input, strerror (errno));
|
||||
|
||||
buffer [nread] = 0;
|
||||
strcpy (server->machine.proc_stat, buffer);
|
||||
close (fd);
|
||||
}
|
||||
buffer [nread] = 0;
|
||||
close (fd);
|
||||
|
||||
/* This is from guile-utils/gtop/proc/readproc.c */
|
||||
|
||||
@@ -91,25 +75,20 @@ glibtop_get_proc_segment_s (glibtop *server, glibtop_proc_segment *buf,
|
||||
"%*u %*u %lu %lu %lu", &buf->start_code,
|
||||
&buf->end_code, &buf->start_stack);
|
||||
|
||||
if (server->machine.proc_statm [0]) {
|
||||
strcpy (buffer, server->machine.proc_statm);
|
||||
} else {
|
||||
sprintf (input, "/proc/%d/statm", pid);
|
||||
sprintf (input, "/proc/%d/statm", pid);
|
||||
|
||||
fd = open (input, O_RDONLY);
|
||||
if (fd == -1)
|
||||
glibtop_error_r (server, "open (%s): %s",
|
||||
input, strerror (errno));
|
||||
fd = open (input, O_RDONLY);
|
||||
if (fd == -1)
|
||||
glibtop_error_r (server, "open (%s): %s",
|
||||
input, strerror (errno));
|
||||
|
||||
nread = read (fd, buffer, BUFSIZ);
|
||||
if (nread == -1)
|
||||
glibtop_error_r (server, "read (%s): %s",
|
||||
input, strerror (errno));
|
||||
nread = read (fd, buffer, BUFSIZ);
|
||||
if (nread == -1)
|
||||
glibtop_error_r (server, "read (%s): %s",
|
||||
input, strerror (errno));
|
||||
|
||||
buffer [nread] = 0;
|
||||
strcpy (server->machine.proc_statm, buffer);
|
||||
close (fd);
|
||||
}
|
||||
buffer [nread] = 0;
|
||||
close (fd);
|
||||
|
||||
sscanf (buffer, "%*d %*d %*d %ld %ld %ld %ld",
|
||||
&buf->trs, &buf->lrs, &buf->drs, &buf->dt);
|
||||
|
@@ -45,36 +45,20 @@ glibtop_get_proc_signal_s (glibtop *server, glibtop_proc_signal *buf, pid_t pid)
|
||||
return;
|
||||
}
|
||||
|
||||
if (pid != server->machine.last_pid) {
|
||||
server->machine.last_pid = pid;
|
||||
server->machine.no_update = 0;
|
||||
}
|
||||
sprintf (input, "/proc/%d/stat", pid);
|
||||
|
||||
if (!server->machine.no_update) {
|
||||
server->machine.proc_status [0] = 0;
|
||||
server->machine.proc_statm [0] = 0;
|
||||
server->machine.proc_stat [0] = 0;
|
||||
}
|
||||
fd = open (input, O_RDONLY);
|
||||
if (fd == -1)
|
||||
glibtop_error_r (server, "open (%s): %s",
|
||||
input, strerror (errno));
|
||||
|
||||
if (server->machine.proc_stat [0]) {
|
||||
strcpy (buffer, server->machine.proc_stat);
|
||||
} else {
|
||||
sprintf (input, "/proc/%d/stat", pid);
|
||||
nread = read (fd, buffer, BUFSIZ);
|
||||
if (nread == -1)
|
||||
glibtop_error_r (server, "read (%s): %s",
|
||||
input, strerror (errno));
|
||||
|
||||
fd = open (input, O_RDONLY);
|
||||
if (fd == -1)
|
||||
glibtop_error_r (server, "open (%s): %s",
|
||||
input, strerror (errno));
|
||||
|
||||
nread = read (fd, buffer, BUFSIZ);
|
||||
if (nread == -1)
|
||||
glibtop_error_r (server, "read (%s): %s",
|
||||
input, strerror (errno));
|
||||
|
||||
buffer [nread] = 0;
|
||||
strcpy (server->machine.proc_stat, buffer);
|
||||
close (fd);
|
||||
}
|
||||
buffer [nread] = 0;
|
||||
close (fd);
|
||||
|
||||
/* This is from guile-utils/gtop/proc/readproc.c */
|
||||
|
||||
|
@@ -48,12 +48,6 @@ glibtop_get_proc_state_s (glibtop *server, glibtop_proc_state *buf, pid_t pid)
|
||||
return;
|
||||
}
|
||||
|
||||
server->machine.last_pid = pid;
|
||||
server->machine.no_update = 0;
|
||||
server->machine.proc_status [0] = 0;
|
||||
server->machine.proc_statm [0] = 0;
|
||||
server->machine.proc_stat [0] = 0;
|
||||
|
||||
sprintf (input, "/proc/%d/stat", pid);
|
||||
|
||||
/* IMPORTANT NOTICE: For security reasons it is extremely important
|
||||
@@ -80,9 +74,6 @@ glibtop_get_proc_state_s (glibtop *server, glibtop_proc_state *buf, pid_t pid)
|
||||
|
||||
buffer [nread] = 0;
|
||||
|
||||
server->machine.last_pid = pid;
|
||||
strcpy (server->machine.proc_stat, buffer);
|
||||
|
||||
/* This is from guile-utils/gtop/proc/readproc.c */
|
||||
|
||||
/* split into "PID (cmd" and "<rest>" */
|
||||
|
@@ -47,36 +47,20 @@ glibtop_get_proc_time_s (glibtop *server, glibtop_proc_time *buf, pid_t pid)
|
||||
return;
|
||||
}
|
||||
|
||||
if (pid != server->machine.last_pid) {
|
||||
server->machine.last_pid = pid;
|
||||
server->machine.no_update = 0;
|
||||
}
|
||||
sprintf (input, "/proc/%d/stat", pid);
|
||||
|
||||
if (!server->machine.no_update) {
|
||||
server->machine.proc_status [0] = 0;
|
||||
server->machine.proc_statm [0] = 0;
|
||||
server->machine.proc_stat [0] = 0;
|
||||
}
|
||||
fd = open (input, O_RDONLY);
|
||||
if (fd == -1)
|
||||
glibtop_error_r (server, "open (%s): %s",
|
||||
input, strerror (errno));
|
||||
|
||||
if (server->machine.proc_stat [0]) {
|
||||
strcpy (buffer, server->machine.proc_stat);
|
||||
} else {
|
||||
sprintf (input, "/proc/%d/stat", pid);
|
||||
nread = read (fd, buffer, BUFSIZ);
|
||||
if (nread == -1)
|
||||
glibtop_error_r (server, "read (%s): %s",
|
||||
input, strerror (errno));
|
||||
|
||||
fd = open (input, O_RDONLY);
|
||||
if (fd == -1)
|
||||
glibtop_error_r (server, "open (%s): %s",
|
||||
input, strerror (errno));
|
||||
|
||||
nread = read (fd, buffer, BUFSIZ);
|
||||
if (nread == -1)
|
||||
glibtop_error_r (server, "read (%s): %s",
|
||||
input, strerror (errno));
|
||||
|
||||
buffer [nread] = 0;
|
||||
strcpy (server->machine.proc_stat, buffer);
|
||||
close (fd);
|
||||
}
|
||||
buffer [nread] = 0;
|
||||
close (fd);
|
||||
|
||||
/* This is from guile-utils/gtop/proc/readproc.c */
|
||||
|
||||
|
@@ -51,36 +51,20 @@ glibtop_get_proc_uid_s (glibtop *server, glibtop_proc_uid *buf, pid_t pid)
|
||||
return;
|
||||
}
|
||||
|
||||
if (pid != server->machine.last_pid) {
|
||||
server->machine.last_pid = pid;
|
||||
server->machine.no_update = 0;
|
||||
}
|
||||
sprintf (input, "/proc/%d/status", pid);
|
||||
|
||||
if (!server->machine.no_update) {
|
||||
server->machine.proc_status [0] = 0;
|
||||
server->machine.proc_statm [0] = 0;
|
||||
server->machine.proc_stat [0] = 0;
|
||||
}
|
||||
fd = open (input, O_RDONLY);
|
||||
if (fd == -1)
|
||||
glibtop_error_r (server, "open (%s): %s",
|
||||
input, strerror (errno));
|
||||
|
||||
if (server->machine.proc_status [0]) {
|
||||
strcpy (buffer, server->machine.proc_status);
|
||||
} else {
|
||||
sprintf (input, "/proc/%d/status", pid);
|
||||
nread = read (fd, buffer, BUFSIZ);
|
||||
if (nread == -1)
|
||||
glibtop_error_r (server, "read (%s): %s",
|
||||
input, strerror (errno));
|
||||
|
||||
fd = open (input, O_RDONLY);
|
||||
if (fd == -1)
|
||||
glibtop_error_r (server, "open (%s): %s",
|
||||
input, strerror (errno));
|
||||
|
||||
nread = read (fd, buffer, BUFSIZ);
|
||||
if (nread == -1)
|
||||
glibtop_error_r (server, "read (%s): %s",
|
||||
input, strerror (errno));
|
||||
|
||||
buffer [nread] = 0;
|
||||
strcpy (server->machine.proc_status, buffer);
|
||||
close (fd);
|
||||
}
|
||||
buffer [nread] = 0;
|
||||
close (fd);
|
||||
|
||||
/* Search substring 'Pid:' */
|
||||
|
||||
@@ -92,25 +76,20 @@ glibtop_get_proc_uid_s (glibtop *server, glibtop_proc_uid *buf, pid_t pid)
|
||||
"Gid: %u %u %*u %*u\n", &buf->pid, &buf->ppid,
|
||||
&buf->uid, &buf->euid, &buf->gid, &buf->egid);
|
||||
|
||||
if (server->machine.proc_stat [0]) {
|
||||
strcpy (buffer, server->machine.proc_stat);
|
||||
} else {
|
||||
sprintf (input, "/proc/%d/stat", pid);
|
||||
sprintf (input, "/proc/%d/stat", pid);
|
||||
|
||||
fd = open (input, O_RDONLY);
|
||||
if (fd == -1)
|
||||
glibtop_error_r (server, "open (%s): %s",
|
||||
input, strerror (errno));
|
||||
fd = open (input, O_RDONLY);
|
||||
if (fd == -1)
|
||||
glibtop_error_r (server, "open (%s): %s",
|
||||
input, strerror (errno));
|
||||
|
||||
nread = read (fd, buffer, BUFSIZ);
|
||||
if (nread == -1)
|
||||
glibtop_error_r (server, "read (%s): %s",
|
||||
input, strerror (errno));
|
||||
nread = read (fd, buffer, BUFSIZ);
|
||||
if (nread == -1)
|
||||
glibtop_error_r (server, "read (%s): %s",
|
||||
input, strerror (errno));
|
||||
|
||||
buffer [nread] = 0;
|
||||
strcpy (server->machine.proc_stat, buffer);
|
||||
close (fd);
|
||||
}
|
||||
buffer [nread] = 0;
|
||||
close (fd);
|
||||
|
||||
/* This is from guile-utils/gtop/proc/readproc.c */
|
||||
|
||||
|
@@ -43,17 +43,10 @@ glibtop_get_swap_s (glibtop *server, glibtop_swap *buf)
|
||||
|
||||
buf->flags = _glibtop_sysdeps_swap;
|
||||
|
||||
#ifdef GLIBTOP_CACHE_OPEN
|
||||
fd = server->machine.fd_meminfo;
|
||||
#endif
|
||||
if (fd == 0) {
|
||||
fd = open (FILENAME, O_RDONLY);
|
||||
if (fd == -1)
|
||||
glibtop_error_r (server, "open (%s): %s",
|
||||
FILENAME, strerror (errno));
|
||||
} else {
|
||||
lseek (fd, 0, SEEK_SET);
|
||||
}
|
||||
fd = open (FILENAME, O_RDONLY);
|
||||
if (fd == -1)
|
||||
glibtop_error_r (server, "open (%s): %s",
|
||||
FILENAME, strerror (errno));
|
||||
|
||||
ret = read (fd, buffer, BUFSIZ);
|
||||
if (ret == -1)
|
||||
@@ -64,13 +57,10 @@ glibtop_get_swap_s (glibtop *server, glibtop_swap *buf)
|
||||
tmp = strchr (tmp+1, '\n');
|
||||
|
||||
tmp = skip_token (tmp); /* "Swap:" */
|
||||
|
||||
buf->total = strtoul (tmp, &tmp, 10);
|
||||
buf->used = strtoul (tmp, &tmp, 10);
|
||||
buf->free = strtoul (tmp, &tmp, 10);
|
||||
|
||||
#ifdef GLIBTOP_CACHE_OPEN
|
||||
server->machine.fd_meminfo = fd;
|
||||
#else
|
||||
close (fd);
|
||||
#endif
|
||||
}
|
||||
|
Reference in New Issue
Block a user