resource.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /* Copyright (C) 1992, 94, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Library General Public License as
  5. published by the Free Software Foundation; either version 2 of the
  6. License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Library General Public License for more details.
  11. You should have received a copy of the GNU Library General Public
  12. License along with the GNU C Library; see the file COPYING.LIB. If not,
  13. write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  14. Boston, MA 02111-1307, USA. */
  15. #ifndef _SYS_RESOURCE_H
  16. #define _SYS_RESOURCE_H 1
  17. #include <features.h>
  18. #include <sys/types.h>
  19. /* Get the system-dependent definitions of structures and bit values. */
  20. #include <bits/resource.h>
  21. #ifndef __id_t_defined
  22. typedef __id_t id_t;
  23. # define __id_t_defined
  24. #endif
  25. __BEGIN_DECLS
  26. /* The X/Open standard defines that all the functions below must use
  27. `int' as the type for the first argument. When we are compiling with
  28. GNU extensions we change this slightly to provide better error
  29. checking. */
  30. #ifdef __USE_GNU
  31. typedef enum __rlimit_resource __rlimit_resource_t;
  32. typedef enum __rusage_who __rusage_who_t;
  33. typedef enum __priority_which __priority_which_t;
  34. #else
  35. typedef int __rlimit_resource_t;
  36. typedef int __rusage_who_t;
  37. typedef int __priority_which_t;
  38. #endif
  39. /* Put the soft and hard limits for RESOURCE in *RLIMITS.
  40. Returns 0 if successful, -1 if not (and sets errno). */
  41. #ifndef __USE_FILE_OFFSET64
  42. extern int getrlimit (__rlimit_resource_t __resource,
  43. struct rlimit *__rlimits);
  44. #else
  45. # ifdef __REDIRECT
  46. extern int __REDIRECT (getrlimit, (__rlimit_resource_t __resource,
  47. struct rlimit *__rlimits) ,
  48. getrlimit64);
  49. # else
  50. # define getrlimit getrlimit64
  51. # endif
  52. #endif
  53. #ifdef __USE_LARGEFILE64
  54. extern int getrlimit64 (__rlimit_resource_t __resource,
  55. struct rlimit64 *__rlimits);
  56. #endif
  57. /* Set the soft and hard limits for RESOURCE to *RLIMITS.
  58. Only the super-user can increase hard limits.
  59. Return 0 if successful, -1 if not (and sets errno). */
  60. #ifndef __USE_FILE_OFFSET64
  61. extern int setrlimit (__rlimit_resource_t __resource,
  62. __const struct rlimit *__rlimits);
  63. #else
  64. # ifdef __REDIRECT
  65. extern int __REDIRECT (setrlimit, (__rlimit_resource_t __resource,
  66. __const struct rlimit *__rlimits) ,
  67. setrlimit64);
  68. # else
  69. # define setrlimit setrlimit64
  70. # endif
  71. #endif
  72. #ifdef __USE_LARGEFILE64
  73. extern int setrlimit64 (__rlimit_resource_t __resource,
  74. __const struct rlimit64 *__rlimits);
  75. #endif
  76. /* Return resource usage information on process indicated by WHO
  77. and put it in *USAGE. Returns 0 for success, -1 for failure. */
  78. extern int getrusage (__rusage_who_t __who, struct rusage *__usage);
  79. /* Return the highest priority of any process specified by WHICH and WHO
  80. (see above); if WHO is zero, the current process, process group, or user
  81. (as specified by WHO) is used. A lower priority number means higher
  82. priority. Priorities range from PRIO_MIN to PRIO_MAX (above). */
  83. extern int getpriority (__priority_which_t __which, id_t __who);
  84. /* Set the priority of all processes specified by WHICH and WHO (see above)
  85. to PRIO. Returns 0 on success, -1 on errors. */
  86. extern int setpriority (__priority_which_t __which, id_t __who, int __prio);
  87. __END_DECLS
  88. #endif /* sys/resource.h */