when we write ls -l | wc -l
command on terminal what system calls are made internally at kernel level??
and How can we verify all those system calls made.
Asked
Active
Viewed 205 times
0

Rahul Kumar Dubey
- 788
- 1
- 6
- 19
-
Look at the source code for these commands. I think they are all in `coreutils` package. – Oct 15 '12 at 19:18
-
you could study the source code of both – Serge Oct 15 '12 at 19:18
-
4Or use `strace -o /tmp/ls.out ls -l | strace -o /tmp/wc.out wc -l` to trace each system call for you... (assuming this is Linux, anyway - on Solaris it would be `truss` instead of `strace`; AIX and other *NIXen have similar facilities, but those are the two I know best...) – twalberg Oct 15 '12 at 19:30
-
@Aleksandar I am not asking about the system call of each individual commands but the when they are used in conjunction pipelining. – Rahul Kumar Dubey Oct 16 '12 at 03:15
-
1@Serge how can i get system call used when both are used in pipelining by reading source code.. can't you explain the system call used during pipelining. – Rahul Kumar Dubey Oct 16 '12 at 03:17
-
@twalberg thanks yours reply worked:) – Rahul Kumar Dubey Oct 16 '12 at 03:19
-
It is not different from normal situation when input/output is done without pipelining: `ls` uses write to the FD#1; `wc` uses read ferm fd#1. The only difference that the shell program created the pipe _before_ it created both processes and these processes created with pipe's FDs instead of FD's of tty device. – Serge Oct 16 '12 at 11:45
-
@Rahul: If you found the working solution for the question, you could answer your own question and close it. – askmish Oct 18 '12 at 12:40