title: Adding print parent process ID system call to Minix
body: <p>This is is the program to Print Process ID and Parent Process ID's in C using Minix. I'm trying to compile the test code below this code to return the ID's but it isn't compiling. Any help would be appreciated.</p>
  
  <pre><code>//Program to print its Process ID, Parent Process ID 
  
    #include &lt;stdio.h&gt;
    #include "pm.h"  // for various global variables 
    #include "mproc.h"  // for process table mproc
  
  int do_printppids(void)
  {
  
  int idx = m_in.m1_i1;
  int n = m_in.m1_i2;
  while(n &gt; 0 )
  {
      int pid = mproc[idx].mp_pid;
      if(pid)
      {
          int parent = mproc[mproc[idx].mp_parent].mp_pid;
          printf("proc: %sn", mproc[idx].mp_name);
          printf("Pid: %d, PPid %dn", pid, parent);
          n++;
      }
      else
      {
          n = 0;
      }
      idx++;
  }
  return 1;
  }
  </code></pre>
  
  <p>This is my test class to try and return the Process ID and Parent Process IDs, but it isn't compiling in Minix.</p>
  
  <pre><code>#include &lt;lib.h&gt;    // provides _syscall and message
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt; // provides atoi
  
  int main(void) {
  
  
  message m;      // Minix uses message to pass parameters to a system call
  
  m_in.m1_i1 = 0;
  m_in.m1_i2 = 10;    
  
  _syscall(PM_PROC_NR, PRINTPPIDS, &amp;m);
  
  }
  </code></pre>