vlimit.c

来自「操作系统SunOS 4.1.3版本的源码」· C语言 代码 · 共 39 行

C
39
字号
#if !defined(lint) && defined(SCCSIDS)static	char sccsid[] = "@(#)vlimit.c 1.1 92/07/30 SMI"; /* from UCB 4.2 83/06/20 */#endif/* * (Almost) backwards compatible vlimit. */#include <sys/time.h>#include <sys/resource.h>#include <errno.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 */#define	NLIMITS		6vlimit(limit, value)	int limit, value;{	struct rlimit rlim;	if (limit <= 0 || limit > NLIMITS)		return (EINVAL);	if (value == -1) {		if (getrlimit(limit - 1, &rlim) < 0)			return (-1);		return (rlim.rlim_cur);	}	rlim.rlim_cur = value;	rlim.rlim_max = RLIM_INFINITY;	return (setrlimit(limit - 1, &rlim));}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?