* Copyright (c) 1980 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid
[] = "@(#)vlimit.c 5.2 (Berkeley) %G%";
#endif LIBC_SCCS and not lint
* (Almost) backwards compatible vlimit.
#include <sys/resource.h>
/* LIM_NORAISE is not emulated */
#define LIM_NORAISE 0 /* if <> 0, can't raise limits */
#define LIM_CPU 1 /* max secs cpu time */
#define LIM_FSIZE 2 /* max size of file created */
#define LIM_DATA 3 /* max growth of data space */
#define LIM_STACK 4 /* max growth of stack */
#define LIM_CORE 5 /* max size of ``core'' file */
#define LIM_MAXRSS 6 /* max desired data+stack core usage */
if (limit
<= 0 || limit
> NLIMITS
)
if (getrlimit(limit
- 1, &rlim
) < 0)
rlim
.rlim_max
= RLIM_INFINITY
;
return (setrlimit(limit
- 1, &rlim
));