]>
Commit | Line | Data |
---|---|---|
0ac2d74b MT |
1 | /*############################################################################# |
2 | # # | |
3 | # Pakfire - The IPFire package management system # | |
4 | # Copyright (C) 2023 Pakfire development team # | |
5 | # # | |
6 | # This program is free software: you can redistribute it and/or modify # | |
7 | # it under the terms of the GNU General Public License as published by # | |
8 | # the Free Software Foundation, either version 3 of the License, or # | |
9 | # (at your option) any later version. # | |
10 | # # | |
11 | # This program is distributed in the hope that it will be useful, # | |
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # | |
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # | |
14 | # GNU General Public License for more details. # | |
15 | # # | |
16 | # You should have received a copy of the GNU General Public License # | |
17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. # | |
18 | # # | |
19 | #############################################################################*/ | |
20 | ||
21 | #ifndef PAKFIRE_OS_H | |
22 | #define PAKFIRE_OS_H | |
23 | ||
24 | #ifdef PAKFIRE_PRIVATE | |
25 | ||
1d29d610 | 26 | #include <stdint.h> |
52340c37 | 27 | #include <unistd.h> |
1d29d610 | 28 | |
0ac2d74b MT |
29 | // CPU info |
30 | ||
31 | #define CPU_VENDOR_MAX 16 | |
32 | #define CPU_MODEL_MAX 256 | |
33 | ||
34 | struct pakfire_cpuinfo { | |
35 | char vendor[CPU_VENDOR_MAX]; | |
36 | char model[CPU_MODEL_MAX]; | |
60610c0e | 37 | unsigned int count; |
0ac2d74b MT |
38 | }; |
39 | ||
40 | int pakfire_cpuinfo(struct pakfire_cpuinfo* cpuinfo); | |
41 | ||
8038a15d MT |
42 | // CPU stat |
43 | ||
44 | struct pakfire_cpustat { | |
45 | double user; | |
46 | double nice; | |
47 | double system; | |
48 | double idle; | |
49 | double iowait; | |
50 | double irq; | |
51 | double softirq; | |
52 | double steal; | |
53 | double guest; | |
54 | double guest_nice; | |
55 | }; | |
56 | ||
57 | int pakfire_cpustat(struct pakfire_cpustat* cpustat); | |
58 | ||
0a393fb7 MT |
59 | // Load Average |
60 | ||
61 | struct pakfire_loadavg { | |
62 | double load1; | |
63 | double load5; | |
64 | double load15; | |
65 | }; | |
66 | ||
67 | int pakfire_loadavg(struct pakfire_loadavg* loadavg); | |
68 | ||
1d29d610 MT |
69 | // Meminfo |
70 | ||
71 | struct pakfire_meminfo { | |
72 | uint64_t total; | |
73 | uint64_t used; | |
74 | uint64_t free; | |
75 | uint64_t available; | |
76 | uint64_t buffers; | |
77 | uint64_t cached; | |
99cb9347 | 78 | uint64_t shared; |
1d29d610 MT |
79 | uint64_t active; |
80 | uint64_t inactive; | |
81 | ||
82 | // Swap | |
83 | uint64_t swap_total; | |
84 | uint64_t swap_used; | |
85 | uint64_t swap_free; | |
86 | }; | |
87 | ||
88 | int pakfire_meminfo(struct pakfire_meminfo* meminfo); | |
89 | ||
9e5b19ac MT |
90 | // Distro |
91 | ||
92 | struct pakfire_distro { | |
93 | char pretty_name[256]; | |
94 | char name[64]; | |
95 | char id[32]; | |
96 | char slogan[256]; | |
97 | char vendor[64]; | |
98 | char version[64]; | |
99 | char version_codename[32]; | |
100 | char version_id[8]; | |
101 | char tag[40]; | |
102 | }; | |
103 | ||
104 | int pakfire_distro(struct pakfire_distro* distro, const char* path); | |
105 | ||
0ac2d74b MT |
106 | #endif /* PAKFIRE_PRIVATE */ |
107 | ||
108 | #endif /* PAKFIRE_OS_H */ |