resource.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Resource control/accounting header file for linux-86
  3. */
  4. #ifndef _SYS_RESOURCE_H
  5. #define _SYS_RESOURCE_H
  6. #include <features.h>
  7. #include <sys/time.h>
  8. #include <limits.h>
  9. #define RUSAGE_SELF 0
  10. #define RUSAGE_CHILDREN (-1)
  11. #define RUSAGE_BOTH (-2) /* sys_wait4() uses this */
  12. struct rusage {
  13. struct timeval ru_utime; /* user time used */
  14. struct timeval ru_stime; /* system time used */
  15. long ru_maxrss; /* maximum resident set size */
  16. long ru_ixrss; /* integral shared memory size */
  17. long ru_idrss; /* integral unshared data size */
  18. long ru_isrss; /* integral unshared stack size */
  19. long ru_minflt; /* page reclaims */
  20. long ru_majflt; /* page faults */
  21. long ru_nswap; /* swaps */
  22. long ru_inblock; /* block input operations */
  23. long ru_oublock; /* block output operations */
  24. long ru_msgsnd; /* messages sent */
  25. long ru_msgrcv; /* messages received */
  26. long ru_nsignals; /* signals received */
  27. long ru_nvcsw; /* voluntary context switches */
  28. long ru_nivcsw; /* involuntary " */
  29. };
  30. #define RLIM_INFINITY ((long)(~0UL>>1))
  31. struct rlimit {
  32. long rlim_cur;
  33. long rlim_max;
  34. };
  35. #define PRIO_MIN (-20)
  36. #define PRIO_MAX 20
  37. #define PRIO_PROCESS 0
  38. #define PRIO_PGRP 1
  39. #define PRIO_USER 2
  40. #define RLIMIT_CPU 0 /* CPU time in ms */
  41. #define RLIMIT_FSIZE 1 /* Maximum filesize */
  42. #define RLIMIT_DATA 2 /* max data size */
  43. #define RLIMIT_STACK 3 /* max stack size */
  44. #define RLIMIT_CORE 4 /* max core file size */
  45. #define RLIMIT_RSS 5 /* max resident set size */
  46. #define RLIMIT_NPROC 6 /* max number of processes */
  47. #define RLIMIT_NOFILE 7 /* max number of open files */
  48. #define RLIMIT_MEMLOCK 8 /* max locked-in-memory address space */
  49. #define RLIM_NLIMITS 9
  50. extern int getrlimit __P ((int __resource,
  51. struct rlimit *__rlp));
  52. extern int setrlimit __P ((int __resource,
  53. __const struct rlimit *__rlp));
  54. extern int getpriority __P((int __which, int __who));
  55. extern int setpriority __P((int __which, int __who,
  56. int __prio));
  57. extern int __getrusage __P ((int __who, struct rusage *__rusage));
  58. extern int getrusage __P ((int __who, struct rusage *__rusage));
  59. #endif /* _SYS_RESOURCE_H */