1 /*
   2  * Copyright 2012, 2015 SAP AG. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 // A C++ wrapper around the libo4 porting library. The libo4 porting library
  26 // is a set of bridge functions into native AS/400 functionality.
  27 
  28 #ifndef OS_AIX_VM_LIBO4_HPP
  29 #define OS_AIX_VM_LIBO4_HPP
  30 
  31 
  32 class libo4 {
  33 public:
  34 
  35   // Initialize the libo4 porting library.
  36   // Returns true if succeeded, false if error.
  37   static bool init();
  38 
  39   // cleanup of the libo4 porting library.
  40   static void cleanup();
  41 
  42   // returns a number of memory statistics from the
  43   // AS/400.
  44   //
  45   // Specify NULL for numbers you are not interested in.
  46   //
  47   // returns false if an error happened. Activate OsMisc trace for
  48   // trace output.
  49   //
  50   static bool get_memory_info (unsigned long long* p_virt_total, unsigned long long* p_real_total,
  51     unsigned long long* p_real_free, unsigned long long* p_pgsp_total, unsigned long long* p_pgsp_free);
  52 
  53   // returns information about system load
  54   // (similar to "loadavg()" under other Unices)
  55   //
  56   // Specify NULL for numbers you are not interested in.
  57   //
  58   // returns false if an error happened. Activate OsMisc trace for
  59   // trace output.
  60   //
  61   static bool get_load_avg (double* p_avg1, double* p_avg5, double* p_avg15);
  62 
  63   // this is a replacement for the "realpath()" API which does not really work
  64   // on PASE
  65   //
  66   // Specify NULL for numbers you are not interested in.
  67   //
  68   // returns false if an error happened. Activate OsMisc trace for
  69   // trace output.
  70   //
  71   static bool realpath (const char* file_name,
  72       char* resolved_name, int resolved_name_len);
  73 
  74 };
  75 
  76 #endif // OS_AIX_VM_LIBO4_HPP
  77