mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:17:44 +00:00
Kernel: Add a mode flag to sys$purge and allow purging clean inodes
This commit is contained in:
parent
c74cde918a
commit
1f31156173
7 changed files with 83 additions and 17 deletions
|
@ -1,9 +1,26 @@
|
|||
#include <stdio.h>
|
||||
#include <Kernel/Syscall.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(int, char**)
|
||||
#define PURGE_ALL_VOLATILE 0x1
|
||||
#define PURGE_ALL_CLEAN_INODE 0x2
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int purged_page_count = syscall(SC_purge);
|
||||
int mode = 0;
|
||||
if (argc == 1) {
|
||||
mode = PURGE_ALL_VOLATILE | PURGE_ALL_CLEAN_INODE;
|
||||
} else {
|
||||
if (!strcmp(argv[1], "-c")) {
|
||||
mode = PURGE_ALL_CLEAN_INODE;
|
||||
} else if (!strcmp(argv[1], "-v")) {
|
||||
mode = PURGE_ALL_VOLATILE;
|
||||
} else {
|
||||
fprintf(stderr, "Unknown option: %s\n", argv[1]);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
int purged_page_count = syscall(SC_purge, mode);
|
||||
printf("Purged page count: %d\n", purged_page_count);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue