#include "kernel/types.h"
#include "kernel/stat.h"
#include "user/user.h"
#include "kernel/param.h"

int
main()
{
  int pid = fork();
  if (pid < 0) {
    printf("[pid %d] Fork failed\n", getpid());
    exit(pid);
  }

  if (pid == 0) {
    while (!pause(2))
      printf("[pid %d] Hello from target\n", getpid());
  } else {
    pause(10);

    if (signal(pid, SIGSTOP) == 0)
      printf("[pid %d] Target stopped\n", getpid());
    else {
      printf("[pid %d] Signal failed\n", getpid());
      exit(-1);
    }

    pause(20);

    printf("[pid %d] Exiting\n", getpid());
  }

  exit(0);
}
