pkg: ship usr/lib/security/amd64/*.so links
[unleashed.git] / include / sys / resource.h
blob3fe1978cde569abb9a6246807923c494a04b3105
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
22 * Copyright 2014 Garrrett D'Amore <garrett@damore.org>
24 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
25 * Use is subject to license terms.
28 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
29 /* All Rights Reserved */
32 * University Copyright- Copyright (c) 1982, 1986, 1988
33 * The Regents of the University of California
34 * All Rights Reserved
36 * University Acknowledgment- Portions of this document are derived from
37 * software developed by the University of California, Berkeley, and its
38 * contributors.
41 #ifndef _SYS_RESOURCE_H
42 #define _SYS_RESOURCE_H
44 #include <stdint.h>
45 #include <sys/feature_tests.h>
46 #include <sys/time.h>
47 #include <sys/types.h>
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
54 * Process priority specifications
56 #define PRIO_PROCESS 0
57 #define PRIO_PGRP 1
58 #define PRIO_USER 2
59 #define PRIO_GROUP 3
60 #define PRIO_SESSION 4
61 #define PRIO_LWP 5
62 #define PRIO_TASK 6
63 #define PRIO_PROJECT 7
64 #define PRIO_ZONE 8
65 #define PRIO_CONTRACT 9
68 * Resource limits
70 #define RLIMIT_CPU 0 /* cpu time in seconds */
71 #define RLIMIT_FSIZE 1 /* maximum file size */
72 #define RLIMIT_DATA 2 /* data size */
73 #define RLIMIT_STACK 3 /* stack size */
74 #define RLIMIT_CORE 4 /* core file size */
75 #define RLIMIT_NOFILE 5 /* file descriptors */
76 #define RLIMIT_VMEM 6 /* maximum mapped memory */
77 #define RLIMIT_AS RLIMIT_VMEM
79 #define RLIM_NLIMITS 7 /* number of resource limits */
81 typedef uint64_t rlim_t;
83 #define RLIM_INFINITY ((rlim_t)-3)
84 #define RLIM_SAVED_MAX ((rlim_t)-2)
85 #define RLIM_SAVED_CUR ((rlim_t)-1)
87 struct rlimit {
88 rlim_t rlim_cur; /* current limit */
89 rlim_t rlim_max; /* maximum value for rlim_cur */
92 #define RLIM_SAVED(x) (1) /* save all resource limits */
93 #define RLIM_NSAVED RLIM_NLIMITS /* size of u_saved_rlimits[] */
95 struct rusage {
96 struct timeval ru_utime; /* user time used */
97 struct timeval ru_stime; /* system time used */
98 long ru_maxrss; /* <unimp> */
99 long ru_ixrss; /* <unimp> */
100 long ru_idrss; /* <unimp> */
101 long ru_isrss; /* <unimp> */
102 long ru_minflt; /* any page faults not requiring I/O */
103 long ru_majflt; /* any page faults requiring I/O */
104 long ru_nswap; /* swaps */
105 long ru_inblock; /* block input operations */
106 long ru_oublock; /* block output operations */
107 long ru_msgsnd; /* streams messsages sent */
108 long ru_msgrcv; /* streams messages received */
109 long ru_nsignals; /* signals received */
110 long ru_nvcsw; /* voluntary context switches */
111 long ru_nivcsw; /* involuntary " */
114 #define _RUSAGESYS_GETRUSAGE 0 /* rusage process */
115 #define _RUSAGESYS_GETRUSAGE_CHLD 1 /* rusage child process */
116 #define _RUSAGESYS_GETRUSAGE_LWP 2 /* rusage lwp */
117 #define _RUSAGESYS_GETVMUSAGE 3 /* getvmusage */
119 #if defined(_SYSCALL32)
121 struct rusage32 {
122 struct timeval32 ru_utime; /* user time used */
123 struct timeval32 ru_stime; /* system time used */
124 int ru_maxrss; /* <unimp> */
125 int ru_ixrss; /* <unimp> */
126 int ru_idrss; /* <unimp> */
127 int ru_isrss; /* <unimp> */
128 int ru_minflt; /* any page faults not requiring I/O */
129 int ru_majflt; /* any page faults requiring I/O */
130 int ru_nswap; /* swaps */
131 int ru_inblock; /* block input operations */
132 int ru_oublock; /* block output operations */
133 int ru_msgsnd; /* streams messages sent */
134 int ru_msgrcv; /* streams messages received */
135 int ru_nsignals; /* signals received */
136 int ru_nvcsw; /* voluntary context switches */
137 int ru_nivcsw; /* involuntary " */
140 #endif /* _SYSCALL32 */
143 #ifdef _KERNEL
145 #include <sys/model.h>
147 struct proc;
149 #else
151 #define RUSAGE_SELF 0
152 #define RUSAGE_LWP 1
153 #define RUSAGE_CHILDREN -1
155 extern int setrlimit(int, const struct rlimit *);
156 extern int getrlimit(int, struct rlimit *);
158 extern int getpriority(int, id_t);
159 extern int setpriority(int, id_t, int);
160 extern int getrusage(int, struct rusage *);
162 #endif /* _KERNEL */
164 #ifdef __cplusplus
166 #endif
168 #endif /* _SYS_RESOURCE_H */