Debian Codegraph @

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

raw symbols SCIP
1 // SPDX-License-Identifier: GPL-3.0-or-later
2 /* cpudesc.h -- a library for checking the CPU features
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 _CPUDESC_H
18 #define _CPUDESC_H
19
20 #include "system.h"
21
22 #ifdef __cplusplus
23 extern "C"
24 {
25 #endif
26
27 /* Processor characteristics */
28 bool get_processor_is_hot_pluggable (unsigned int cpu);
29 int get_processor_is_online (unsigned int cpu);
30
31 struct cpu_desc;
32
33 /* Allocates space for a new cpu_desc object.
34 * Returns 0 if all went ok. Errors are returned as negative values. */
35 int cpu_desc_new (struct cpu_desc **cpudesc);
36
37 /* Fill the cpu_desc structure pointed with the values found in the
38 * proc filesystem */
39 void cpu_desc_read (struct cpu_desc * __restrict cpudesc);
40
41 /* Drop a reference of the cpu_desc library context. If the refcount of
42 * reaches zero, the resources of the context will be released. */
43 struct cpu_desc *cpu_desc_unref (struct cpu_desc *cpudesc);
44
45 /* Accessing the values from cpu_desc */
46 char *cpu_desc_get_architecture (struct cpu_desc *cpudesc);
47 char *cpu_desc_get_vendor (struct cpu_desc *cpudesc);
48 char *cpu_desc_get_family (struct cpu_desc *cpudesc);
49 char *cpu_desc_get_model (struct cpu_desc *cpudesc);
50 char *cpu_desc_get_model_name (struct cpu_desc *cpudesc);
51 char *cpu_desc_get_virtualization_flag (struct cpu_desc *cpudesc);
52 char *cpu_desc_get_mhz (struct cpu_desc *cpudesc);
53 char *cpu_desc_get_flags (struct cpu_desc *cpudesc);
54
55 enum /* CPU modes */
56 {
57 MODE_32BIT = (1 << 1),
58 MODE_64BIT = (1 << 2)
59 };
60 int cpu_desc_get_mode (struct cpu_desc *cpudesc);
61
62 int cpu_desc_get_ncpus (struct cpu_desc *cpudesc);
63 int cpu_desc_get_ncpuspos (struct cpu_desc *cpudesc);
64 int cpu_desc_get_nthreads (struct cpu_desc *cpudesc);
65
66 #ifdef __cplusplus
67 }
68 #endif
69
70 #endif /* _CPUDESC_H */