lib.rs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. //! sys/wait.h implementation for Redox, following
  2. //! http://pubs.opengroup.org/onlinepubs/7908799/xsh/syswait.h.html
  3. #![no_std]
  4. extern crate platform;
  5. extern crate sys_resource;
  6. use platform::types::*;
  7. use sys_resource::rusage;
  8. pub const WNOHANG: c_int = 1;
  9. pub const WUNTRACED: c_int = 2;
  10. pub const WSTOPPED: c_int = 2;
  11. pub const WEXITED: c_int = 4;
  12. pub const WCONTINUED: c_int = 8;
  13. pub const WNOWAIT: c_int = 0x1000000;
  14. pub const __WNOTHREAD: c_int = 0x20000000;
  15. pub const __WALL: c_int = 0x40000000;
  16. pub const __WCLONE: c_int = 0x80000000;
  17. #[no_mangle]
  18. pub unsafe extern "C" fn wait(stat_loc: *mut c_int) -> pid_t {
  19. waitpid(!0, stat_loc, 0)
  20. }
  21. // #[no_mangle]
  22. pub unsafe extern "C" fn wait3(
  23. stat_loc: *mut c_int,
  24. options: c_int,
  25. resource_usage: *mut rusage,
  26. ) -> pid_t {
  27. unimplemented!();
  28. }
  29. /*
  30. * TODO: implement idtype_t, id_t, and siginfo_t
  31. *
  32. * #[no_mangle]
  33. * pub unsafe extern "C" fn waitid(
  34. * idtype: idtype_t,
  35. * id: id_t,
  36. * infop: siginfo_t,
  37. * options: c_int
  38. * ) -> c_int {
  39. * unimplemented!();
  40. * }
  41. */
  42. #[no_mangle]
  43. pub unsafe extern "C" fn waitpid(pid: pid_t, stat_loc: *mut c_int, options: c_int) -> pid_t {
  44. platform::waitpid(pid, stat_loc, options)
  45. }