![]() |
.. (לתיקייה המכילה) | |
Can you give an example of using the system calls? | |
Yes, the code: pid = getpid(); init_syscalls_counters(pid, 60000); int num = get_num_syscalls(pid); int max; get_max_proc_syscalls(&max); printf("get_num_syscalls returned %d\n",num); printf("get_max_proc_syscalls gave %d\n, max); will print: get_num_syscalls returned 60001 get_max_proc_syscalls gave 60002 |
I have heard that there was a revision to the assignment, can you elaborate? | |
Yes, updating the counter after the system call caused a lot of issues. To address this I've decided to update the counter before the system call. to do so you should update the system call code to do: jae badsys call update_counter <- movl EAX(%esp),%eax <- call *SYMBOL_NAME(sys_call_table)(,%eax,4) movl %eax,EAX(%esp) # save the return value ENTRY(ret_from_sys_call) rather than: movl %eax,EAX(%esp) # save the return value call update_counter <- ENTRY(ret_from_sys_call) Note that as a result the behavior of fork will change because now both the parent and the child should have the same counter value after returning from fork. The HW1 Wet files were updated to address this issue. Please also note that all the change that you need to do is to copy-paste three lines instead of another three. |
How should the file with the system call wrappers be called? | |
syscall_counter.h The assignment files are updated accordingly |