rlimit.h (858B)
1 /* What a mess. This file attempts to straighten everything out. */ 2 3 #if HAVE_SETRLIMIT 4 5 #if HAVE_SYS_RESOURCE_H 6 #include <sys/time.h> 7 #if RLIMIT_NEEDS_KERNEL 8 #define _KERNEL 9 #endif 10 #include <sys/resource.h> 11 #if RLIMIT_NEEDS_KERNEL 12 #undef _KERNEL 13 #endif 14 #else 15 #include <sys/times.h> 16 #endif 17 18 #if HAVE_LIMITS_H 19 #include <limits.h> 20 #endif 21 22 #ifndef HAVE_RLIM_T 23 #if RLIM_T_IS_QUAD_T 24 typedef quad_t rlim_t; 25 #else 26 typedef long rlim_t; 27 #endif 28 #endif 29 30 #if HAVE_QUAD_T 31 #define RLIM_CONV quad_t 32 #define RLIM_FMT "%s \t%qd%s\n" 33 #else 34 #define RLIM_CONV long 35 #define RLIM_FMT "%s \t%ld%s\n" 36 #endif 37 38 #if defined(RLIMIT_OFILE) && !defined (RLIMIT_NOFILE) 39 #define RLIMIT_NOFILE RLIMIT_OFILE 40 #endif 41 42 struct Suffix { 43 const struct Suffix *next; 44 long amount; 45 char *name; 46 }; 47 48 struct Limit { 49 char *name; 50 int flag; 51 const struct Suffix *suffix; 52 }; 53 #endif /* HAVE_SETRLIMIT */