Since fsusage.c is licensed under the GPL, the fact that this file is being 
linked into libmetrics causes a licensing issue for gmond.  The attached patch 
removes the fsusage.c(.h) which relieves gmond of a licensing conflict between 
the GPL and BSD.

Brad


Index: metrics.c
===================================================================
--- metrics.c   (revision 100)
+++ metrics.c   (revision 524)
@@ -9,16 +9,17 @@
 #include <ctype.h>
 #include <sys/sysinfo.h>
 #include <sys/stat.h>
+#include <sys/statvfs.h>
 
 /* From old ganglia 2.5.x... */
 #include "file.h"
 #include "libmetrics.h"
-#include "fsusage.h"
 /* End old ganglia 2.5.x headers */
 
 #define OSNAME "Linux"
 #define OSNAME_LEN strlen(OSNAME)
 
+
 /* /proc/net/dev hash table stuff */
 typedef struct net_dev_stats net_dev_stats;
 struct net_dev_stats {
@@ -1324,7 +1325,7 @@
 /* --------------------------------------------------------------------------- 
*/
 float device_space(char *mount, char *device, double *total_size, double 
*total_free)
 {
-   struct fs_usage fsu;
+   struct statvfs svfs;
    uint32_t blocksize;
    uint32_t free;
    uint32_t size;
@@ -1334,16 +1335,14 @@
    /* Avoid multiply-mounted disks - not done in df. */
    if (seen_before(device)) return pct;
 
-   if (get_fs_usage(mount, device, &fsu)) {
+   if (statvfs(mount, &svfs)) {
       /* Ignore funky devices... */
       return pct;
    }
 
-   free = fsu.fsu_bavail;
-   /* Is the space available negative? */
-   if (fsu.fsu_bavail_top_bit_set) free = 0;
-   size = fsu.fsu_blocks;
-   blocksize = fsu.fsu_blocksize;
+   free = svfs.f_bavail;
+   size  = svfs.f_blocks;
+   blocksize = svfs.f_bsize;
    /* Keep running sum of total used, free local disk space. */
    *total_size += size * (double) blocksize;
    *total_free += free * (double) blocksize;
Index: Makefile.am
===================================================================
--- Makefile.am (revision 100)
+++ Makefile.am (revision 524)
@@ -1,4 +1,4 @@
 AM_CFLAGS=-I.. -I$(top_builddir)/lib -I../../lib
 
 noinst_LTLIBRARIES     = libmetric25.la
-libmetric25_la_SOURCES = metrics.c fsusage.c fsusage.h
+libmetric25_la_SOURCES = metrics.c

Reply via email to