Overview
Comment: | Updated freecolor to work with libstatgrab 0.10.0 or greater. freecolor 0.8.7 |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | 0.8.7 |
Files: | files | file ages | folders |
SHA1: |
1022f63a36ca406b3822d1fefee05d12 |
User & Date: | rkeene on 2005-10-18 15:10:10 |
Other Links: | manifest | tags |
Context
2009-05-31
| ||
02:45 | Applied patch to freecolor from T. Bishop, fixing out of bounds array indexing and larger memory configurations. Freecolor really needs a rewrite. check-in: d1232b819a user: rkeene tags: trunk | |
2005-10-18
| ||
15:10 | Updated freecolor to work with libstatgrab 0.10.0 or greater. freecolor 0.8.7 check-in: 1022f63a36 user: rkeene tags: trunk, 0.8.7 | |
15:03 | Added a changelog to the build process. freecolor 0.8.6 check-in: dbbc446983 user: rkeene tags: trunk, 0.8.6 | |
Changes
Modified freecolor.c from [5a09c67ddb] to [7a3654fcb8].
︙ | ︙ | |||
63 64 65 66 67 68 69 | #include <stdlib.h> #include <stdio.h> #ifndef NO_GETOPT #include <getopt.h> #endif #define BARLEN 35 #define HEADERLEN 14 | | | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | #include <stdlib.h> #include <stdio.h> #ifndef NO_GETOPT #include <getopt.h> #endif #define BARLEN 35 #define HEADERLEN 14 #define VERSION "0.8.7" extern char *optarg; extern int optind, opterr, optopt; void bargraph(float percent, float secondper, char marks[BARLEN+HEADERLEN],int usefull) { char percentone[BARLEN], percenttwo[BARLEN], remain[BARLEN]; |
︙ | ︙ | |||
117 118 119 120 121 122 123 | int i, divisor=1024, dototals=0, doold=0, linestoup=2; unsigned long meminfo_cached; #ifndef HAVE_LIBSTATGRAB struct sysinfo sinfo; meminfo_cached=get_meminfo("Cached:"); #else | | | | | | 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | int i, divisor=1024, dototals=0, doold=0, linestoup=2; unsigned long meminfo_cached; #ifndef HAVE_LIBSTATGRAB struct sysinfo sinfo; meminfo_cached=get_meminfo("Cached:"); #else sg_mem_stats *mem_stats=NULL; sg_swap_stats *swap_stats=NULL; struct systeminfo_st { unsigned long totalram; /* Total usable main memory size */ unsigned long freeram; /* Available memory size */ unsigned long sharedram; /* Amount of shared memory */ unsigned long bufferram; /* Memory used by buffers */ unsigned long totalswap; /* Total swap space size */ unsigned long freeswap; /* swap space still available */ } sinfo; sg_init(); #ifdef HAVE_STATGRAB_DROP_PRIVILEGES /* Drop setuid/setgid privileges. */ if (sg_drop_privileges() != 0) { perror("Error. Failed to drop privileges"); return 1; } #endif #endif #ifdef NO_GETOPT |
︙ | ︙ | |||
173 174 175 176 177 178 179 | } } #endif while(1) { #ifndef HAVE_LIBSTATGRAB sysinfo(&sinfo); #else | | | 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | } } #endif while(1) { #ifndef HAVE_LIBSTATGRAB sysinfo(&sinfo); #else if(((mem_stats=sg_get_mem_stats()) == NULL) || (swap_stats=sg_get_swap_stats()) == NULL) { printf("Couldn't get memory information, exiting.\n"); return(-1); } meminfo_cached=mem_stats->cache; sinfo.totalram=mem_stats->total; sinfo.freeram=mem_stats->free; sinfo.sharedram=0; |
︙ | ︙ |