forked from SerenityOS/serenity
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Kernel: Add a mode flag to sys$purge and allow purging clean inodes
- Loading branch information
1 parent
c74cde9
commit 1f31156
Showing
7 changed files
with
83 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -467,3 +467,5 @@ struct ifreq { | |
|
||
#define AT_FDCWD -100 | ||
|
||
#define PURGE_ALL_VOLATILE 0x1 | ||
#define PURGE_ALL_CLEAN_INODE 0x2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,26 @@ | ||
#include <stdio.h> | ||
#include <Kernel/Syscall.h> | ||
#include <stdio.h> | ||
#include <string.h> | ||
|
||
#define PURGE_ALL_VOLATILE 0x1 | ||
#define PURGE_ALL_CLEAN_INODE 0x2 | ||
|
||
int main(int, char**) | ||
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; | ||
} |