resource.h 2.5 KB

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