previous | start | next

Example: do_mygetpid

We could add the function do_mygetpid to the misc.c file.

PUBLIC int do_mygetpid()
{
  /**
   * Global mp will point to the caller's process table entry.
   * Lookup information in the process table.
   * Insert this information in the reply message (also 
   * in the process table entry)
   */



  return OK;
}

This needs explanation, but for the moment note that do_mygetpid should do 2 things:

If the return value is negative, say -E, the _syscall function treats this as an error and returns -1 to the user and sets the the user global variable errno to E.

Otherwise, _syscall just returns the value your do_mygetpid function returned.



previous | start | next