Debian Codegraph @

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

raw symbols SCIP
1 // SPDX-License-Identifier: GPL-3.0-or-later
2 /* sysfsparser -- get informations from sysfs
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 _SYSFSPARSER_H
18 #define _SYSFSPARSER_H
19
20 #include <dirent.h>
21 #include <limits.h>
22 #include "system.h"
23
24 #define PATH_SYS "/sys"
25
26 #ifdef __cplusplus
27 extern "C"
28 {
29 #endif
30
31 /* generic functions */
32
33 void sysfsparser_check_for_sysfs(void);
34 bool sysfsparser_path_exist (const char *path, ...)
35 _attribute_format_printf_(1, 2);
36 void sysfsparser_opendir(DIR **dirp, const char *path, ...)
37 _attribute_format_printf_(2, 3);
38 void sysfsparser_closedir(DIR *dirp);
39 struct dirent *sysfsparser_readfilename(DIR *dirp, unsigned int flags);
40
41 char *sysfsparser_getline (const char *filename, ...)
42 _attribute_format_printf_(1, 2);
43 int sysfsparser_getvalue (unsigned long long *value, const char *filename, ...)
44 _attribute_format_printf_(2, 3);
45
46 /* Lookup a pattern and get the value from line
47 * Format is:
48 * "<pattern> <numeric-key>"
49 */
50 int sysfsparser_linelookup_numeric (char *line, char *pattern,
51 long long *value);
52
53 /* cpufreq */
54
55 int sysfsparser_cpufreq_get_hardware_limits (unsigned int cpu,
56 unsigned long *min,
57 unsigned long *max);
58 unsigned long sysfsparser_cpufreq_get_freq_kernel (unsigned int cpu);
59 unsigned long sysfsparser_cpufreq_get_transition_latency (unsigned int cpu);
60
61 char *sysfsparser_cpufreq_get_available_freqs (unsigned int cpu);
62 char *sysfsparser_cpufreq_get_driver (unsigned int cpu);
63 char *sysfsparser_cpufreq_get_governor (unsigned int cpu);
64 char *sysfsparser_cpufreq_get_available_governors (unsigned int cpu);
65
66 /* thermal sensors */
67
68 # define ALL_THERMAL_ZONES UINT_MAX
69
70 bool sysfsparser_thermal_kernel_support (void);
71 const char *sysfsparser_thermal_sysfs_path ();
72 int sysfsparser_thermal_get_temperature (unsigned int selected_zone,
73 unsigned int *zone, char **type);
74 int sysfsparser_thermal_get_critical_temperature (unsigned int thermal_zone);
75 const char *sysfsparser_thermal_get_device (unsigned int thermal_zone);
76 void sysfsparser_thermal_listall ();
77
78 #ifdef __cplusplus
79 }
80 #endif
81
82 #endif /* _SYSFSPARSER_H */