1/*
2 * Copyright (c) 2012, 2016 SAP SE. 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// Class libo4 is a C++ wrapper around the libo4 porting library. It handles
26// basic stuff like dynamic loading, library initialization etc.
27// The libo4 porting library is a set of functions that bridge from the AIX
28// runtime environment on OS/400 (aka PASE layer) into native OS/400
29// functionality (aka ILE layer) to close some functional gaps that exist in
30// the PASE layer.
31
32#ifndef OS_AIX_VM_LIBO4_HPP
33#define OS_AIX_VM_LIBO4_HPP
34
35class libo4 {
36public:
37  // Initialize the libo4 porting library.
38  // Returns true if succeeded, false if error.
39  static bool init();
40
41  // Triggers cleanup of the libo4 porting library.
42  static void cleanup();
43
44  // Returns a number of memory statistics from OS/400.
45  //
46  // See libo4.h 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,
54                              unsigned long long* p_real_total,
55                              unsigned long long* p_real_free,
56                              unsigned long long* p_pgsp_total,
57                              unsigned long long* p_pgsp_free);
58
59  // Returns information about system load
60  // (similar to "loadavg()" under other Unices)
61  //
62  // See libo4.h for details on this API.
63  //
64  // Specify NULL for numbers you are not interested in.
65  //
66  // Returns false if an error happened. Activate OsMisc trace for
67  // trace output.
68  //
69  static bool get_load_avg(double* p_avg1, double* p_avg5, double* p_avg15);
70
71  // This is a replacement for the "realpath()" API which does not really work
72  // in PASE together with the (case insensitive but case preserving)
73  // filesystem on OS/400.
74  //
75  // See libo4.h for details on this API.
76  //
77  // Returns false if an error happened. Activate OsMisc trace for
78  // trace output.
79  //
80  static bool realpath(const char* file_name, char* resolved_name,
81                       int resolved_name_len);
82
83  // Call libo4_RemoveEscapeMessageFromJoblogByContext API to remove messages
84  // from the OS/400 job log.
85  //
86  // See libo4.h for details on this API.
87  static bool removeEscapeMessageFromJoblogByContext(const void* context);
88};
89
90#endif // OS_AIX_VM_LIBO4_HPP
91