Reflect latest interface changes; return 0 on success and -1 on error.

This commit is contained in:
Martin Baulig
1999-11-21 16:54:36 +00:00
parent cdc8e43a79
commit 81176f8181
20 changed files with 158 additions and 53 deletions

View File

@@ -43,6 +43,8 @@ glibtop_init_proc_time_s (glibtop *server)
if (server->ncpu)
server->sysdeps.proc_time |= _glibtop_sysdeps_proc_time_smp;
return 0;
}
/* Provides detailed information about a process. */
@@ -58,10 +60,10 @@ glibtop_get_proc_time_s (glibtop *server, glibtop_proc_time *buf, pid_t pid)
memset (buf, 0, sizeof (glibtop_proc_time));
if (proc_stat_to_buffer (buffer, pid))
return;
return -1;
p = proc_stat_after_cmd (buffer);
if (!p) return;
if (!p) return -1;
p = skip_multiple_token (p, 11);
@@ -81,10 +83,10 @@ glibtop_get_proc_time_s (glibtop *server, glibtop_proc_time *buf, pid_t pid)
buf->flags = _glibtop_sysdeps_proc_time;
if (!server->ncpu)
return;
return 0;
if (proc_file_to_buffer (buffer, "/proc/%d/cpu", pid))
return;
return -1;
p = skip_token (buffer);
buf->utime = strtoul (p, &p, 0);
@@ -100,4 +102,6 @@ glibtop_get_proc_time_s (glibtop *server, glibtop_proc_time *buf, pid_t pid)
}
buf->flags |= _glibtop_sysdeps_proc_time_smp;
return 0;
}