diff --git a/doc/src/fix_halt.rst b/doc/src/fix_halt.rst index 9836679de3..0bc3154cdb 100644 --- a/doc/src/fix_halt.rst +++ b/doc/src/fix_halt.rst @@ -160,7 +160,7 @@ the :doc:`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 """""""""""""""" diff --git a/src/fix_halt.cpp b/src/fix_halt.cpp index 7de2b9bc3a..42b63c69f1 100644 --- a/src/fix_halt.cpp +++ b/src/fix_halt.cpp @@ -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 #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