1 /*********************************************************************** 2 * * 3 * This software is part of the ast package * 4 * Copyright (c) 1982-2012 AT&T Intellectual Property * 5 * and is licensed under the * 6 * Eclipse Public License, Version 1.0 * 7 * by AT&T Intellectual Property * 8 * * 9 * A copy of the License is available at * 10 * http://www.eclipse.org/org/documents/epl-v10.html * 11 * (with md5 checksum b35adb5213ca9657e911e9befb180842) * 12 * * 13 * Information and Software Systems Research * 14 * AT&T Research * 15 * Florham Park NJ * 16 * * 17 * David Korn <dgkorn@gmail.com> * 18 * * 19 ***********************************************************************/ 20 // 21 // This is for the ulimit built-in command. 22 // 23 #ifndef _ULIMIT_H 24 #define _ULIMIT_H 1 25 26 #include <sys/resource.h> 27 28 #ifdef RLIM_INFINITY 29 #define INFINITY RLIM_INFINITY 30 #else 31 #ifndef INFINITY 32 #define INFINITY ((rlim_t)-1L) 33 #endif // INFINITY 34 #endif // RLIM_INFINITY 35 36 #ifndef RLIMIT_VMEM 37 #ifdef RLIMIT_AS 38 #define RLIMIT_VMEM RLIMIT_AS 39 #endif 40 #endif // !RLIMIT_VMEM 41 42 #if !defined(RLIMIT_NOFILE) && defined(RLIMIT_OFILE) 43 #define RLIMIT_NOFILE RLIMIT_OFILE 44 #endif 45 46 #ifndef RLIMIT_UNKNOWN 47 #define RLIMIT_UNKNOWN (-9999) 48 #endif 49 #ifndef RLIMIT_AS 50 #define RLIMIT_AS RLIMIT_UNKNOWN 51 #endif 52 #ifndef RLIMIT_CORE 53 #define RLIMIT_CORE RLIMIT_UNKNOWN 54 #endif 55 #ifndef RLIMIT_CPU 56 #define RLIMIT_CPU RLIMIT_UNKNOWN 57 #endif 58 #ifndef RLIMIT_DATA 59 #define RLIMIT_DATA RLIMIT_UNKNOWN 60 #endif 61 #ifndef RLIMIT_FSIZE 62 #define RLIMIT_FSIZE RLIMIT_UNKNOWN 63 #endif 64 #ifndef RLIMIT_LOCKS 65 #define RLIMIT_LOCKS RLIMIT_UNKNOWN 66 #endif 67 #ifndef RLIMIT_MEMLOCK 68 #define RLIMIT_MEMLOCK RLIMIT_UNKNOWN 69 #endif 70 #ifndef RLIMIT_MSGQUEUE 71 #define RLIMIT_MSGQUEUE RLIMIT_UNKNOWN 72 #endif 73 #ifndef RLIMIT_NOFILE 74 #define RLIMIT_NOFILE RLIMIT_UNKNOWN 75 #endif 76 #ifndef RLIMIT_NICE 77 #define RLIMIT_NICE RLIMIT_UNKNOWN 78 #endif 79 #ifndef RLIMIT_NPROC 80 #define RLIMIT_NPROC RLIMIT_UNKNOWN 81 #endif 82 #ifndef RLIMIT_PIPE 83 #define RLIMIT_PIPE RLIMIT_UNKNOWN 84 #endif 85 #ifndef RLIMIT_PTHREAD 86 #define RLIMIT_PTHREAD RLIMIT_UNKNOWN 87 #endif 88 #ifndef RLIMIT_RSS 89 #define RLIMIT_RSS RLIMIT_UNKNOWN 90 #endif 91 #ifndef RLIMIT_RTPRIO 92 #define RLIMIT_RTPRIO RLIMIT_UNKNOWN 93 #endif 94 #ifndef RLIMIT_SBSIZE 95 #define RLIMIT_SBSIZE RLIMIT_UNKNOWN 96 #endif 97 #ifndef RLIMIT_SIGPENDING 98 #define RLIMIT_SIGPENDING RLIMIT_UNKNOWN 99 #endif 100 #ifndef RLIMIT_STACK 101 #define RLIMIT_STACK RLIMIT_UNKNOWN 102 #endif 103 #ifndef RLIMIT_SWAP 104 #define RLIMIT_SWAP RLIMIT_UNKNOWN 105 #endif 106 #ifndef RLIMIT_VMEM 107 #define RLIMIT_VMEM RLIMIT_UNKNOWN 108 #endif 109 110 #define LIM_COUNT 0 111 #define LIM_BLOCK 1 112 #define LIM_BYTE 2 113 #define LIM_KBYTE 3 114 #define LIM_SECOND 4 115 116 typedef struct Limit_s { 117 const char *name; 118 const char *description; 119 int index; 120 unsigned char option; 121 unsigned char type; 122 } Limit_t; 123 124 extern const Limit_t shtab_limits[]; 125 extern const int shtab_units[]; 126 127 extern const char e_unlimited[]; 128 extern const char *e_units[]; 129 130 #endif // _ULIMIT_H 131