xref: /original-bsd/sys/sys/resource.h (revision bb2d502b)
1 /*
2  * Copyright (c) 1982, 1986 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms are permitted
6  * provided that the above copyright notice and this paragraph are
7  * duplicated in all such forms and that any documentation,
8  * advertising materials, and other materials related to such
9  * distribution and use acknowledge that the software was developed
10  * by the University of California, Berkeley.  The name of the
11  * University may not be used to endorse or promote products derived
12  * from this software without specific prior written permission.
13  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16  *
17  *	@(#)resource.h	7.2 (Berkeley) 02/20/89
18  */
19 
20 /*
21  * Process priority specifications to get/setpriority.
22  */
23 #define	PRIO_MIN	-20
24 #define	PRIO_MAX	20
25 
26 #define	PRIO_PROCESS	0
27 #define	PRIO_PGRP	1
28 #define	PRIO_USER	2
29 
30 /*
31  * Resource utilization information.
32  */
33 
34 #define	RUSAGE_SELF	0
35 #define	RUSAGE_CHILDREN	-1
36 
37 struct	rusage {
38 	struct timeval ru_utime;	/* user time used */
39 	struct timeval ru_stime;	/* system time used */
40 	long	ru_maxrss;		/* max resident set size */
41 #define	ru_first	ru_ixrss
42 	long	ru_ixrss;		/* integral shared memory size */
43 	long	ru_idrss;		/* integral unshared data " */
44 	long	ru_isrss;		/* integral unshared stack " */
45 	long	ru_minflt;		/* page reclaims */
46 	long	ru_majflt;		/* page faults */
47 	long	ru_nswap;		/* swaps */
48 	long	ru_inblock;		/* block input operations */
49 	long	ru_oublock;		/* block output operations */
50 	long	ru_msgsnd;		/* messages sent */
51 	long	ru_msgrcv;		/* messages received */
52 	long	ru_nsignals;		/* signals received */
53 	long	ru_nvcsw;		/* voluntary context switches */
54 	long	ru_nivcsw;		/* involuntary " */
55 #define	ru_last		ru_nivcsw
56 };
57 
58 /*
59  * Resource limits
60  */
61 #define	RLIMIT_CPU	0		/* cpu time in milliseconds */
62 #define	RLIMIT_FSIZE	1		/* maximum file size */
63 #define	RLIMIT_DATA	2		/* data size */
64 #define	RLIMIT_STACK	3		/* stack size */
65 #define	RLIMIT_CORE	4		/* core file size */
66 #define	RLIMIT_RSS	5		/* resident set size */
67 
68 #define	RLIM_NLIMITS	6		/* number of resource limits */
69 
70 #define	RLIM_INFINITY	0x7fffffff
71 
72 struct rlimit {
73 	long	rlim_cur;		/* current (soft) limit */
74 	long	rlim_max;		/* maximum value for rlim_cur */
75 };
76