API: back out long long stuff; not needed

This commit is contained in:
David Anderson 2014-06-09 12:31:50 -07:00
parent f4b2f42ada
commit eaf1fe5876
1 changed files with 43 additions and 52 deletions

View File

@ -69,64 +69,55 @@ struct PROC_STAT {
int pid; int pid;
char comm[256]; char comm[256];
char state; char state;
long long ppid; int ppid;
long long pgrp; int pgrp;
long long session; int session;
long long tty_nr; int tty_nr;
long long tpgid; int tpgid;
unsigned long long flags; unsigned long flags;
unsigned long long minflt; unsigned long minflt;
unsigned long long cminflt; unsigned long cminflt;
unsigned long long majflt; unsigned long majflt;
unsigned long long cmajflt; unsigned long cmajflt;
unsigned long long utime; unsigned long utime;
unsigned long long stime; unsigned long stime;
long long cutime; int cutime;
long long cstime; int cstime;
long long priority; int priority;
long long nice; int nice;
long long zero; int zero;
long long itrealvalue; int itrealvalue;
unsigned long long starttime; unsigned long starttime;
unsigned long long vsize; unsigned long vsize;
long long rss; int rss;
unsigned long long rlim; unsigned long rlim;
unsigned long long startcode; unsigned long startcode;
unsigned long long endcode; unsigned long endcode;
unsigned long long startstack; unsigned long startstack;
unsigned long long kstkesp; unsigned long kstkesp;
unsigned long long kstkeip; unsigned long kstkeip;
unsigned long long signal; unsigned long signal;
unsigned long long blocked; unsigned long blocked;
unsigned long long sigignore; unsigned long sigignore;
unsigned long long sigcatch; unsigned long sigcatch;
unsigned long long wchan; unsigned long wchan;
unsigned long long nswap; unsigned long nswap;
unsigned long long cnswap; unsigned long cnswap;
long long exit_signal; int exit_signal;
long long processor; int processor;
int parse(char*); int parse(char*);
}; };
// parse a /proc/x/stat file; see
// http://man7.org/linux/man-pages/man5/proc.5.html
//
// Note: the "command" item is the executable filename in parentheses.
// We're parsing it with (%[^)]).
// This doesn't work if the filename contains a ).
// In this we'll return an error and ignore this process.
// i.e. we assume that BOINC app filenames don't contain ).
//
int PROC_STAT::parse(char* buf) { int PROC_STAT::parse(char* buf) {
int n = sscanf(buf, int n = sscanf(buf,
"%d (%[^)]) %c %lld %lld %lld %lld %lld " "%d (%[^)]) %c %d %d %d %d %d "
"%llu %llu %llu %llu %llu %llu %llu " "%lu %lu %lu %lu %lu %lu %lu "
"%lld %lld %lld %lld %lld %lld " "%d %d %d %d %d %d "
"%llu %llu " "%lu %lu "
"%lld " "%d "
"%llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu " "%lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu "
"%lld %lld", "%d %d",
&pid, &pid,
comm, comm,
&state, &state,