1@RLIMITS_DEFNS
2__RCSID("$MirOS: src/bin/mksh/rlimits.opt,v 1.1 2013/11/17 22:21:18 tg Exp $");
3struct limits {
4	/* limit resource */
5	int resource;
6	/* multiply by to get rlim_{cur,max} values */
7	unsigned int factor;
8	/* getopts char */
9	char optchar;
10	/* limit name */
11	char name[1];
12};
13#define FN(lname,lid,lfac,lopt)				\
14	static const struct {				\
15		int resource;				\
16		unsigned int factor;			\
17		char optchar;				\
18		char name[sizeof(lname)];		\
19	} rlimits_ ## lid = {				\
20		lid, lfac, lopt, lname			\
21	};
22@RLIMITS_ITEMS
23#define FN(lname,lid,lfac,lopt)				\
24	(const struct limits *)(&rlimits_ ## lid),
25@@
26
27/* generic options for the ulimit builtin */
28
29<a|
30<H|
31<S|
32
33/* do not use options -H, -S or -a or change the order */
34
35>t|RLIMIT_CPU
36FN("time(cpu-seconds)", RLIMIT_CPU, 1
37
38>f|RLIMIT_FSIZE
39FN("file(blocks)", RLIMIT_FSIZE, 512
40
41>c|RLIMIT_CORE
42FN("coredump(blocks)", RLIMIT_CORE, 512
43
44>d|RLIMIT_DATA
45FN("data(KiB)", RLIMIT_DATA, 1024
46
47>s|RLIMIT_STACK
48FN("stack(KiB)", RLIMIT_STACK, 1024
49
50>l|RLIMIT_MEMLOCK
51FN("lockedmem(KiB)", RLIMIT_MEMLOCK, 1024
52
53>n|RLIMIT_NOFILE
54FN("nofiles(descriptors)", RLIMIT_NOFILE, 1
55
56>p|RLIMIT_NPROC
57FN("processes", RLIMIT_NPROC, 1
58
59>w|RLIMIT_SWAP
60FN("swap(KiB)", RLIMIT_SWAP, 1024
61
62>T|RLIMIT_TIME
63FN("humantime(seconds)", RLIMIT_TIME, 1
64
65>V|RLIMIT_NOVMON
66FN("vnodemonitors", RLIMIT_NOVMON, 1
67
68>i|RLIMIT_SIGPENDING
69FN("sigpending", RLIMIT_SIGPENDING, 1
70
71>q|RLIMIT_MSGQUEUE
72FN("msgqueue(bytes)", RLIMIT_MSGQUEUE, 1
73
74>M|RLIMIT_AIO_MEM
75FN("AIOlockedmem(KiB)", RLIMIT_AIO_MEM, 1024
76
77>O|RLIMIT_AIO_OPS
78FN("AIOoperations", RLIMIT_AIO_OPS, 1
79
80>C|RLIMIT_TCACHE
81FN("cachedthreads", RLIMIT_TCACHE, 1
82
83>B|RLIMIT_SBSIZE
84FN("sockbufsiz(KiB)", RLIMIT_SBSIZE, 1024
85
86>P|RLIMIT_PTHREAD
87FN("threadsperprocess", RLIMIT_PTHREAD, 1
88
89>e|RLIMIT_NICE
90FN("maxnice", RLIMIT_NICE, 1
91
92>r|RLIMIT_RTPRIO
93FN("maxrtprio", RLIMIT_RTPRIO, 1
94
95>m|ULIMIT_M_IS_RSS
96FN("resident-set(KiB)", RLIMIT_RSS, 1024
97>m|ULIMIT_M_IS_VMEM
98FN("memory(KiB)", RLIMIT_VMEM, 1024
99
100>v|ULIMIT_V_IS_VMEM
101FN("virtual-memory(KiB)", RLIMIT_VMEM, 1024
102>v|ULIMIT_V_IS_AS
103FN("address-space(KiB)", RLIMIT_AS, 1024
104
105|RLIMITS_OPTCS
106