mod.rs 1.2 KB

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