sac.c 802 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #include <u.h>
  2. #include <libc.h>
  3. #include <../boot/boot.h>
  4. // HACK - take over from boot since file system is not
  5. // available on a pipe
  6. void
  7. configsac(Method *mp)
  8. {
  9. int fd;
  10. char cmd[64];
  11. USED(mp);
  12. /*
  13. * create the name space, mount the root fs
  14. */
  15. if(bind("/", "/", MREPL) < 0)
  16. fatal("bind /");
  17. if(bind("#C", "/", MAFTER) < 0)
  18. fatal("bind /");
  19. // fixed sysname - enables correct namespace file
  20. fd = open("#c/sysname", OWRITE);
  21. if(fd < 0)
  22. fatal("open sysname");
  23. write(fd, "brick", 5);
  24. close(fd);
  25. fd = open("#c/hostowner", OWRITE);
  26. if(fd < 0)
  27. fatal("open sysname");
  28. write(fd, "brick", 5);
  29. close(fd);
  30. sprint(cmd, "/%s/init", cputype);
  31. print("starting %s\n", cmd);
  32. execl(cmd, "init", "-c", 0);
  33. fatal(cmd);
  34. }
  35. int
  36. connectsac(void)
  37. {
  38. // does not get here
  39. return -1;
  40. }