Check-in [1022f63a36]
Overview
SHA1:1022f63a36ca406b3822d1fefee05d12e4b7ffde
Date: 2005-10-18 15:10:10
User: rkeene
Comment:Updated freecolor to work with libstatgrab 0.10.0 or greater. freecolor 0.8.7
Timelines: family | ancestors | descendants | both | trunk | 0.8.7
Downloads: Tarball | ZIP archive
Other Links: files | file ages | folders | manifest
Tags And Properties
Context
2009-05-31
02:45
[d1232b819a] Applied patch to freecolor from T. Bishop, fixing out of bounds array indexing and larger memory configurations. Freecolor really needs a rewrite. (user: rkeene, tags: trunk)
2005-10-18
15:10
[1022f63a36] Updated freecolor to work with libstatgrab 0.10.0 or greater. freecolor 0.8.7 (user: rkeene, tags: trunk, 0.8.7)
15:03
[dbbc446983] Added a changelog to the build process. freecolor 0.8.6 (user: rkeene, tags: trunk, 0.8.6)
Changes

Modified freecolor.c from [5a09c67ddb] to [7a3654fcb8].

    63     63   #include <stdlib.h>
    64     64   #include <stdio.h>
    65     65   #ifndef NO_GETOPT
    66     66   #include <getopt.h>
    67     67   #endif
    68     68   #define BARLEN 35
    69     69   #define HEADERLEN 14
    70         -#define VERSION "0.8.6"
           70  +#define VERSION "0.8.7"
    71     71   
    72     72   
    73     73   extern char *optarg;
    74     74   extern int optind, opterr, optopt;
    75     75   
    76     76   void bargraph(float percent, float secondper, char marks[BARLEN+HEADERLEN],int usefull) {
    77     77     char percentone[BARLEN], percenttwo[BARLEN], remain[BARLEN];
................................................................................
   117    117     int i, divisor=1024, dototals=0, doold=0, linestoup=2;
   118    118     unsigned long meminfo_cached;
   119    119   #ifndef HAVE_LIBSTATGRAB
   120    120     struct sysinfo sinfo;
   121    121   
   122    122     meminfo_cached=get_meminfo("Cached:");
   123    123   #else
   124         -  mem_stat_t *mem_stats=NULL;
   125         -  swap_stat_t *swap_stats=NULL;
          124  +  sg_mem_stats *mem_stats=NULL;
          125  +  sg_swap_stats *swap_stats=NULL;
   126    126     struct systeminfo_st {
   127    127       unsigned long totalram;  /* Total usable main memory size */
   128    128       unsigned long freeram;   /* Available memory size */
   129    129       unsigned long sharedram; /* Amount of shared memory */
   130    130       unsigned long bufferram; /* Memory used by buffers */
   131    131       unsigned long totalswap; /* Total swap space size */
   132    132       unsigned long freeswap;  /* swap space still available */
   133    133     } sinfo;
   134    134   
   135         -  statgrab_init();
          135  +  sg_init();
   136    136   
   137    137   #ifdef HAVE_STATGRAB_DROP_PRIVILEGES
   138    138     /* Drop setuid/setgid privileges. */
   139         -  if (statgrab_drop_privileges() != 0) {
          139  +  if (sg_drop_privileges() != 0) {
   140    140       perror("Error. Failed to drop privileges");
   141    141       return 1;
   142    142     }
   143    143   #endif
   144    144   
   145    145   #endif
   146    146   #ifdef NO_GETOPT
................................................................................
   173    173     	}
   174    174     }
   175    175   #endif
   176    176     while(1) {
   177    177   #ifndef HAVE_LIBSTATGRAB
   178    178       sysinfo(&sinfo);
   179    179   #else
   180         -  if(((mem_stats=get_memory_stats()) == NULL) || (swap_stats=get_swap_stats()) == NULL) {
          180  +  if(((mem_stats=sg_get_mem_stats()) == NULL) || (swap_stats=sg_get_swap_stats()) == NULL) {
   181    181       printf("Couldn't get memory information, exiting.\n");
   182    182       return(-1);
   183    183     }
   184    184     meminfo_cached=mem_stats->cache;
   185    185     sinfo.totalram=mem_stats->total;
   186    186     sinfo.freeram=mem_stats->free;
   187    187     sinfo.sharedram=0;