Debian Codegraph @

madrisan-nagios-plugins-linux/nagios-plugins-linux/include/meminfo.h

raw symbols SCIP
1 // SPDX-License-Identifier: GPL-3.0-or-later
2 /* meminfo.h -- a library for getting system memory informations
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
16
17 #ifndef _MEMINFO_H_
18 #define _MEMINFO_H_
19
20 #include "system.h"
21
22 #ifdef __cplusplus
23 extern "C"
24 {
25 #endif
26
27 struct proc_sysmem;
28
29 /* Return the PATH of the proc meminfo filesystem ("/proc/meminfo"), or the
30 content of the environment variable "NPL_TESTING_PATH_PROC_MEMINFO"
31 if set */
32 const char *get_path_proc_meminfo ();
33
34 /* Allocates space for a new sysmem object.
35 * Returns 0 if all went ok. Errors are returned as negative values. */
36 int proc_sysmem_new (struct proc_sysmem **sysmem);
37
38 /* Fill the proc_sysmem structure pointed with the values found in the
39 * proc filesystem. */
40 void proc_sysmem_read (struct proc_sysmem *sysmem);
41
42 /* Drop a reference of the memory library context. If the refcount of
43 * reaches zero, the resources of the context will be released. */
44 struct proc_sysmem *proc_sysmem_unref (struct proc_sysmem *sysmem);
45
46 /* Accessing the values from proc_sysmem */
47
48 unsigned long proc_sysmem_get_active (struct proc_sysmem *sysmem);
49 unsigned long proc_sysmem_get_anon_pages (struct proc_sysmem *sysmem);
50 unsigned long proc_sysmem_get_committed_as (struct proc_sysmem *sysmem);
51 unsigned long proc_sysmem_get_dirty (struct proc_sysmem *sysmem);
52 unsigned long proc_sysmem_get_inactive (struct proc_sysmem *sysmem);
53
54 unsigned long proc_sysmem_get_main_available (struct proc_sysmem *sysmem);
55 unsigned long proc_sysmem_get_main_buffers (struct proc_sysmem *sysmem);
56 unsigned long proc_sysmem_get_main_cached (struct proc_sysmem *sysmem);
57 unsigned long proc_sysmem_get_main_free (struct proc_sysmem *sysmem);
58 unsigned long proc_sysmem_get_main_shared (struct proc_sysmem *sysmem);
59 unsigned long proc_sysmem_get_main_total (struct proc_sysmem *sysmem);
60 unsigned long proc_sysmem_get_main_used (struct proc_sysmem *sysmem);
61
62 unsigned long proc_sysmem_get_swap_cached (struct proc_sysmem *sysmem);
63 unsigned long proc_sysmem_get_swap_free (struct proc_sysmem *sysmem);
64 unsigned long proc_sysmem_get_swap_total (struct proc_sysmem *sysmem);
65 unsigned long proc_sysmem_get_swap_used (struct proc_sysmem *sysmem);
66
67 #ifdef __cplusplus
68 }
69 #endif
70
71 #endif /* _MEMINFO_H_ */