Jordan Barnes
Jordan Barnes

Reputation: 31

Adding print parent process ID system call to Minix

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.

//Program to print its Process ID, Parent Process ID 

  #include <stdio.h>
  #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 > 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;
}

This is my test class to try and return the Process ID and Parent Process IDs, but it isn't compiling in Minix.

#include <lib.h>    // provides _syscall and message
#include <stdio.h>
#include <stdlib.h> // 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, &m);

}

Upvotes: 1

Views: 3089

Answers (1)

Jordan Barnes
Jordan Barnes

Reputation: 31

Literally make sure to update and save all files before running Make Service + Install and then recompile the test class. Spent 4 hours staring pointlessly at my code because of it sigh

Upvotes: 2

Related Questions