blob: a1c36613fd38c4aad86a49fbc7ba1a57b353cbfa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1982-2010 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* http://www.opensource.org/licenses/cpl1.0.txt *
* (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* David Korn <dgk@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
#ifndef _ULIMIT_H
#define _ULIMIT_H 1
/*
* This is for the ulimit built-in command
*/
#include "FEATURE/time"
#include "FEATURE/rlimits"
#if defined(_sys_resource) && defined(_lib_getrlimit)
# include <sys/resource.h>
# if !defined(RLIMIT_FSIZE) && defined(_sys_vlimit)
/* This handles hp/ux problem */
# include <sys/vlimit.h>
# define RLIMIT_FSIZE (LIM_FSIZE-1)
# define RLIMIT_DATA (LIM_DATA-1)
# define RLIMIT_STACK (LIM_STACK-1)
# define RLIMIT_CORE (LIM_CORE-1)
# define RLIMIT_CPU (LIM_CPU-1)
# ifdef LIM_MAXRSS
# define RLIMIT_RSS (LIM_MAXRSS-1)
# endif /* LIM_MAXRSS */
# endif
# undef _lib_ulimit
#else
# ifdef _sys_vlimit
# include <sys/vlimit.h>
# undef _lib_ulimit
# define RLIMIT_FSIZE LIM_FSIZE
# define RLIMIT_DATA LIM_DATA
# define RLIMIT_STACK LIM_STACK
# define RLIMIT_CORE LIM_CORE
# define RLIMIT_CPU LIM_CPU
# ifdef LIM_MAXRSS
# define RLIMIT_RSS LIM_MAXRSS
# endif /* LIM_MAXRSS */
# else
# ifdef _lib_ulimit
# define vlimit ulimit
# endif /* _lib_ulimit */
# endif /* _lib_vlimit */
#endif
#ifdef RLIM_INFINITY
# define INFINITY RLIM_INFINITY
#else
# ifndef INFINITY
# define INFINITY ((rlim_t)-1L)
# endif /* INFINITY */
#endif /* RLIM_INFINITY */
#if defined(_lib_getrlimit) || defined(_lib_vlimit) || defined(_lib_ulimit)
# ifndef RLIMIT_CPU
# define RLIMIT_CPU 0
# endif /* !RLIMIT_CPU */
# ifndef RLIMIT_DATA
# define RLIMIT_DATA 0
# endif /* !RLIMIT_DATA */
# ifndef RLIMIT_RSS
# define RLIMIT_RSS 0
# endif /* !RLIMIT_RSS */
# ifndef RLIMIT_STACK
# define RLIMIT_STACK 0
# endif /* !RLIMIT_STACK */
# ifndef RLIMIT_CORE
# define RLIMIT_CORE 0
# endif /* !RLIMIT_CORE */
# ifndef RLIMIT_VMEM
# define RLIMIT_VMEM 0
# endif /* !RLIMIT_VMEM */
# ifndef RLIMIT_NOFILE
# define RLIMIT_NOFILE 0
# endif /* !RLIMIT_NOFILE */
#else
# define _no_ulimit
#endif
#ifndef _typ_rlim_t
typedef long rlim_t;
#endif
#if !defined(RLIMIT_NOFILE) && defined(RLIMIT_OFILE)
#define RLIMIT_NOFILE RLIMIT_OFILE
#endif
#ifndef RLIMIT_UNKNOWN
#define RLIMIT_UNKNOWN (-9999)
#endif
#ifndef RLIMIT_AS
#define RLIMIT_AS RLIMIT_UNKNOWN
#endif
#ifndef RLIMIT_CORE
#define RLIMIT_CORE RLIMIT_UNKNOWN
#endif
#ifndef RLIMIT_CPU
#define RLIMIT_CPU RLIMIT_UNKNOWN
#endif
#ifndef RLIMIT_DATA
#define RLIMIT_DATA RLIMIT_UNKNOWN
#endif
#ifndef RLIMIT_FSIZE
#define RLIMIT_FSIZE RLIMIT_UNKNOWN
#endif
#ifndef RLIMIT_LOCKS
#define RLIMIT_LOCKS RLIMIT_UNKNOWN
#endif
#ifndef RLIMIT_MEMLOCK
#define RLIMIT_MEMLOCK RLIMIT_UNKNOWN
#endif
#ifndef RLIMIT_NOFILE
#define RLIMIT_NOFILE RLIMIT_UNKNOWN
#endif
#ifndef RLIMIT_NPROC
#define RLIMIT_NPROC RLIMIT_UNKNOWN
#endif
#ifndef RLIMIT_PIPE
#define RLIMIT_PIPE RLIMIT_UNKNOWN
#endif
#ifndef RLIMIT_RSS
#define RLIMIT_RSS RLIMIT_UNKNOWN
#endif
#ifndef RLIMIT_SBSIZE
#define RLIMIT_SBSIZE RLIMIT_UNKNOWN
#endif
#ifndef RLIMIT_STACK
#define RLIMIT_STACK RLIMIT_UNKNOWN
#endif
#ifndef RLIMIT_PTHREAD
#define RLIMIT_PTHREAD RLIMIT_UNKNOWN
#endif
#ifndef RLIMIT_VMEM
#define RLIMIT_VMEM RLIMIT_UNKNOWN
#endif
#define LIM_COUNT 0
#define LIM_BLOCK 1
#define LIM_BYTE 2
#define LIM_KBYTE 3
#define LIM_SECOND 4
typedef struct Limit_s
{
const char name[8];
const char* description;
int index;
const char* conf;
unsigned char option;
unsigned char type;
} Limit_t;
extern const Limit_t shtab_limits[];
extern const int shtab_units[];
extern const char e_unlimited[];
extern const char* e_units[];
#endif /* _ULIMIT_H */
|