Codes
1. Return Process PID
// kernel/sysproc.c
uint64
sys_hello(void)
{
printf("Hello from kernel syscall!\n");
return myproc()->pid; // Returns the current process ID
}2. Repeating Message
// kernel/sysproc.c
uint64
sys_hello(void)
{
int n;
argint(0, &n); // Fetch the first integer argument from user space
for(int i = 0; i < n; i++){
printf("Hello from kernel syscall!\n");
}
return 0;
}3. Print Execution Core
4. User-Provided Name
5. Global Call Counter
6. PID Filtering
7. Rate Limiting
8. Kernel Arithmetic
9. Syscall Number Logging
10. Conditional Success Output
Last updated