sac.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. #include <u.h>
  10. #include <libc.h>
  11. #include <../boot/boot.h>
  12. /*
  13. * HACK - take over from boot since file system is not
  14. * available on a pipe
  15. */
  16. void
  17. configsac(Method *mp)
  18. {
  19. int fd;
  20. char cmd[64];
  21. USED(mp);
  22. /*
  23. * create the name space, mount the root fs
  24. */
  25. if(bind("/", "/", MREPL) < 0)
  26. fatal("bind /");
  27. if(bind("#C", "/", MAFTER) < 0)
  28. fatal("bind /");
  29. /* fixed sysname - enables correct namespace file */
  30. fd = open("#c/sysname", OWRITE);
  31. if(fd < 0)
  32. fatal("open sysname");
  33. write(fd, "brick", 5);
  34. close(fd);
  35. fd = open("#c/hostowner", OWRITE);
  36. if(fd < 0)
  37. fatal("open sysname");
  38. write(fd, "brick", 5);
  39. close(fd);
  40. sprint(cmd, "/%s/init", cputype);
  41. print("starting %s\n", cmd);
  42. execl(cmd, "init", "-c", 0);
  43. fatal(cmd);
  44. }
  45. int
  46. connectsac(void)
  47. {
  48. /* does not get here */
  49. return -1;
  50. }