Using u_int64_t' instead of
unsigned long' and `long' to avoid problems
1998-07-30 Martin Baulig <martin@home-of-linux.org> * include/glibtop/*.h: Using `u_int64_t' instead of `unsigned long' and `long' to avoid problems when client is on a 32bit system and the server on a 64bit system.
This commit is contained in:
committed by
Martin Baulig
parent
d18a6cf2ce
commit
902b6a8f16
@@ -46,7 +46,7 @@ glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf)
|
||||
f = fopen ("/proc/stat", "r");
|
||||
if (!f) return;
|
||||
|
||||
fscanf (f, "cpu %lu %lu %lu %lu\n",
|
||||
fscanf (f, "cpu %Lu %Lu %Lu %Lu\n",
|
||||
&buf->user, &buf->nice, &buf->sys, &buf->idle);
|
||||
|
||||
buf->total = buf->user + buf->nice + buf->sys + buf->idle;
|
||||
|
@@ -47,7 +47,7 @@ glibtop_get_mem_s (glibtop *server, glibtop_mem *buf)
|
||||
f = fopen ("/proc/meminfo", "r");
|
||||
if (!f) return;
|
||||
|
||||
fscanf (f, "%*[^\n]\nMem: %lu %lu %lu %lu %lu %lu\n",
|
||||
fscanf (f, "%*[^\n]\nMem: %Lu %Lu %Lu %Lu %Lu %Lu\n",
|
||||
&buf->total, &buf->used, &buf->free, &buf->shared,
|
||||
&buf->buffer, &buf->cached);
|
||||
|
||||
|
@@ -70,9 +70,9 @@ glibtop_get_proc_kernel_s (glibtop *server, glibtop_proc_kernel *buf, pid_t pid)
|
||||
/* parse these two strings separately, skipping the leading "(". */
|
||||
|
||||
sscanf(tmp + 2, /* skip space after ')' too */
|
||||
"%*c %*d %*d %*d %*d %*d %lu %lu %lu %lu %lu "
|
||||
"%*c %*d %*d %*d %*d %*d %Lu %Lu %Lu %Lu %Lu "
|
||||
"%*d %*d %*d %*d %*d %*d %*u %*u %*d %*u "
|
||||
"%*u %*u %*u %*u %*u %lu %lu %*d %*d %*d %*d %lu",
|
||||
"%*u %*u %*u %*u %*u %Lu %Lu %*d %*d %*d %*d %Lu",
|
||||
&buf->k_flags, &buf->min_flt, &buf->cmin_flt,
|
||||
&buf->maj_flt, &buf->cmaj_flt, &buf->kstk_esp,
|
||||
&buf->kstk_eip, &buf->wchan);
|
||||
|
@@ -69,8 +69,8 @@ glibtop_get_proc_mem_s (glibtop *server, glibtop_proc_mem *buf, pid_t pid)
|
||||
/* parse these two strings separately, skipping the leading "(". */
|
||||
sscanf(tmp + 2, /* skip space after ')' too */
|
||||
"%*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %*u "
|
||||
"%*d %*d %*d %*d %*d %*d %*u %*u %*d %lu "
|
||||
"%lu %lu", &buf->vsize, &buf->rss, &buf->rss_rlim);
|
||||
"%*d %*d %*d %*d %*d %*d %*u %*u %*d %Lu "
|
||||
"%Lu %Lu", &buf->vsize, &buf->rss, &buf->rss_rlim);
|
||||
|
||||
fclose (f);
|
||||
|
||||
@@ -88,7 +88,7 @@ glibtop_get_proc_mem_s (glibtop *server, glibtop_proc_mem *buf, pid_t pid)
|
||||
|
||||
input [nread] = 0;
|
||||
|
||||
sscanf (input, "%ld %ld %ld",
|
||||
sscanf (input, "%Lu %Lu %Lu",
|
||||
&buf->size, &buf->resident, &buf->share);
|
||||
|
||||
fclose (f);
|
||||
|
@@ -72,7 +72,7 @@ glibtop_get_proc_segment_s (glibtop *server, glibtop_proc_segment *buf,
|
||||
sscanf(tmp + 2, /* skip space after ')' too */
|
||||
"%*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %*u "
|
||||
"%*d %*d %*d %*d %*d %*d %*u %*u %*d %*u "
|
||||
"%*u %*u %lu %lu %lu", &buf->start_code,
|
||||
"%*u %*u %Lu %Lu %Lu", &buf->start_code,
|
||||
&buf->end_code, &buf->start_stack);
|
||||
|
||||
fclose (f);
|
||||
@@ -91,7 +91,7 @@ glibtop_get_proc_segment_s (glibtop *server, glibtop_proc_segment *buf,
|
||||
|
||||
input [nread] = 0;
|
||||
|
||||
sscanf (input, "%*d %*d %*d %ld %ld %ld %ld",
|
||||
sscanf (input, "%*d %*d %*d %Lu %Lu %Lu %Lu",
|
||||
&buf->trs, &buf->lrs, &buf->drs, &buf->dt);
|
||||
|
||||
fclose (f);
|
||||
|
@@ -69,7 +69,7 @@ glibtop_get_proc_signal_s (glibtop *server, glibtop_proc_signal *buf, pid_t pid)
|
||||
sscanf(tmp + 2, /* skip space after ')' too */
|
||||
"%*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %*u "
|
||||
"%*d %*d %*d %*d %*d %*d %*u %*u %*d %*u "
|
||||
"%*u %*u %*u %*u %*u %*u %*u %d %d %d %d",
|
||||
"%*u %*u %*u %*u %*u %*u %*u %Lu %Lu %Lu %Lu",
|
||||
&buf->signal, &buf->blocked, &buf->sigignore,
|
||||
&buf->sigcatch);
|
||||
|
||||
|
@@ -70,7 +70,7 @@ glibtop_get_proc_time_s (glibtop *server, glibtop_proc_time *buf, pid_t pid)
|
||||
/* parse these two strings separately, skipping the leading "(". */
|
||||
sscanf(tmp + 2, /* skip space after ')' too */
|
||||
"%*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %*u "
|
||||
"%ld %ld %ld %ld %*d %*d %lu %lu %ld",
|
||||
"%Lu %Lu %Lu %Lu %*d %*d %Lu %Lu %Lu",
|
||||
&buf->utime, &buf->stime, &buf->cutime, &buf->cstime,
|
||||
&buf->timeout, &buf->it_real_value, &buf->start_time);
|
||||
|
||||
|
@@ -45,7 +45,7 @@ glibtop_get_swap_s (glibtop *server, glibtop_swap *buf)
|
||||
f = fopen ("/proc/meminfo", "r");
|
||||
if (!f) return;
|
||||
|
||||
fscanf (f, "%*[^\n]\n%*[^\n]\nSwap: %lu %lu %lu\n",
|
||||
fscanf (f, "%*[^\n]\n%*[^\n]\nSwap: %Lu %Lu %Lu\n",
|
||||
&buf->total, &buf->used, &buf->free);
|
||||
|
||||
fclose (f);
|
||||
|
Reference in New Issue
Block a user