1 /*
   2  * Copyright 2012, 2013 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   // See libo4.h (at //bas2/sapjvm/dev/common/libs/libo4/include)
  46   // for details on this API.
  47   //
  48   // Specify NULL for numbers you are not interested in.
  49   //
  50   // returns false if an error happened. Activate OsMisc trace for
  51   // trace output.
  52   //
  53   static bool get_memory_info (unsigned long long* p_virt_total, unsigned long long* p_real_total,
  54     unsigned long long* p_real_free, unsigned long long* p_pgsp_total, unsigned long long* p_pgsp_free);
  55 
  56   // returns information about system load
  57   // (similar to "loadavg()" under other Unices)
  58   //
  59   // See libo4.h (at //bas2/sapjvm/dev/common/libs/libo4/include)
  60   // for details on this API.
  61   //
  62   // Specify NULL for numbers you are not interested in.
  63   //
  64   // returns false if an error happened. Activate OsMisc trace for
  65   // trace output.
  66   //
  67   static bool get_load_avg (double* p_avg1, double* p_avg5, double* p_avg15);
  68 
  69   // this is a replacement for the "realpath()" API which does not really work
  70   // on PASE
  71   //
  72   // See also CSN Internal Message 0001182318 2008
  73   //
  74   // See libo4.h (at //bas2/sapjvm/dev/common/libs/libo4/include)
  75   // for details on this API.
  76   //
  77   // Specify NULL for numbers you are not interested in.
  78   //
  79   // returns false if an error happened. Activate OsMisc trace for
  80   // trace output.
  81   //
  82   static bool realpath (const char* file_name,
  83       char* resolved_name, int resolved_name_len);
  84 
  85 };
  86 
  87 #endif // OS_AIX_VM_LIBO4_HPP
  88