I am Mine from Turkey, I am in comp. engineering. I have an assignment to do on Monday. I am too LittLe time to do it on time. Hovewer, my midterms will start on Monday. I can't achieve the goaL. If you impLement it(if you have time), or say it to me that how I can do it, it is so glad to solve my problem.
Thank you for helping me.
My assignment is below:
Thank you for helping me.
My assignment is below:
Goal
You will add a new system call to the Linux kernel that allows a user program to do four possible actions.
Retrieve system time
Change system time
Retrieve hostname
Change hostname
Change system time
Retrieve hostname
Change hostname
To demostrate your new system call works, you should provide a user program as well.
In this assignment, you will add a new system call called hostandtime to the Linux kernel that combines the functionalities of the above four system calls into one. hostandtime will take two arguments. The first argument is of type int indicating which of the four actions that hostandtime should perform. The second argument is a pointer to a struct of the following definition:
struct custom_struct {
char hostname[65];
struct timeval custom_time;
};
Given the following user program:
...
struct custom_struct my_var
...
...
if (hostandtime(flag, &my_var)) {
...
Depending on the value of the first argument, hostandtime does different actions.
flag action
0 hostandtime copies xtime to my_var.custom_time. Upon returning from hostandtime, my_var holds the current system's time.
1 before calling hostandtime, my_var.custom_time holds a new value of time inputted by the user. hostandtime will copy the value in my_var.custom_time to xtime, effectively changing the system's time.
2 hostandtime copies the system's hostname to my_var.hostname. Upon returning from hostandtime, my_var holds the current system's hostname.
3 before calling hostandtime, my_var.hostname holds a new hostname inputted by the user. hostandtime will copy the characters in my_var.hostname to override the system's hostname, effectively changing the system's hostname.
0 hostandtime copies xtime to my_var.custom_time. Upon returning from hostandtime, my_var holds the current system's time.
1 before calling hostandtime, my_var.custom_time holds a new value of time inputted by the user. hostandtime will copy the value in my_var.custom_time to xtime, effectively changing the system's time.
2 hostandtime copies the system's hostname to my_var.hostname. Upon returning from hostandtime, my_var holds the current system's hostname.
3 before calling hostandtime, my_var.hostname holds a new hostname inputted by the user. hostandtime will copy the characters in my_var.hostname to override the system's hostname, effectively changing the system's hostname.
cli and printk will be used.
Thanks again....
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.