]>
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 MT |
26 | #include <stdint.h> |
27 | ||
0ac2d74b MT |
28 | // CPU info |
29 | ||
30 | #define CPU_VENDOR_MAX 16 | |
31 | #define CPU_MODEL_MAX 256 | |
32 | ||
33 | struct pakfire_cpuinfo { | |
34 | char vendor[CPU_VENDOR_MAX]; | |
35 | char model[CPU_MODEL_MAX]; | |
60610c0e | 36 | unsigned int count; |
0ac2d74b MT |
37 | }; |
38 | ||
39 | int pakfire_cpuinfo(struct pakfire_cpuinfo* cpuinfo); | |
40 | ||
8038a15d MT |
41 | // CPU stat |
42 | ||
43 | struct pakfire_cpustat { | |
44 | double user; | |
45 | double nice; | |
46 | double system; | |
47 | double idle; | |
48 | double iowait; | |
49 | double irq; | |
50 | double softirq; | |
51 | double steal; | |
52 | double guest; | |
53 | double guest_nice; | |
54 | }; | |
55 | ||
56 | int pakfire_cpustat(struct pakfire_cpustat* cpustat); | |
57 | ||
0a393fb7 MT |
58 | // Load Average |
59 | ||
60 | struct pakfire_loadavg { | |
61 | double load1; | |
62 | double load5; | |
63 | double load15; | |
64 | }; | |
65 | ||
66 | int pakfire_loadavg(struct pakfire_loadavg* loadavg); | |
67 | ||
1d29d610 MT |
68 | // Meminfo |
69 | ||
70 | struct pakfire_meminfo { | |
71 | uint64_t total; | |
72 | uint64_t used; | |
73 | uint64_t free; | |
74 | uint64_t available; | |
75 | uint64_t buffers; | |
76 | uint64_t cached; | |
99cb9347 | 77 | uint64_t shared; |
1d29d610 MT |
78 | uint64_t active; |
79 | uint64_t inactive; | |
80 | ||
81 | // Swap | |
82 | uint64_t swap_total; | |
83 | uint64_t swap_used; | |
84 | uint64_t swap_free; | |
85 | }; | |
86 | ||
87 | int pakfire_meminfo(struct pakfire_meminfo* meminfo); | |
88 | ||
9e5b19ac MT |
89 | // Distro |
90 | ||
91 | struct pakfire_distro { | |
92 | char pretty_name[256]; | |
93 | char name[64]; | |
94 | char id[32]; | |
95 | char slogan[256]; | |
96 | char vendor[64]; | |
97 | char version[64]; | |
98 | char version_codename[32]; | |
99 | char version_id[8]; | |
100 | char tag[40]; | |
101 | }; | |
102 | ||
103 | int pakfire_distro(struct pakfire_distro* distro, const char* path); | |
104 | ||
9b171c6a MT |
105 | // PIDFD |
106 | ||
107 | int pidfd_get_pid(int pidfd, pid_t* pid); | |
108 | ||
0ac2d74b MT |
109 | #endif /* PAKFIRE_PRIVATE */ |
110 | ||
111 | #endif /* PAKFIRE_OS_H */ |