fork.c 586 B

12345678910111213141516171819202122232425
  1. /* -*- mode:c; c-file-style:"k&r"; c-basic-offset: 4; tab-width:4; indent-tabs-mode:nil; mode:auto-fill; fill-column:78; -*- */
  2. /* vim: set ts=4 sw=4 et tw=78 fo=cqt wm=0: */
  3. #include <shim_table.h>
  4. #include <errno.h>
  5. int main (int argc, char ** argv)
  6. {
  7. pid_t pid = shim_fork();
  8. if (pid < 0) {
  9. shim_write(1, "failed on fork\n", 15);
  10. shim_exit_group(-1);
  11. }
  12. if (pid == 0) {
  13. shim_write(1, "Hello, Dad!\n", 12);
  14. }
  15. else {
  16. shim_write(1, "Hello, Kid!\n", 12);
  17. }
  18. shim_exit_group(0);
  19. return 0; // should not reach here.
  20. }