From the course: Advanced Linux: The Linux Kernel

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Solution: System calls (syscalls)

Solution: System calls (syscalls) - Linux Tutorial

From the course: Advanced Linux: The Linux Kernel

Solution: System calls (syscalls)

(upbeat music) - [Instructor] All right, I hope you were ready for those, kind of tricky. So first of all, we wanted to look at how to get strace to just summarize, you know, to count the number of system calls. So if we did a man on strace, and maybe we looked for count, keep searching, right there, it says -c so let's try that. So we do strace -c and we want to see date command. And if we look through that number of calls, the most number of calls was 31 for the open at system call. And then we got a lot of single calls and so forth. It's sorted by percentage of time. Alright, the next thing is we want to strace the cd command. This is tricky. If we say whereis cd. Turns out there's no executable program for cd. This is important. CD does map to a system call, but changing directory is something that changes the state of your shell. When you have an ordinary executable command, the shell will start a new process, like for the date command, it starts a new process and the new process…

Contents