diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2015-08-08 13:49:04 -0700 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2015-08-08 17:38:18 -0700 |
commit | 56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch) | |
tree | 3f91093cdb475e565ae857f1c5a7fd339e2d781e /x11-plugins/wmtop/files | |
download | gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2 gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip |
proj/gentoo: Initial commit
This commit represents a new era for Gentoo:
Storing the gentoo-x86 tree in Git, as converted from CVS.
This commit is the start of the NEW history.
Any historical data is intended to be grafted onto this point.
Creation process:
1. Take final CVS checkout snapshot
2. Remove ALL ChangeLog* files
3. Transform all Manifests to thin
4. Remove empty Manifests
5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$
5.1. Do not touch files with -kb/-ko keyword flags.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests
X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project
X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration
X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn
X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts
X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration
X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging
X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'x11-plugins/wmtop/files')
-rw-r--r-- | x11-plugins/wmtop/files/wmtop-0.9.0-meminfo.patch | 189 |
1 files changed, 189 insertions, 0 deletions
diff --git a/x11-plugins/wmtop/files/wmtop-0.9.0-meminfo.patch b/x11-plugins/wmtop/files/wmtop-0.9.0-meminfo.patch new file mode 100644 index 000000000000..541ab6a1d697 --- /dev/null +++ b/x11-plugins/wmtop/files/wmtop-0.9.0-meminfo.patch @@ -0,0 +1,189 @@ +--- wmtop.c.orig 2001-01-19 15:41:20.000000000 -0600 ++++ wmtop.c 2012-03-29 22:36:49.906684353 -0500 +@@ -182,12 +182,12 @@ + pid_t pid; + char *name; + float amount; +- int user_time; +- int kernel_time; +- int previous_user_time; +- int previous_kernel_time; +- int vsize; +- int rss; ++ unsigned long user_time; ++ unsigned long kernel_time; ++ unsigned long previous_user_time; ++ unsigned long previous_kernel_time; ++ unsigned long vsize; ++ long rss; + int time_stamp; + int counted; + }; +@@ -236,8 +236,8 @@ + + process->pid = p; + process->time_stamp = 0; +- process->previous_user_time = INT_MAX; +- process->previous_kernel_time = INT_MAX; ++ process->previous_user_time = ULONG_MAX; ++ process->previous_kernel_time = ULONG_MAX; + process->counted = 1; + + /* process_find_name(process);*/ +@@ -256,11 +256,11 @@ + void process_cleanup(void); + void delete_process(struct process *); + inline void draw_processes(void); +-int calc_cpu_total(void); +-void calc_cpu_each(int); ++unsigned long calc_cpu_total(void); ++void calc_cpu_each(unsigned long total); + #if defined(LINUX) +-int calc_mem_total(void); +-void calc_mem_each(int); ++unsigned long calc_mem_total(void); ++void calc_mem_each(unsigned long total); + #endif + int process_find_top_three(struct process **); + void draw_bar(int, int, int, int, float, int, int); +@@ -457,13 +457,15 @@ + char line[WMTOP_BUFLENGTH],filename[WMTOP_BUFLENGTH],procname[WMTOP_BUFLENGTH]; + int ps; + struct stat sbuf; +- int user_time,kernel_time; ++ unsigned long user_time,kernel_time; + int rc; + #if defined(LINUX) + char *r,*q; + char deparenthesised_name[WMTOP_BUFLENGTH]; + #endif /* defined(LINUX) */ + #if defined(FREEBSD) ++ /* TODO: needs analysis. Probably needs same data type fix as LINUX (use ++ * long types). Need to check FreeBSD docs and test. -wbk */ + int us,um,ks,km; + #endif /* defined(FREEBSD) */ + +@@ -501,9 +503,10 @@ + + #if defined(LINUX) + /* +- * Extract cpu times from data in /proc filesystem ++ * Extract cpu times from data in /proc filesystem. ++ * For conversion types see man proc(5). + */ +- rc = sscanf(line,"%*s %s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %d %d %*s %*s %*s %*s %*s %*s %*s %d %d", ++ rc = sscanf(line,"%*s %s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %lu %lu %*s %*s %*s %*s %*s %*s %*s %lu %ld", + procname, + &process->user_time,&process->kernel_time, + &process->vsize,&process->rss); +@@ -527,6 +530,9 @@ + /* + * Extract cpu times from data in /proc/<pid>/stat + * XXX: Process name extractor for FreeBSD is untested right now. ++ * ++ * [TODO: FREEBSD code probably needs similar data type changes to ++ * those made for LINUX above. Need to check docs. -wbk] + */ + rc = sscanf(line,"%s %*s %*s %*s %*s %*s %*s %*s %d,%d %d,%d", + procname, +@@ -540,11 +546,14 @@ + process->kernel_time = ks*1000+km/1000; + #endif /* defined(FREEBSD) */ + ++ /* not portable (especially unsuitable for redistributable executables. ++ * On some systems, getpagesize() is a preprocessor macro). ++ */ + process->rss *= getpagesize(); + +- if (process->previous_user_time==INT_MAX) ++ if (process->previous_user_time==ULONG_MAX) + process->previous_user_time = process->user_time; +- if (process->previous_kernel_time==INT_MAX) ++ if (process->previous_kernel_time==ULONG_MAX) + process->previous_kernel_time = process->kernel_time; + + user_time = process->user_time-process->previous_user_time; +@@ -686,7 +695,7 @@ + void draw_processes() { + int i,n; + struct process *best[3] = { 0, 0, 0 }; +- int total; ++ unsigned long total; + + /* + * Invalidate time stamps +@@ -743,21 +752,21 @@ + /* Calculate cpu total */ + /******************************************/ + +-int calc_cpu_total() { +- int total,t; +- static int previous_total = INT_MAX; ++unsigned long calc_cpu_total() { ++ unsigned long total,t; ++ static unsigned long previous_total = ULONG_MAX; + #if defined(LINUX) + int rc; + int ps; + char line[WMTOP_BUFLENGTH]; +- int cpu,nice,system,idle; ++ unsigned long cpu,nice,system,idle; + + ps = open("/proc/stat",O_RDONLY); + rc = read(ps,line,sizeof(line)); + close(ps); + if (rc<0) + return 0; +- sscanf(line,"%*s %d %d %d %d",&cpu,&nice,&system,&idle); ++ sscanf(line,"%*s %lu %lu %lu %lu",&cpu,&nice,&system,&idle); + total = cpu+nice+system+idle; + #endif /* defined(LINUX) */ + +@@ -780,7 +789,7 @@ + /* Calculate each processes cpu */ + /******************************************/ + +-void calc_cpu_each(int total) { ++void calc_cpu_each(unsigned long total) { + struct process *p = first_process; + while (p) { + +@@ -798,7 +807,8 @@ + /******************************************/ + + #if defined(LINUX) +-int calc_mem_total() { ++/* INT_MAX won't always hold total system RAM, especially on a 64 bit system. */ ++unsigned long calc_mem_total() { + int ps; + char line[512]; + char *ptr; +@@ -810,11 +820,12 @@ + if (rc<0) + return 0; + +- if ((ptr = strstr(line, "Mem:")) == NULL) { ++ if ((ptr = strstr(line, "MemTotal:")) == NULL) { + return 0; + } else { +- ptr += 4; +- return atoi(ptr); ++ ptr += 9; /* move into whitespace */ ++ /* wbk - old Mem: Total was bytes. MemTotal: is KB */ ++ return (unsigned long)atoi(ptr) * 1024; + } + + } +@@ -825,10 +836,10 @@ + /******************************************/ + + #if defined(LINUX) +-void calc_mem_each(int total) { ++void calc_mem_each(unsigned long total) { + struct process *p = first_process; + while (p) { +- p->amount = 100*(float)p->rss/total; ++ p->amount = 100*(double)p->rss/total; + p = p->next; + } + } |