mod.rs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. //! sys/resource.h implementation for Redox, following
  2. //! http://pubs.opengroup.org/onlinepubs/7908799/xsh/sysresource.h.html
  3. use header::sys_time::timeval;
  4. use platform;
  5. use platform::types::*;
  6. use platform::{Pal, Sys};
  7. // Exported in bits file
  8. // const RUSAGE_SELF: c_int = 0;
  9. // const RUSAGE_CHILDREN: c_int = -1;
  10. // const RUSAGE_BOTH: c_int = -2;
  11. // const RUSAGE_THREAD: c_int = 1;
  12. type rlim_t = u64;
  13. #[repr(C)]
  14. pub struct rlimit {
  15. pub rlim_cur: rlim_t,
  16. pub rlim_max: rlim_t,
  17. }
  18. #[repr(C)]
  19. pub struct rusage {
  20. pub ru_utime: timeval,
  21. pub ru_stime: timeval,
  22. pub ru_maxrss: c_long,
  23. pub ru_ixrss: c_long,
  24. pub ru_idrss: c_long,
  25. pub ru_isrss: c_long,
  26. pub ru_minflt: c_long,
  27. pub ru_majflt: c_long,
  28. pub ru_nswap: c_long,
  29. pub ru_inblock: c_long,
  30. pub ru_oublock: c_long,
  31. pub ru_msgsnd: c_long,
  32. pub ru_msgrcv: c_long,
  33. pub ru_nsignals: c_long,
  34. pub ru_nvcsw: c_long,
  35. pub ru_nivcsw: c_long,
  36. }
  37. // #[no_mangle]
  38. pub unsafe extern "C" fn getpriority(which: c_int, who: id_t) -> c_int {
  39. unimplemented!();
  40. }
  41. // #[no_mangle]
  42. pub unsafe extern "C" fn getrlimit(resource: c_int, rlp: *mut rlimit) -> c_int {
  43. unimplemented!();
  44. }
  45. #[no_mangle]
  46. pub unsafe extern "C" fn getrusage(who: c_int, r_usage: *mut rusage) -> c_int {
  47. Sys::getrusage(who, r_usage)
  48. }
  49. // #[no_mangle]
  50. pub unsafe extern "C" fn setpriority(which: c_int, who: id_t, nice: c_int) -> c_int {
  51. unimplemented!();
  52. }
  53. // #[no_mangle]
  54. pub unsafe extern "C" fn setrlimit(resource: c_int, rlp: *const rlimit) -> c_int {
  55. unimplemented!();
  56. }