third_party/libprocess/include/stout/os.hpp
// Returns relative disk usage of the file system mounted at the given path.
Returns relative disk usage of the file system mounted at the given path.
Returns relative disk usage of the file system mounted at the given path .
inline Try<double> usage(const std::string& fs = "/")
{
  struct statvfs buf;
  if (statvfs(fs.c_str(), &buf) < 0) {
    return Try<double>::error(strerror(errno));
  }
  return (double) (buf.f_blocks - buf.f_bfree) / buf.f_blocks;
}
inline Try < double > usage ( const std :: string & fs = " " ) { struct statvfs buf ; if ( statvfs ( fs . c_str ( ) , & buf ) < 0 ) { return Try < double > :: error ( strerror ( errno ) ) ; } return ( double ) ( buf . f_blocks - buf . f_bfree ) / buf . f_blocks ; }
Returns relative disk usage of the file system mounted at the given path.
Returns relative disk usage of the file system mounted at the given path .