Answered step by step
Verified Expert Solution
Question
1 Approved Answer
any help please I only want to get same output below how to do it ? thank you Add a new system call called trace
any help please I only want to get same output below how to do it thank you Add a new system call called trace to xv Its syntax is
int traceint
When called with a nonzero parameter, eg trace system call tracing is
turned on for that process. Each system call from that process will be printed to
the console in a userfriendly format showing:
the process ID
the process name
the system call number
the system call name
Any other processes will not have their system calls printed unless they also call
trace
Calling trace turns tracing off for that process. System calls will no longer be
printed to the console.
In all cases, the trace system call also returns the total number of system calls
that the process has made. Hence, you can write code such as:
printftotal system calls so far d
trace;
The system call counting for each system call on a perprocess basis. You will
need to keep track of this in the process control block, the proc ################################################### how to get same below output:
pid: sh syscallread
pid: sh syscallread
pid: sh syscallfork
pid: sh syscallwait
pid: sh syscallsbrk
pid: sh syscallexec
pid: try syscallmkdir
pid: try syscallopen
pid: try syscallwrite
pid: try syscallclose
pid: try syscallexit
pid: sh syscallwrite
pid: sh syscallwrite
syscall.c:
int tracing ;
void syscallvoid
int num ;
struct proc curproc myproc;
num curproctf myproc;
ifnum cupr orcvor;c : my
how to structure.
Write a test program tryc to test your trace system call&& num NELEMsyscallsnum
cprintfs
d
sysnamesnum num;
iftracing
cprintfd s: unknown sys call d s
curprocpid, curporcnam, sysnamesnum;
cprintf
;
curproctfeax syscallsnum;
else
cprintfd s: unknown sys call d
curprocpid, curprocname, num;
curporctfeax;
int sysmysystemcallvoid;
################################
try.c
#include "types.h
#include "stat.h
#include "user.h
int mainvoid
trace;
printf "hello";
int nocalls trace;
printf "total system calls so far d
nocalls;
exit
Step 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