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 <dgk@research.att.com>                   *
18 *                                                                      *
19 ***********************************************************************/
20 #pragma prototyped
21 
22 #include	<ast.h>
23 #include	"ulimit.h"
24 
25 /*
26  * This is the list of resouce limits controlled by ulimit
27  * This command requires getrlimit(), vlimit(), or ulimit()
28  */
29 
30 #ifndef _no_ulimit
31 
32 const char	e_unlimited[] = "unlimited";
33 const char*	e_units[] = { 0, "block", "byte", "Kibyte", "second" };
34 
35 const int	shtab_units[] = { 1, 512, 1, 1024, 1 };
36 
37 const Limit_t	shtab_limits[] =
38 {
39 "as",		"address space limit",	RLIMIT_AS,	0,		'M',	LIM_KBYTE,
40 "core",		"core file size",	RLIMIT_CORE,	0,		'c',	LIM_BLOCK,
41 "cpu",		"cpu time",		RLIMIT_CPU,	0,		't',	LIM_SECOND,
42 "data",		"data size",		RLIMIT_DATA,	0,		'd',	LIM_KBYTE,
43 "fsize",	"file size",		RLIMIT_FSIZE,	0,		'f',	LIM_BLOCK,
44 "locks",	"number of file locks",	RLIMIT_LOCKS,	0,		'x',	LIM_COUNT,
45 "memlock",	"locked address space",	RLIMIT_MEMLOCK,	0,		'l',	LIM_KBYTE,
46 "msgqueue",	"message queue size",	RLIMIT_MSGQUEUE,0,		'q',	LIM_KBYTE,
47 "nice",		"scheduling priority",	RLIMIT_NICE,	0,		'e',	LIM_COUNT,
48 "nofile",	"number of open files",	RLIMIT_NOFILE,	"OPEN_MAX",	'n',	LIM_COUNT,
49 "nproc",	"number of processes",	RLIMIT_NPROC,	"CHILD_MAX",	'u',	LIM_COUNT,
50 "pipe",		"pipe buffer size",	RLIMIT_PIPE,	"PIPE_BUF",	'p',	LIM_BYTE,
51 "rss",		"max memory size",	RLIMIT_RSS,	0,		'm',	LIM_KBYTE,
52 "rtprio",	"max real time priority",RLIMIT_RTPRIO,	0,		'r',	LIM_COUNT,
53 "sbsize",	"socket buffer size",	RLIMIT_SBSIZE,	"PIPE_BUF",	'b',	LIM_BYTE,
54 "sigpend",	"signal queue size",	RLIMIT_SIGPENDING,"SIGQUEUE_MAX",'i',	LIM_COUNT,
55 "stack",	"stack size",		RLIMIT_STACK,	0,		's',	LIM_KBYTE,
56 "swap",		"swap size",		RLIMIT_SWAP,	0,		'w',	LIM_KBYTE,
57 "threads",	"number of threads",	RLIMIT_PTHREAD,	"THREADS_MAX",	'T',	LIM_COUNT,
58 "vmem",		"process size",		RLIMIT_VMEM,	0,		'v',	LIM_KBYTE,
59 { 0 }
60 };
61 
62 #endif
63