Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>A system call is a service provided by Linux kernel. In C programming, functions are defined in libc which provide a wrapper for many system calls. The function call <a href="http://linux.die.net/man/2/write" rel="noreferrer"><code>write()</code></a> is one of these system calls. </p> <p>The first argument passed to <a href="http://linux.die.net/man/2/write" rel="noreferrer"><code>write()</code></a> is the file descriptor to write to. The symbolic constants <code>STDERR_FILENO</code>, <code>STDIN_FILENO</code>, and <code>STDOUT_FILENO</code> are respectively defined to <strong>2</strong>, <strong>0</strong>, and <strong>1</strong> in <a href="http://www.opengroup.org/onlinepubs/009695399/basedefs/unistd.h.html" rel="noreferrer"><strong>unidtd.h</strong></a>. You want to write to either <strong>STDOUT_FILENO</strong> or <strong>STDERR_FILENO</strong>.</p> <pre><code>const char msg[] = "Hello World!"; write(STDOUT_FILENO, msg, sizeof(msg)-1);</code></pre> <hr> <p>You can alternatively use the <a href="http://linux.die.net/man/2/syscall" rel="noreferrer"><code>syscall()</code></a> function to perform an indirrect system call by specifying the function number defined in <strong>syscall.h</strong> or <strong>unistd.h</strong>. Using this method, you can guarantee that you are only using system calls. You may find <a href="http://www.digilife.be/quickreferences/QRC/LINUX%20System%20Call%20Quick%20Reference.pdf" rel="noreferrer"><em>The Linux System Call Quick Refernence</em></a> (PDF Link) to be helpful.</p> <pre><code>/* 4 is the system call number for write() */ const char msg[] = "Hello World!"; syscall(4, STDOUT_FILENO, msg, sizeof(msg)-1);</code></pre>
    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. 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.
    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