Question: Open sysproc.c file and add the two system calls. //Add this where the other system calls are defined in syscall.c extern int sys_cps(void); extern int
- Open sysproc.c file and add the two system calls.
//Add this where the other system calls are defined in syscall.c
extern int sys_cps(void);
extern int sys_chpr(void);
| /* |
|
|
| . |
|
| . |
|
| . |
|
| */ |
|
|
|
|
| //Add this inside static int (*syscalls[])(void) |
|
| [SYS_cps] sys_cps, |
|
| [SYS_chpr] sys_chpr, |
- Create a ps.c and nice.c file in which the cps and chpr functions will be called respectively.
| #include "types.h" |
|
|
| #include "stat.h" |
|
| #include "user.h" |
|
| #include "fcntl.h" |
|
|
|
|
| int main(void){ |
|
| cps(); |
|
| exit(); |
|
| } |
| #include "types.h" |
|
|
| #include "stat.h" |
|
| #include "user.h" |
|
| #include "fcntl.h" |
|
|
|
|
| int |
|
| main(int argc, char *argv[]) |
|
| { |
|
| int priority, pid; |
|
| if(argc < 3){ |
|
| printf(2,"Usage: nice pid priority "); |
|
| exit(); |
|
| } |
|
| pid = atoi(argv[1]); |
|
| priority = atoi(argv[2]); |
|
| if (priority < 0 || priority > 20){ |
|
| printf(2,"Invalid priority (0-20)! "); |
|
| exit(); |
|
| } |
|
| chpr(pid, priority); |
|
| exit(); |
|
| } |
Can someone help me to solve it using ubuntu, please? My laptop is broken please help me?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
