resource.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #ifndef _LINUX_RESOURCE_H
  2. #define _LINUX_RESOURCE_H
  3. #include <linux/time.h>
  4. /*
  5. * Resource control/accounting header file for linux
  6. */
  7. /*
  8. * Definition of struct rusage taken from BSD 4.3 Reno
  9. *
  10. * We don't support all of these yet, but we might as well have them....
  11. * Otherwise, each time we add new items, programs which depend on this
  12. * structure will lose. This reduces the chances of that happening.
  13. */
  14. #define RUSAGE_SELF 0
  15. #define RUSAGE_CHILDREN (-1)
  16. #define RUSAGE_BOTH (-2) /* sys_wait4() uses this */
  17. #define RUSAGE_THREAD 1 /* only the calling thread */
  18. struct rusage {
  19. struct timeval ru_utime; /* user time used */
  20. struct timeval ru_stime; /* system time used */
  21. long ru_maxrss; /* maximum resident set size */
  22. long ru_ixrss; /* integral shared memory size */
  23. long ru_idrss; /* integral unshared data size */
  24. long ru_isrss; /* integral unshared stack size */
  25. long ru_minflt; /* page reclaims */
  26. long ru_majflt; /* page faults */
  27. long ru_nswap; /* swaps */
  28. long ru_inblock; /* block input operations */
  29. long ru_oublock; /* block output operations */
  30. long ru_msgsnd; /* messages sent */
  31. long ru_msgrcv; /* messages received */
  32. long ru_nsignals; /* signals received */
  33. long ru_nvcsw; /* voluntary context switches */
  34. long ru_nivcsw; /* involuntary " */
  35. };
  36. struct rlimit {
  37. unsigned long rlim_cur;
  38. unsigned long rlim_max;
  39. };
  40. #define RLIM64_INFINITY (~0ULL)
  41. struct rlimit64 {
  42. __u64 rlim_cur;
  43. __u64 rlim_max;
  44. };
  45. #define PRIO_MIN (-20)
  46. #define PRIO_MAX 20
  47. #define PRIO_PROCESS 0
  48. #define PRIO_PGRP 1
  49. #define PRIO_USER 2
  50. /*
  51. * Limit the stack by to some sane default: root can always
  52. * increase this limit if needed.. 8MB seems reasonable.
  53. */
  54. #define _STK_LIM (8*1024*1024)
  55. /*
  56. * GPG2 wants 64kB of mlocked memory, to make sure pass phrases
  57. * and other sensitive information are never written to disk.
  58. */
  59. #define MLOCK_LIMIT ((PAGE_SIZE > 64*1024) ? PAGE_SIZE : 64*1024)
  60. /*
  61. * Due to binary compatibility, the actual resource numbers
  62. * may be different for different linux versions..
  63. */
  64. #include <asm/resource.h>
  65. #ifdef __KERNEL__
  66. struct task_struct;
  67. int getrusage(struct task_struct *p, int who, struct rusage __user *ru);
  68. int do_prlimit(struct task_struct *tsk, unsigned int resource,
  69. struct rlimit *new_rlim, struct rlimit *old_rlim);
  70. #endif /* __KERNEL__ */
  71. #endif