Clarification of STRACE output

I was looking through this question and decided to implement the program myself.

Interpreting STRACE output - pipes and forks

The strace output is different for me:

execve("./fork", ["./fork"], [/* 61 vars */]) = 0
arch_prctl(ARCH_SET_FS, 0x173f880)      = 0
pipe([3, 4])                            = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x173fb50) = 2968
execve("/usr/bin/wc", ["wc", "-l"], [/* 61 vars */]) = 0
arch_prctl(ARCH_SET_FS, 0x7f4a4738e740) = 0
Process 2968 attached
[pid  2968] execve("/bin/ls", ["ls"], [/* 61 vars */]) = 0
[pid  2968] arch_prctl(ARCH_SET_FS, 0x7f1954bd0840) = 0
[pid  2968] exit_group(0)               = ?
[pid  2967] exit_group(0)               = ?
[pid  2967] +++ exited with 0 +++
+++ exited with 0 +++

Can you explain why this is outputting differently? Is it doing the same thing?

Thanks so much.


when you're dealing with multiple processes, things will be racy by design -- there's no guarantee that the parent or child will execute in any order. neither output is wrong.

in your case, it looks like the parent managed to execute more syscalls before the child was run. in the referenced thread, the child executed more quickly.

Need Your Help

How to enable Nuget packages restore under Xamarin Studio in Mac OS X

xamarin nuget xamarin-studio nuget-package-restore

I enabled auto-restore feature for my project under Visual Studio but when I switched to MAC and Xamarin Studio I was unable to restore those packages:

Close programs with Vbs one click

loops vbscript

I am trying to get my script to loop through the if statment(s) and close the programs if they are open. However with what I have now I am only able to close the programs in the if statement by cli...