Unverified Commit 4bf9c473 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

support diskfree option to "fix halt" also on BSD variants

parent e8d4cc42
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -160,7 +160,7 @@ the :doc:`run <run>` command.

Restrictions
""""""""""""
The *diskfree* attribute is currently only supported on Linux and MacOS.
The *diskfree* attribute is currently only supported on Linux, MacOSX, and BSD.

Related commands
""""""""""""""""
+3 −3
Original line number Diff line number Diff line
@@ -306,12 +306,12 @@ double FixHalt::tlimit()
/* ----------------------------------------------------------------------
   determine available disk space, if supported. Return -1 if not.
------------------------------------------------------------------------- */
#if defined(__linux__) || defined(__APPLE__)
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__OpenBSD__) || defined(__NetBSD__)
#include <sys/statvfs.h>
#endif
double FixHalt::diskfree()
{
#if defined(__linux__) || defined(__APPLE__)
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__OpenBSD__) || defined(__NetBSD__)
  struct statvfs fs;
  double disk_free = -1.0;

@@ -321,7 +321,7 @@ double FixHalt::diskfree()
    if (rv == 0) {
#if defined(__linux__)
      disk_free = fs.f_bavail*fs.f_bsize/1048576.0;
#elif defined(__APPLE__)
#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__OpenBSD__) || defined(__NetBSD__)
      disk_free = fs.f_bavail*fs.f_frsize/1048576.0;
#endif
    } else