File tree Expand file tree Collapse file tree 5 files changed +37
-23
lines changed Expand file tree Collapse file tree 5 files changed +37
-23
lines changed Original file line number Diff line number Diff line change 1
- #include "sys/system_info .h"
1
+ #include "sys/sys_info .h"
2
2
#include "ram/ram_info.h"
3
3
#include "cpu/cpu_info.h"
4
+ #include "rom/rom_info.h"
4
5
5
6
int main () {
6
- struct utsname system_info ;
7
- struct sysinfo mem_info ;
8
-
9
- print_system_info (& system_info );
10
- print_ram_info (& mem_info );
7
+ print_sys_info ();
11
8
print_cpu_info ();
9
+ print_ram_info ();
10
+ print_rom_info ();
12
11
13
12
return 0 ;
14
13
}
Original file line number Diff line number Diff line change 1
1
#include <stdio.h>
2
2
#include <sys/sysinfo.h>
3
3
4
- void print_ram_info (struct sysinfo * sys_info ) {
5
- sysinfo ( sys_info ) ;
6
-
7
- printf ("Uptime: %ld Hours\n" , sys_info -> uptime / 60 / 60 );
8
- printf ("Total RAM: %ld MiB\n" , sys_info -> totalram * sys_info -> mem_unit /
4
+ void print_ram_info () {
5
+ struct sysinfo sys_info ;
6
+ sysinfo ( & sys_info );
7
+ printf ("Uptime: %ld Hours\n" , sys_info . uptime / 60 / 60 );
8
+ printf ("Total RAM: %ld MiB\n" , sys_info . totalram * sys_info . mem_unit /
9
9
1024 / 1024 );
10
- printf ("Free RAM: %ld MiB\n" , sys_info -> freeram * sys_info -> mem_unit / 1024
10
+ printf ("Free RAM: %ld MiB\n" , sys_info . freeram * sys_info . mem_unit / 1024
11
11
/ 1024 );
12
12
}
Original file line number Diff line number Diff line change
1
+ #include <stdio.h>
2
+ #include <sys/statvfs.h>
1
3
4
+ void print_rom_info () {
5
+ printf ("\nDisk Information:\n" );
6
+ struct statvfs fs_info ;
7
+ if (statvfs ("/" , & fs_info ) == 0 ) {
8
+ printf ("Total Disk Space: %ld MiB\n" , fs_info .f_blocks * fs_info .f_bsize
9
+ / 1024 / 1024 );
10
+ printf ("Free Disk Space: %ld MiB\n" , fs_info .f_bfree * fs_info .f_bsize /
11
+ 1024 / 1024 );
12
+ printf ("Used Disk Space: %ld MiB\n" , (fs_info .f_blocks -
13
+ fs_info .f_bfree ) * fs_info .f_bsize / 1024 / 1024 );
14
+ }
15
+ }
Original file line number Diff line number Diff line change
1
+ #include <stdio.h>
2
+ #include <sys/utsname.h>
3
+
4
+ void print_sys_info () {
5
+ struct utsname sys_info ;
6
+ uname (& sys_info );
7
+ printf ("System Name: %s\n" , sys_info .sysname );
8
+ printf ("Host Name: %s\n" , sys_info .nodename );
9
+ printf ("Kernel Release: %s\n" , sys_info .release );
10
+ printf ("System Version: %s\n" , sys_info .version );
11
+ printf ("Machine Type: %s\n" , sys_info .machine );
12
+ }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments