sac.c 815 B

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