xref: /illumos-gate/usr/src/ucbhead/sys/resource.h (revision 5146325846cd457c912118089437f46b9e7475f6)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 1997 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
28 /*	  All Rights Reserved  	*/
29 
30 /*
31  * University Copyright- Copyright (c) 1982, 1986, 1988
32  * The Regents of the University of California
33  * All Rights Reserved
34  *
35  * University Acknowledgment- Portions of this document are derived from
36  * software developed by the University of California, Berkeley, and its
37  * contributors.
38  */
39 
40 #ifndef _SYS_RESOURCE_H
41 #define	_SYS_RESOURCE_H
42 
43 #ifndef _SYS_RUSAGE_H
44 #include <sys/rusage.h>
45 #endif
46 
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50 
51 /*
52  * Process priority specifications to get/setpriority.
53  */
54 #define	PRIO_MIN	-20
55 #define	PRIO_MAX	20
56 
57 #define	PRIO_PROCESS	0
58 #define	PRIO_PGRP	1
59 #define	PRIO_USER	2
60 
61 /*
62  * Resource limits
63  * RLIMIT_RSS removed so RLIMIT_NOFILE takes the value of 5
64  * to stay compatible with svr4
65  */
66 #define	RLIMIT_CPU	0		/* cpu time in milliseconds */
67 #define	RLIMIT_FSIZE	1		/* maximum file size */
68 #define	RLIMIT_DATA	2		/* data size */
69 #define	RLIMIT_STACK	3		/* stack size */
70 #define	RLIMIT_CORE	4		/* core file size */
71 #define	RLIMIT_NOFILE	5		/* maximum descriptor index + 1 */
72 
73 #define	RLIM_NLIMITS	7		/* number of resource limits */
74 
75 #define	RLIM_INFINITY	0x7fffffff
76 
77 struct rlimit {
78 	int	rlim_cur;		/* current (soft) limit */
79 	int	rlim_max;		/* maximum value for rlim_cur */
80 };
81 
82 #if defined(__STDC__)
83 extern int getpriority(int, int);
84 extern int setpriority(int, int, int);
85 extern int setrlimit(int, const struct rlimit *);
86 extern int getrlimit(int, struct rlimit *);
87 #else
88 extern int getpriority();
89 extern int setpriority();
90 extern int setrlimit();
91 extern int getrlimit();
92 #endif
93 
94 #ifdef __cplusplus
95 }
96 #endif
97 
98 #endif /* !_SYS_RESOURCE_H */
99