Fixes for /proc location, submitted by Florent Thoumie

This commit is contained in:
Hisham Muhammad 2007-05-17 18:29:30 +00:00
parent df20abfd67
commit 9710a43001
5 changed files with 17 additions and 11 deletions

View File

@ -28,7 +28,9 @@ in the source distribution for its full text.
// This works only with glibc 2.1+. On earlier versions // This works only with glibc 2.1+. On earlier versions
// the behavior is similar to have a hardcoded page size. // the behavior is similar to have a hardcoded page size.
#ifndef PAGE_SIZE
#define PAGE_SIZE ( sysconf(_SC_PAGESIZE) / 1024 ) #define PAGE_SIZE ( sysconf(_SC_PAGESIZE) / 1024 )
#endif
#define PROCESS_COMM_LEN 300 #define PROCESS_COMM_LEN 300

View File

@ -31,7 +31,9 @@ in the source distribution for its full text.
// This works only with glibc 2.1+. On earlier versions // This works only with glibc 2.1+. On earlier versions
// the behavior is similar to have a hardcoded page size. // the behavior is similar to have a hardcoded page size.
#ifndef PAGE_SIZE
#define PAGE_SIZE ( sysconf(_SC_PAGESIZE) / 1024 ) #define PAGE_SIZE ( sysconf(_SC_PAGESIZE) / 1024 )
#endif
#define PROCESS_COMM_LEN 300 #define PROCESS_COMM_LEN 300
@ -52,16 +54,16 @@ typedef struct Process_ {
struct ProcessList_ *pl; struct ProcessList_ *pl;
bool updated; bool updated;
int pid; unsigned int pid;
char* comm; char* comm;
int indent; int indent;
char state; char state;
bool tag; bool tag;
int ppid; unsigned int ppid;
int pgrp; unsigned int pgrp;
int session; unsigned int session;
int tty_nr; unsigned int tty_nr;
int tpgid; unsigned int tpgid;
unsigned long int flags; unsigned long int flags;
#ifdef DEBUG #ifdef DEBUG
unsigned long int minflt; unsigned long int minflt;

View File

@ -37,11 +37,11 @@ in the source distribution for its full text.
#endif #endif
#ifndef PROCSTATFILE #ifndef PROCSTATFILE
#define PROCSTATFILE "/proc/stat" #define PROCSTATFILE PROCDIR "/stat"
#endif #endif
#ifndef PROCMEMINFOFILE #ifndef PROCMEMINFOFILE
#define PROCMEMINFOFILE "/proc/meminfo" #define PROCMEMINFOFILE PROCDIR "/meminfo"
#endif #endif
#ifndef MAX_NAME #ifndef MAX_NAME
@ -426,7 +426,7 @@ static int ProcessList_readStatFile(ProcessList* this, Process *proc, FILE *f, c
#else #else
long int uzero; long int uzero;
int num = ProcessList_read(this, location, int num = ProcessList_read(this, location,
"%c %d %d %d %d %d %lu %lu %lu %lu " "%c %u %u %u %u %u %lu %lu %lu %lu "
"%lu %lu %lu %ld %ld %ld %ld %ld %ld " "%lu %lu %lu %ld %ld %ld %ld %ld %ld "
"%lu %lu %ld %lu %lu %lu %lu %lu " "%lu %lu %ld %lu %lu %lu %lu %lu "
"%lu %lu %lu %lu %lu %lu %lu %lu " "%lu %lu %lu %lu %lu %lu %lu %lu "

View File

@ -39,11 +39,11 @@ in the source distribution for its full text.
#endif #endif
#ifndef PROCSTATFILE #ifndef PROCSTATFILE
#define PROCSTATFILE "/proc/stat" #define PROCSTATFILE PROCDIR "/stat"
#endif #endif
#ifndef PROCMEMINFOFILE #ifndef PROCMEMINFOFILE
#define PROCMEMINFOFILE "/proc/meminfo" #define PROCMEMINFOFILE PROCDIR "/meminfo"
#endif #endif
#ifndef MAX_NAME #ifndef MAX_NAME

View File

@ -21,6 +21,8 @@ class writer:
self.file.write(text + "\n") self.file.write(text + "\n")
out = writer(out) out = writer(out)
print("Generating "+name+".h")
selfheader = '#include "' + name + '.h"' selfheader = '#include "' + name + '.h"'
out.write( "/* Do not edit this file. It was automatically generated. */" ) out.write( "/* Do not edit this file. It was automatically generated. */" )