diff options
| author | Baptiste Daroussin <bapt@FreeBSD.org> | 2011-12-10 00:31:48 +0100 | 
|---|---|---|
| committer | Michael Stapelberg <michael@stapelberg.de> | 2011-12-09 23:39:01 +0000 | 
| commit | be61907ad5faa0f0ee86555a30572debf59d3afc (patch) | |
| tree | 239212c0b656f63029cec44119d1da64e3de8a15 | |
| parent | 7148eb52790f78e4e4fb60555d19c5c958f271c7 (diff) | |
FreeBSD: fix disk usage print
| -rw-r--r-- | src/print_disk_info.c | 13 | 
1 files changed, 13 insertions, 0 deletions
| diff --git a/src/print_disk_info.c b/src/print_disk_info.c index b9ec84b..b2cbd9c 100644 --- a/src/print_disk_info.c +++ b/src/print_disk_info.c @@ -6,6 +6,11 @@  #include <stdint.h>  #include <sys/statvfs.h>  #include <sys/types.h> +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) +#include <sys/param.h> +#include <sys/mount.h> +#endif +  #include "i3status.h" @@ -39,10 +44,18 @@ static void print_bytes_human(uint64_t bytes) {   */  void print_disk_info(const char *path, const char *format) {          const char *walk; + +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) +        struct statfs buf; + +        if (statfs(path, &buf) == -1) +                return; +#else          struct statvfs buf;          if (statvfs(path, &buf) == -1)                  return; +#endif          for (walk = format; *walk != '\0'; walk++) {                  if (*walk != '%') { | 
