mirror of
https://github.com/caperren/school_archives.git
synced 2025-11-09 21:51:15 +00:00
Added OS II assignments
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
#include <stdio.h>
|
||||
#include <linux/unistd.h>
|
||||
|
||||
#define __sys_slob_free 400
|
||||
#define __sys_slob_used 401
|
||||
|
||||
int main (void){
|
||||
float fragmentation_percent;
|
||||
long used = syscall(__sys_slob_used);
|
||||
long free = syscall(__sys_slob_free);
|
||||
|
||||
fragmentation_percent = (float) free / (float) used;
|
||||
printf("Amount free: %ld.\n", free);
|
||||
printf("Amount used: %ld.\n", used);
|
||||
printf("Amount frag: %.2f%%.\n", fragmentation_percent);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user