Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I have included what I need to do for part b, and what I have so far. I 2.2 Part B Write a default version
I have included what I need to do for part b, and what I have so far.
I
2.2 Part B Write a default version of program to report the behavior of the Linux kernel by inspecting kernel state. The program should print the following values to the user screen or console: CPU type and model Kernel version Amount of time since the system was last booted, in thefomdmm:5s (for example, 3 days 13 hours 46 minutes 32 seconds would be formatted as 03:13:46:32) . report date (gettimeofday) and machine hostname 3.2 Using argc and argv If you do Part C or D in addition to Part B, you will need to pass parameters to your program from the shel For example, suppose that your solution program is named observer. To solve Part B, you could call it with observer whereas to solve Part C or D, you could call with observer S If the program is providing information required for Part D, t might be called by $observer -1 10 600 computing information once every 10 seconds until 600 seconds have elapsed. The following code segment is an example for handling the three different ways that observer can be called. A C program may have the header file of the form: int main (int argc, char argv[]) You may omit the two arguments, arge and argv if no parameters are to be passed to the program by the shell. Alternately, they can be initialized so that arge is the number of symbols on the command line and argv is an array of pointers to character strings symbols on the command line. For example, if the observer program is called with no parameters, then arge will be set to 1 and argv[0] will point to the string observer. In the second example, argc will be set to 2, with argvI0] pointing to the string observer and argvl1] pointing to the string-s. The C main program can now reference these arguments as follows #include # i ncl ude #includeStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started