title: Does functions in API make system calls themselves or system calls made by API are aided by system-call interface in the runtime support system?
body: <p>I was going through the Dinosaur book by Galvin where I faced the difficulty as asked in the question.</p>
  <blockquote>
  <p>Typically application developers design programs according to an <strong>application programming interface (API)</strong>. The API specifies a set of functions that are available to an application programmer, including the parameters that are passed to each function and the return values the programmer can expect.</p>
  </blockquote>
  <p>The text adds that:</p>
  <blockquote>
  <p>Behind the scenes the functions that make up an API typically invoke the actual system calls on behalf of the application programmer. For example, the Win32 function <code>CreateProcess()</code> (which unsurprisingly is used to create a new process) actually calls the <code>NTCreateProcess()</code> system call in the Windows kernel.</p>
  </blockquote>
  <p>From the above two points I came to know that: Programmers using the API, make the function calls to the API corresponding to the system call which they want to make. The concerning function in the API then actually makes the system call.</p>
  <p>Next what the text says confuses me a bit:</p>
  <blockquote>
  <p>The run-time support system (a set of functions built into libraries included with a compiler) for most programming languages provides a <strong>system-call interface</strong> that serves as the link to system calls made available by the operating system. <em><strong>The system-call interface intercepts function calls in the API and invokes the necessary system calls within the operating system.</strong></em> Typically, a number is associated with each system call, and the system-call interface maintains a table indexed according to these numbers. The system call interface then invokes the intended system call in the operating-system kernel and returns the status of the system call and any return values.</p>
  </blockquote>
  <p>The above excerpt makes me feel that the functions in the API does not make the system calls directly. There are probably function built into the system-call interface of the runtime support system, which are waiting for <strong>an event of system call</strong> from the function in the API.</p>
  <p><a href="https://i.stack.imgur.com/kvYuy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kvYuy.png" alt="Diagram" /></a></p>
  <p>The above is a diagram in the text explaining the working of the system call interface.</p>
  <p>The text later explains the working of a system call in the C standard library as follows:</p>
  <p><a href="https://i.stack.imgur.com/Kb0qp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Kb0qp.png" alt="C Standard Library" /></a></p>
  <p>which is quite clear.</p>