third_party/libprocess/include/stout/os.hpp
// Returns the total size of main memory in bytes.
Returns the total size of main memory in bytes.
Returns the total size of main memory in bytes .
inline Try<uint64_t> memory()
{
#ifdef __linux__
  struct sysinfo info;
  if (sysinfo(&info) != 0) {
    return Try<uint64_t>::error(strerror(errno));
  }
  return info.totalram;
#else
  return Try<uint64_t>::error("Cannot determine the size of main memory");
#endif
}
inline Try < uint64_t > memory ( ) { #ifdef __linux__ struct sysinfo info ; if ( sysinfo ( & info ) != 0 ) { return Try < uint64_t > :: error ( strerror ( errno ) ) ; } return info . totalram ; #else return Try < uint64_t > :: error ( " " ) ; #endif }
Returns the total size of main memory in bytes.
Returns the total size of main memory in bytes .