text: #include "types.h"
  #include "x86.h"
  #include "defs.h"
  #include "date.h"
  #include "param.h"
  #include "memlayout.h"
  #include "mmu.h"
  #include "proc.h"
  #include "new.h"
  
  int
  sys_fork(void)
  {
    return fork();
  }
  
  int
  sys_exit(void)
  {
    exit();
    return 0;  // not reached
  }
  
  int
  sys_wait(void)
  {
    return wait();
  }
  
  int
  sys_kill(void)
  {
    int pid;
  
    if(argint(0, &pid) < 0)
      return -1;
    return kill(pid);
  }
  
  int
  sys_getpid(void)
  {
    return myproc()->pid;
  }
  
  int
  sys_sbrk(void)
  {
    int addr;
    int n;
  
    if(argint(0, &n) < 0)
      return -1;
    addr = myproc()->sz;
    if(growproc(n) < 0)
      return -1;
    return addr;
  }
  
  int
  sys_sleep(void)
  {
    int n;
    uint ticks0;
  
    if(argint(0, &n) < 0)
      return -1;
    acquire(&tickslock);
    ticks0 = ticks;
    while(ticks - ticks0 < n){
      if(myproc()->killed){
        release(&tickslock);
        return -1;
      }
      sleep(&ticks, &tickslock);
    }
    release(&tickslock);
    return 0;
  }
  
  // return how many clock tick interrupts have occurred
  // since start.
  int
  sys_uptime(void)
  {
    uint xticks;
  
    acquire(&tickslock);
    xticks = ticks;
    release(&tickslock);
    return xticks;
  }
  
  int 
  sys_noob( void )
  {
      return noob();
  }
  
  int 
  sys_waitx(void)
  {
      int * waittime ;
      int * runtime;
        if(argptr(0, (char**)&waittime, sizeof(int)) < 0)
            return 90;
  
        if(argptr(1, (char**)&runtime, sizeof(int)) < 0)
            return 91;
  
      return waitx(waittime,runtime);
  }
  
  int 
  sys_set_priority (void )
  {
      int procid ;
      int priority;
  
      if (argint (0,&procid) < 0 )
          return -1;
     
      if (argint(1,&priority) < 0)
          return -1;
  
      return set_priority(procid,priority);
  }
  
  int 
  sys_ps (void)
  {
      return ps();
  }
  
  int 
  sys_getpinfo(void)
  {
      int pid ;
      struct proc_stat * argument;
      if (argint (0,&pid) < 0 )
          return -1;
      if (argptr(1,(void*)&argument,sizeof(argument))<0)
          return 87;
  
      return getpinfo(pid,argument);
  
  }
  
  
  
  
  