1
0

stop_start.c 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * This file is part of Jehanne.
  3. *
  4. * Copyright (C) 2017 Giacomo Tesio <giacomo@tesio.it>
  5. *
  6. * Jehanne is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, version 2 of the License.
  9. *
  10. * Jehanne is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with Jehanne. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #include <u.h>
  19. #include <lib9.h>
  20. void
  21. main(int argc, char**argv)
  22. {
  23. int fd, n;
  24. char *path;
  25. path = smprint("/proc/%d/ctl", getpid());
  26. fd = sys_open(path, OWRITE);
  27. if(fd < 0){
  28. print("FAIL: open");
  29. exits("FAIL");
  30. }
  31. n = jehanne_write(fd, "stop", 4);
  32. if(n < 0){
  33. print("FAIL: write");
  34. exits("FAIL");
  35. }
  36. sys_close(fd);
  37. print("PASS\n");
  38. exits("PASS");
  39. }