0

How can you see from the strace output that a pipeline of commands has been set up that links the processes together? Also, can all the process talk to eachother

execve("./mypipes", ["./mypipes"], [/* 57 vars */]) = 0
arch_prctl(ARCH_SET_FS, 0x7ff0f5cbd700) = 0
pipe([3, 4])                            = 0
pipe([5, 6])                            = 0
clone(Process 32313 attached
child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7ff0f5cbd9d0) = 32313
[pid 32312] clone(Process 32314 attached
child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7ff0f5cbd9d0) = 32314
[pid 32312] clone(Process 32315 attached
child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7ff0f5cbd9d0) = 32315
[pid 32313] execve("/bin/cat", ["cat", "/etc/passwd"], [/* 57 vars */] <unfinished ...>
[pid 32312] exit_group(32315)           = ?
[pid 32314] execve("/usr/bin/cut", ["cut", "-f1", "-d:"], [/* 57 vars */] <unfinished ...>
[pid 32313] <... execve resumed> )      = 0
[pid 32314] <... execve resumed> )      = 0
[pid 32315] execve("/usr/bin/sort", ["sort"], [/* 57 vars */]) = 0
[pid 32313] arch_prctl(ARCH_SET_FS, 0x7f4392d83700) = 0
[pid 32314] arch_prctl(ARCH_SET_FS, 0x7fb7fd75e700) = 0 
[pid 32315] arch_prctl(ARCH_SET_FS, 0x7fbda4e43700) = 0
[pid 32313] exit_group(0)               = ?
Process 32313 detached

1 Answers1

0

Yes the pipe system call create 2 pipes , let's call them parent talk and parent listen. fd[0] is parent talk and fd[1] is parent listen. The child reads from fd[0] and writes to fd[1]

phil
  • 561
  • 3
  • 10