10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 51996Sml93401 * Common Development and Distribution License (the "License"). 61996Sml93401 * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 2212633Sjohn.levon@sun.com * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. 230Sstevel@tonic-gate */ 240Sstevel@tonic-gate 250Sstevel@tonic-gate #ifndef _SYS_RCTL_H 260Sstevel@tonic-gate #define _SYS_RCTL_H 270Sstevel@tonic-gate 280Sstevel@tonic-gate #include <sys/kmem.h> 290Sstevel@tonic-gate #include <sys/resource.h> 300Sstevel@tonic-gate #include <sys/types.h> 310Sstevel@tonic-gate 320Sstevel@tonic-gate #ifdef __cplusplus 330Sstevel@tonic-gate extern "C" { 340Sstevel@tonic-gate #endif 350Sstevel@tonic-gate 360Sstevel@tonic-gate /* 370Sstevel@tonic-gate * Available local actions and flags. 380Sstevel@tonic-gate */ 390Sstevel@tonic-gate #define RCTL_LOCAL_NOACTION 0x00000000 400Sstevel@tonic-gate #define RCTL_LOCAL_SIGNAL 0x00000001 410Sstevel@tonic-gate #define RCTL_LOCAL_DENY 0x00000002 420Sstevel@tonic-gate 430Sstevel@tonic-gate #define RCTL_LOCAL_MAXIMAL 0x80000000 443684Srd117015 #define RCTL_LOCAL_PROJDB 0x40000000 450Sstevel@tonic-gate 460Sstevel@tonic-gate #define RCTL_LOCAL_ACTION_MASK 0xffff0000 473684Srd117015 #define RCTL_LOCAL_MASK 0xc0000003 480Sstevel@tonic-gate 490Sstevel@tonic-gate /* 500Sstevel@tonic-gate * Available global actions and flags. 510Sstevel@tonic-gate */ 520Sstevel@tonic-gate #define RCTL_GLOBAL_NOACTION 0x00000000 530Sstevel@tonic-gate #define RCTL_GLOBAL_SYSLOG 0x00000001 540Sstevel@tonic-gate 550Sstevel@tonic-gate #define RCTL_GLOBAL_NOBASIC 0x80000000 560Sstevel@tonic-gate #define RCTL_GLOBAL_LOWERABLE 0x40000000 570Sstevel@tonic-gate #define RCTL_GLOBAL_DENY_ALWAYS 0x20000000 580Sstevel@tonic-gate #define RCTL_GLOBAL_DENY_NEVER 0x10000000 590Sstevel@tonic-gate #define RCTL_GLOBAL_FILE_SIZE 0x08000000 600Sstevel@tonic-gate #define RCTL_GLOBAL_CPU_TIME 0x04000000 610Sstevel@tonic-gate #define RCTL_GLOBAL_SIGNAL_NEVER 0x02000000 620Sstevel@tonic-gate #define RCTL_GLOBAL_NOLOCALACTION RCTL_GLOBAL_SIGNAL_NEVER 630Sstevel@tonic-gate #define RCTL_GLOBAL_INFINITE 0x01000000 640Sstevel@tonic-gate #define RCTL_GLOBAL_UNOBSERVABLE 0x00800000 651996Sml93401 #define RCTL_GLOBAL_SYSLOG_NEVER 0x00080000 660Sstevel@tonic-gate 670Sstevel@tonic-gate #define RCTL_GLOBAL_BYTES 0x00400000 680Sstevel@tonic-gate #define RCTL_GLOBAL_SECONDS 0x00200000 690Sstevel@tonic-gate #define RCTL_GLOBAL_COUNT 0x00100000 700Sstevel@tonic-gate 710Sstevel@tonic-gate #define RCTL_GLOBAL_ACTION_MASK 0xffff0000 721996Sml93401 #define RCTL_GLOBAL_MASK 0xfff80001 730Sstevel@tonic-gate 740Sstevel@tonic-gate /* 750Sstevel@tonic-gate * getrctl(2) flag values 760Sstevel@tonic-gate */ 770Sstevel@tonic-gate #define RCTL_FIRST 0x00000000 780Sstevel@tonic-gate #define RCTL_NEXT 0x00000001 790Sstevel@tonic-gate #define RCTL_USAGE 0x00000002 800Sstevel@tonic-gate 810Sstevel@tonic-gate /* 820Sstevel@tonic-gate * setrctl(2) flag values 830Sstevel@tonic-gate */ 840Sstevel@tonic-gate 850Sstevel@tonic-gate #define RCTL_INSERT 0x00000000 860Sstevel@tonic-gate #define RCTL_DELETE 0x00000001 870Sstevel@tonic-gate #define RCTL_REPLACE 0x00000002 880Sstevel@tonic-gate 890Sstevel@tonic-gate #define RCTL_USE_RECIPIENT_PID 0x10000000 900Sstevel@tonic-gate 910Sstevel@tonic-gate #define RCTLSYS_ACTION_MASK 0xffff0000 920Sstevel@tonic-gate #define RCTLSYS_MASK 0x10000003 930Sstevel@tonic-gate 940Sstevel@tonic-gate /* 950Sstevel@tonic-gate * rctl_priv_t: rctl privilege defined values 960Sstevel@tonic-gate * A large amount of space has been deliberately left between these privileges 970Sstevel@tonic-gate * to permit future enrichment of the control privilege value. 980Sstevel@tonic-gate */ 990Sstevel@tonic-gate #define RCPRIV_BASIC 0x01000000 1000Sstevel@tonic-gate #define RCPRIV_PRIVILEGED 0x04000000 1010Sstevel@tonic-gate #define RCPRIV_SYSTEM 0x07000000 1020Sstevel@tonic-gate 1030Sstevel@tonic-gate typedef u_longlong_t rctl_qty_t; /* resource control numerical values */ 1040Sstevel@tonic-gate typedef int rctl_priv_t; 1050Sstevel@tonic-gate 1060Sstevel@tonic-gate typedef struct rctlblk rctlblk_t; 1070Sstevel@tonic-gate 1080Sstevel@tonic-gate extern int setrctl(const char *, rctlblk_t *, rctlblk_t *, int); 1090Sstevel@tonic-gate extern int getrctl(const char *, rctlblk_t *, rctlblk_t *, int); 1100Sstevel@tonic-gate 1110Sstevel@tonic-gate typedef enum { 1120Sstevel@tonic-gate RCENTITY_PROCESS, 1130Sstevel@tonic-gate RCENTITY_TASK, 1140Sstevel@tonic-gate RCENTITY_PROJECT, 1150Sstevel@tonic-gate RCENTITY_ZONE 1160Sstevel@tonic-gate } rctl_entity_t; 1170Sstevel@tonic-gate #define RC_MAX_ENTITY RCENTITY_ZONE 1180Sstevel@tonic-gate 1190Sstevel@tonic-gate #ifndef _KERNEL 1200Sstevel@tonic-gate 1210Sstevel@tonic-gate typedef struct rctl_set rctl_set_t; 1220Sstevel@tonic-gate 1230Sstevel@tonic-gate #else /* _KERNEL */ 1240Sstevel@tonic-gate 1250Sstevel@tonic-gate #include <sys/mutex.h> 1260Sstevel@tonic-gate 1270Sstevel@tonic-gate /* 1280Sstevel@tonic-gate * rctl_test return bitfield 1290Sstevel@tonic-gate */ 1300Sstevel@tonic-gate #define RCT_NONE 0x00000000 1310Sstevel@tonic-gate #define RCT_DENY 0x00000001 1320Sstevel@tonic-gate #define RCT_SIGNAL 0x00000002 1330Sstevel@tonic-gate #define RCT_STRLOG 0x00000004 1340Sstevel@tonic-gate 1350Sstevel@tonic-gate #define RCT_LK_ABANDONED 0x80000000 1360Sstevel@tonic-gate 1370Sstevel@tonic-gate /* 1380Sstevel@tonic-gate * rctl_set_dup flags 1390Sstevel@tonic-gate */ 1400Sstevel@tonic-gate #define RCD_DUP 0x1 1410Sstevel@tonic-gate #define RCD_CALLBACK 0x2 1420Sstevel@tonic-gate 1430Sstevel@tonic-gate /* 1440Sstevel@tonic-gate * rctl_action/rctl_test action safety states 1450Sstevel@tonic-gate */ 1460Sstevel@tonic-gate #define RCA_SAFE 0x0 /* safe for signal and siginfo delivery */ 1470Sstevel@tonic-gate #define RCA_UNSAFE_SIGINFO 0x1 /* not safe to allocate for siginfo */ 1480Sstevel@tonic-gate #define RCA_UNSAFE_ALL 0x2 /* not safe to send signal */ 1490Sstevel@tonic-gate 1500Sstevel@tonic-gate typedef struct rctl_val { 1510Sstevel@tonic-gate struct rctl_val *rcv_prev; /* previous (lower) value */ 1520Sstevel@tonic-gate struct rctl_val *rcv_next; /* next (higher) value */ 1530Sstevel@tonic-gate rctl_priv_t rcv_privilege; /* appropriate RCPRIV_* cst */ 1540Sstevel@tonic-gate rctl_qty_t rcv_value; /* enforced value of control */ 1550Sstevel@tonic-gate uint_t rcv_flagaction; /* properties and actions */ 1560Sstevel@tonic-gate int rcv_action_signal; /* signal to send as action */ 1570Sstevel@tonic-gate struct proc *rcv_action_recipient; /* process to receive signal */ 1580Sstevel@tonic-gate id_t rcv_action_recip_pid; /* pid of that process */ 1590Sstevel@tonic-gate hrtime_t rcv_firing_time; /* time rctl_val last fired */ 1600Sstevel@tonic-gate } rctl_val_t; 1610Sstevel@tonic-gate 1620Sstevel@tonic-gate typedef int rctl_hndl_t; 1630Sstevel@tonic-gate 1640Sstevel@tonic-gate struct rctl; 1650Sstevel@tonic-gate struct proc; 1660Sstevel@tonic-gate struct task; 1670Sstevel@tonic-gate struct kproject; 1680Sstevel@tonic-gate struct zone; 1693247Sgjelinek struct kstat; 1700Sstevel@tonic-gate 1710Sstevel@tonic-gate typedef struct rctl_entity_p_struct { 1720Sstevel@tonic-gate rctl_entity_t rcep_t; 1730Sstevel@tonic-gate union { 1740Sstevel@tonic-gate struct proc *proc; 1750Sstevel@tonic-gate struct task *task; 1760Sstevel@tonic-gate struct kproject *proj; 1770Sstevel@tonic-gate struct zone *zone; 1780Sstevel@tonic-gate } rcep_p; 1790Sstevel@tonic-gate } rctl_entity_p_t; 1800Sstevel@tonic-gate 1810Sstevel@tonic-gate typedef struct rctl_ops { 1820Sstevel@tonic-gate void (*rco_action)(struct rctl *, struct proc *, 1830Sstevel@tonic-gate rctl_entity_p_t *); 1840Sstevel@tonic-gate rctl_qty_t (*rco_get_usage)(struct rctl *, struct proc *); 1850Sstevel@tonic-gate int (*rco_set)(struct rctl *, struct proc *, 1860Sstevel@tonic-gate rctl_entity_p_t *, rctl_qty_t); 1870Sstevel@tonic-gate int (*rco_test)(struct rctl *, struct proc *, 1880Sstevel@tonic-gate rctl_entity_p_t *, rctl_val_t *, rctl_qty_t, uint_t); 1890Sstevel@tonic-gate } rctl_ops_t; 1900Sstevel@tonic-gate 1910Sstevel@tonic-gate #define RCTLOP_ACTION(r, p, e) (r->rc_dict_entry->rcd_ops->rco_action(r, p, e)) 1920Sstevel@tonic-gate #define RCTLOP_GET_USAGE(r, p) (r->rc_dict_entry->rcd_ops->rco_get_usage(r, p)) 1930Sstevel@tonic-gate #define RCTLOP_SET(r, p, e, v) (r->rc_dict_entry->rcd_ops->rco_set(r, p, e, v)) 1940Sstevel@tonic-gate #define RCTLOP_TEST(r, p, e, v, i, f) \ 1950Sstevel@tonic-gate (r->rc_dict_entry->rcd_ops->rco_test(r, p, e, v, i, f)) 1960Sstevel@tonic-gate 1970Sstevel@tonic-gate /* 1980Sstevel@tonic-gate * Default resource control callback functions. 1990Sstevel@tonic-gate */ 2000Sstevel@tonic-gate void rcop_no_action(struct rctl *, struct proc *, rctl_entity_p_t *); 2010Sstevel@tonic-gate rctl_qty_t rcop_no_usage(struct rctl *, struct proc *); 2020Sstevel@tonic-gate int rcop_no_set(struct rctl *, struct proc *, rctl_entity_p_t *, rctl_qty_t); 2030Sstevel@tonic-gate int rcop_no_test(struct rctl *, struct proc *, rctl_entity_p_t *, 2040Sstevel@tonic-gate struct rctl_val *, rctl_qty_t, uint_t); 2050Sstevel@tonic-gate int rcop_absolute_test(struct rctl *, struct proc *, rctl_entity_p_t *, 2060Sstevel@tonic-gate struct rctl_val *, rctl_qty_t, uint_t); 2070Sstevel@tonic-gate 2089640SMenno.Lageman@Sun.COM #define RCTLOP_NO_USAGE(r) \ 2099640SMenno.Lageman@Sun.COM (r->rc_dict_entry->rcd_ops->rco_get_usage == rcop_no_usage) 2109640SMenno.Lageman@Sun.COM 2110Sstevel@tonic-gate extern rctl_ops_t rctl_default_ops; 2120Sstevel@tonic-gate extern rctl_ops_t rctl_absolute_ops; 2130Sstevel@tonic-gate 2140Sstevel@tonic-gate typedef struct rctl { 2150Sstevel@tonic-gate struct rctl *rc_next; /* next in set hash chain */ 2160Sstevel@tonic-gate rctl_val_t *rc_values; /* list of enforced value */ 2170Sstevel@tonic-gate rctl_val_t *rc_cursor; /* currently enforced value */ 2180Sstevel@tonic-gate struct rctl_dict_entry *rc_dict_entry; /* global control properties */ 2190Sstevel@tonic-gate rctl_hndl_t rc_id; /* control handle (hash key) */ 2203684Srd117015 rctl_val_t *rc_projdb; /* project database rctls */ 2210Sstevel@tonic-gate } rctl_t; 2220Sstevel@tonic-gate 2230Sstevel@tonic-gate /* 2240Sstevel@tonic-gate * The rctl_set is the collection of resource controls associated with an 2250Sstevel@tonic-gate * individual entity within the system. All of the controls are applicable to 2260Sstevel@tonic-gate * the same entity, which we call out explicitly in rcs_entity. 2270Sstevel@tonic-gate */ 2280Sstevel@tonic-gate typedef struct rctl_set { 2290Sstevel@tonic-gate kmutex_t rcs_lock; /* global set lock */ 2300Sstevel@tonic-gate rctl_entity_t rcs_entity; /* entity type */ 2310Sstevel@tonic-gate rctl_t **rcs_ctls; /* hash table of controls */ 2320Sstevel@tonic-gate } rctl_set_t; 2330Sstevel@tonic-gate 2340Sstevel@tonic-gate typedef struct rctl_dict_entry { 2350Sstevel@tonic-gate struct rctl_dict_entry *rcd_next; /* next in dict hash chain */ 2360Sstevel@tonic-gate char *rcd_name; /* resource control name */ 2370Sstevel@tonic-gate rctl_val_t *rcd_default_value; /* system control value */ 2380Sstevel@tonic-gate rctl_ops_t *rcd_ops; /* callback operations */ 2390Sstevel@tonic-gate rctl_hndl_t rcd_id; /* control handle */ 2400Sstevel@tonic-gate rctl_entity_t rcd_entity; /* entity type */ 2410Sstevel@tonic-gate int rcd_flagaction; /* global properties/actions */ 2420Sstevel@tonic-gate int rcd_syslog_level; /* event syslog level */ 2430Sstevel@tonic-gate int rcd_strlog_flags; /* derived from syslog level */ 2440Sstevel@tonic-gate rctl_qty_t rcd_max_native; /* native model "infinity" */ 2450Sstevel@tonic-gate rctl_qty_t rcd_max_ilp32; /* ILP32 model "infinity" */ 2460Sstevel@tonic-gate } rctl_dict_entry_t; 2470Sstevel@tonic-gate 2480Sstevel@tonic-gate typedef struct rctl_alloc_gp { 2490Sstevel@tonic-gate uint_t rcag_nctls; /* number of rctls needed/allocated */ 2500Sstevel@tonic-gate uint_t rcag_nvals; /* number of rctl values needed/allocated */ 2510Sstevel@tonic-gate rctl_t *rcag_ctls; /* list of allocated rctls */ 2520Sstevel@tonic-gate rctl_val_t *rcag_vals; /* list of allocated rctl values */ 2530Sstevel@tonic-gate } rctl_alloc_gp_t; 2540Sstevel@tonic-gate 2550Sstevel@tonic-gate extern kmem_cache_t *rctl_cache; /* kmem cache for rctl structures */ 2560Sstevel@tonic-gate extern kmem_cache_t *rctl_val_cache; /* kmem cache for rctl values */ 2570Sstevel@tonic-gate 2580Sstevel@tonic-gate extern rctl_hndl_t rctlproc_legacy[]; 2590Sstevel@tonic-gate extern uint_t rctlproc_flags[]; 2600Sstevel@tonic-gate extern int rctlproc_signals[]; 2610Sstevel@tonic-gate 2620Sstevel@tonic-gate void rctl_init(void); 2630Sstevel@tonic-gate void rctlproc_init(void); 2640Sstevel@tonic-gate void rctlproc_default_init(struct proc *, rctl_alloc_gp_t *); 2650Sstevel@tonic-gate 2660Sstevel@tonic-gate rctl_hndl_t rctl_register(const char *, rctl_entity_t, int, rctl_qty_t, 2670Sstevel@tonic-gate rctl_qty_t, rctl_ops_t *); 2680Sstevel@tonic-gate 2690Sstevel@tonic-gate rctl_hndl_t rctl_hndl_lookup(const char *); 2700Sstevel@tonic-gate rctl_dict_entry_t *rctl_dict_lookup(const char *); 2710Sstevel@tonic-gate rctl_dict_entry_t *rctl_dict_lookup_hndl(rctl_hndl_t); 2720Sstevel@tonic-gate void rctl_add_default_limit(const char *, rctl_qty_t, rctl_priv_t, uint_t); 2730Sstevel@tonic-gate void rctl_add_legacy_limit(const char *, const char *, const char *, 2740Sstevel@tonic-gate rctl_qty_t, rctl_qty_t); 2750Sstevel@tonic-gate 2760Sstevel@tonic-gate rctl_qty_t rctl_model_maximum(rctl_dict_entry_t *, struct proc *); 2770Sstevel@tonic-gate rctl_qty_t rctl_model_value(rctl_dict_entry_t *, struct proc *, rctl_qty_t); 2780Sstevel@tonic-gate 2790Sstevel@tonic-gate int rctl_invalid_value(rctl_dict_entry_t *, rctl_val_t *); 2800Sstevel@tonic-gate rctl_qty_t rctl_enforced_value(rctl_hndl_t, rctl_set_t *, struct proc *); 2810Sstevel@tonic-gate 2820Sstevel@tonic-gate int rctl_test(rctl_hndl_t, rctl_set_t *, struct proc *, rctl_qty_t, uint_t); 2830Sstevel@tonic-gate int rctl_action(rctl_hndl_t, rctl_set_t *, struct proc *, uint_t); 2840Sstevel@tonic-gate 2850Sstevel@tonic-gate int rctl_test_entity(rctl_hndl_t, rctl_set_t *, struct proc *, 2860Sstevel@tonic-gate rctl_entity_p_t *, rctl_qty_t, uint_t); 2870Sstevel@tonic-gate int rctl_action_entity(rctl_hndl_t, rctl_set_t *, struct proc *, 2880Sstevel@tonic-gate rctl_entity_p_t *, uint_t); 2890Sstevel@tonic-gate 2900Sstevel@tonic-gate int rctl_val_cmp(rctl_val_t *, rctl_val_t *, int); 2910Sstevel@tonic-gate int rctl_val_list_insert(rctl_val_t **, rctl_val_t *); 2920Sstevel@tonic-gate 2930Sstevel@tonic-gate rctl_set_t *rctl_set_create(void); 2949640SMenno.Lageman@Sun.COM rctl_set_t *rctl_entity_obtain_rset(rctl_dict_entry_t *, struct proc *); 2950Sstevel@tonic-gate rctl_alloc_gp_t *rctl_set_init_prealloc(rctl_entity_t); 2960Sstevel@tonic-gate rctl_set_t *rctl_set_init(rctl_entity_t, struct proc *, rctl_entity_p_t *, 2970Sstevel@tonic-gate rctl_set_t *, rctl_alloc_gp_t *); 2980Sstevel@tonic-gate rctl_alloc_gp_t *rctl_set_dup_prealloc(rctl_set_t *); 2990Sstevel@tonic-gate int rctl_set_dup_ready(rctl_set_t *, rctl_alloc_gp_t *); 3000Sstevel@tonic-gate rctl_set_t *rctl_set_dup(rctl_set_t *, struct proc *, struct proc *, 3010Sstevel@tonic-gate rctl_entity_p_t *, rctl_set_t *, rctl_alloc_gp_t *, int); 3020Sstevel@tonic-gate void rctl_set_reset(rctl_set_t *, struct proc *, rctl_entity_p_t *); 3030Sstevel@tonic-gate void rctl_set_tearoff(rctl_set_t *, struct proc *); 3049640SMenno.Lageman@Sun.COM int rctl_set_find(rctl_set_t *, rctl_hndl_t, rctl_t **); 3050Sstevel@tonic-gate void rctl_set_free(rctl_set_t *); 3060Sstevel@tonic-gate 3070Sstevel@tonic-gate void rctl_prealloc_destroy(rctl_alloc_gp_t *); 3080Sstevel@tonic-gate 3090Sstevel@tonic-gate size_t rctl_build_name_buf(char **); 3100Sstevel@tonic-gate 3110Sstevel@tonic-gate int rctl_global_get(const char *name, rctl_dict_entry_t *); 3120Sstevel@tonic-gate int rctl_global_set(const char *name, rctl_dict_entry_t *); 3130Sstevel@tonic-gate 3140Sstevel@tonic-gate int rctl_local_delete(rctl_hndl_t, rctl_val_t *, struct proc *p); 3150Sstevel@tonic-gate int rctl_local_insert(rctl_hndl_t, rctl_val_t *, struct proc *p); 3163684Srd117015 int rctl_local_insert_all(rctl_hndl_t, rctl_val_t *, rctl_val_t *, 3173684Srd117015 struct proc *p); 3183684Srd117015 int rctl_local_replace_all(rctl_hndl_t, rctl_val_t *, rctl_val_t *, 3193684Srd117015 struct proc *p); 3200Sstevel@tonic-gate int rctl_local_get(rctl_hndl_t, rctl_val_t *, rctl_val_t *, struct proc *p); 3210Sstevel@tonic-gate int rctl_local_replace(rctl_hndl_t, rctl_val_t *, rctl_val_t *, 3220Sstevel@tonic-gate struct proc *p); 3230Sstevel@tonic-gate 3240Sstevel@tonic-gate /* tag declaration to appease the compiler */ 3250Sstevel@tonic-gate struct cred; 3260Sstevel@tonic-gate rctl_alloc_gp_t *rctl_rlimit_set_prealloc(uint_t); 3270Sstevel@tonic-gate int rctl_rlimit_set(rctl_hndl_t, struct proc *, struct rlimit64 *, 3280Sstevel@tonic-gate rctl_alloc_gp_t *, int, int, const struct cred *); 3290Sstevel@tonic-gate int rctl_rlimit_get(rctl_hndl_t, struct proc *, struct rlimit64 *); 3300Sstevel@tonic-gate 3312768Ssl108498 /* specific rctl utility functions */ 3322768Ssl108498 int rctl_incr_locked_mem(struct proc *, struct kproject *, rctl_qty_t, 3332768Ssl108498 int); 3342768Ssl108498 void rctl_decr_locked_mem(struct proc *, struct kproject *, rctl_qty_t, 3352768Ssl108498 int); 3363247Sgjelinek int rctl_incr_swap(struct proc *, struct zone *, size_t); 3373247Sgjelinek void rctl_decr_swap(struct zone *, size_t); 3383247Sgjelinek 33912633Sjohn.levon@sun.com int rctl_incr_lofi(struct proc *, struct zone *, size_t); 34012633Sjohn.levon@sun.com void rctl_decr_lofi(struct zone *, size_t); 34112633Sjohn.levon@sun.com 3423247Sgjelinek struct kstat *rctl_kstat_create_zone(struct zone *, char *, uchar_t, uint_t, 3433247Sgjelinek uchar_t); 3443247Sgjelinek 3453247Sgjelinek struct kstat *rctl_kstat_create_project(struct kproject *, char *, uchar_t, 3463247Sgjelinek uint_t, uchar_t); 3472768Ssl108498 348*12725SMenno.Lageman@Sun.COM struct kstat *rctl_kstat_create_task(struct task *, char *, uchar_t, 349*12725SMenno.Lageman@Sun.COM uint_t, uchar_t); 350*12725SMenno.Lageman@Sun.COM 3510Sstevel@tonic-gate #endif /* _KERNEL */ 3520Sstevel@tonic-gate 3530Sstevel@tonic-gate #ifdef __cplusplus 3540Sstevel@tonic-gate } 3550Sstevel@tonic-gate #endif 3560Sstevel@tonic-gate 3570Sstevel@tonic-gate #endif /* _SYS_RCTL_H */ 358