Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>While your question is really more general (and only using <code>gcc</code> as an example), my first idea would be to use <code>strace</code> to figure out what it's doing. On my system (Ubuntu 11.10/x64), I just ran <code>strace</code>, like so:</p> <pre><code>strace -F -o sout gcc -Wall -o test test.c </code></pre> <p>This shows system calls for the <code>gcc</code> process, while following forks (<code>-F</code>) and sending the output of the trace to <code>sout</code>. Doing this, I can see that <code>gcc</code> here calls <code>vfork()</code>, and then <code>execve()</code> in the child, though the actual program's source might just do a simple <code>fork()</code>/<code>exec()</code>.</p> <p>The relevant output from <code>sout</code> is:</p> <pre><code>26264 stat("/usr/lib/gcc/x86_64-linux-gnu/4.6.1/cc1", {st_mode=S_IFREG|0755, st_size=11248824, ...}) = 0 26264 access("/usr/lib/gcc/x86_64-linux-gnu/4.6.1/cc1", X_OK) = 0 26264 vfork() = 26265 26264 wait4(26265, &lt;unfinished ...&gt; 26265 execve("/usr/lib/gcc/x86_64-linux-gnu/4.6.1/cc1", ["/usr/lib/gcc/x86_64-linux-gnu/4."..., "-quiet", "-imultilib", ".", "-imultiarch", "x86_64-linux-gnu", "test.c", "-quiet", "-dumpbase", "test.c", "-mtune=generic", "-march=x86-64", "-auxbase", "test", "-Wall", "-fstack-protector", ...], [/* 46 vars */]) = 0 </code></pre> <p>At the begnning of each line is the pid of the process running. So the primary process calls <code>stat()</code> to find <code>cc1</code>, then forks, and the child executes it.</p> <p>That being said, I could have answered your question without the citation; fork/exec is a common way to call sub-processes from your program.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload