text: #include "types.h"
  #include "riscv.h"
  #include "defs.h"
  #include "date.h"
  #include "param.h"
  #include "memlayout.h"
  #include "spinlock.h"
  #include "proc.h"
  
  uint64 //our code
  sys_set_priority(void) 
  {
    //first moving user argument to the kernel
    int priority;
    if(argint(0, &priority) < 0){ 
      return -1;
    }
    //second - calling set_priority function
    return set_priority(priority);
  }
  
  
  uint64 //our code
  sys_wait_stat(void) 
  {
    //first moving user arguments to the kernel
    uint64 status;
    uint64 performance;
    if(argaddr(0, &status) < 0){ 
      return -1;
    }
    if(argaddr(1, &performance) < 0){ 
      return -1; 
    }
    //second - calling wait_stat function
    return wait_stat(status, performance);
  }
  
  uint64 //our code
  sys_trace(void) 
  {
    //first moving user arguments - pid and mask- to the kernel
    int mask;
    int pid;
    if(argint(0, &mask) < 0){ 
      return -1;
    }
    if(argint(1, &pid) < 0){
      return -1; 
    }
    //second - calling trace function
    return trace(mask, pid);
  }
  
  uint64
  sys_exit(void)
  {
    int n;
    if(argint(0, &n) < 0)
      return -1;
    exit(n);
    return 0;  // not reached
  }
  
  uint64
  sys_getpid(void)
  {
    return myproc()->pid;
  }
  
  uint64
  sys_fork(void)
  {
    return fork();
  }
  
  uint64
  sys_wait(void)
  {
    uint64 p;
    if(argaddr(0, &p) < 0)
      return -1;
    return wait(p);
  }
  
  uint64
  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;
  }
  
  uint64
  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;
  }
  
  uint64
  sys_kill(void)
  {
    int pid;
  
    if(argint(0, &pid) < 0)
      return -1;
    return kill(pid);
  }
  
  // return how many clock tick interrupts have occurred
  // since start.
  uint64
  sys_uptime(void)
  {
    uint xticks;
  
    acquire(&tickslock);
    xticks = ticks;
    release(&tickslock);
    return xticks;
  }
  