resource.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #ifndef _LINUX_RESOURCE_H
  2. #define _LINUX_RESOURCE_H
  3. #include <linux/time.h>
  4. struct task_struct;
  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. 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 PRIO_MIN (-20)
  41. #define PRIO_MAX 20
  42. #define PRIO_PROCESS 0
  43. #define PRIO_PGRP 1
  44. #define PRIO_USER 2
  45. /*
  46. * Limit the stack by to some sane default: root can always
  47. * increase this limit if needed.. 8MB seems reasonable.
  48. */
  49. #define _STK_LIM (8*1024*1024)
  50. /*
  51. * GPG wants 32kB of mlocked memory, to make sure pass phrases
  52. * and other sensitive information are never written to disk.
  53. */
  54. #define MLOCK_LIMIT (8 * PAGE_SIZE)
  55. /*
  56. * Due to binary compatibility, the actual resource numbers
  57. * may be different for different linux versions..
  58. */
  59. #include <asm/resource.h>
  60. int getrusage(struct task_struct *p, int who, struct rusage __user *ru);
  61. #endif