rctl.h revision ff19e029e81c950f4e0f40f1f1ee1f7d8f8d8041
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#ifndef _SYS_RCTL_H
#define _SYS_RCTL_H
#include <sys/resource.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Available local actions and flags.
*/
#define RCTL_LOCAL_NOACTION 0x00000000
#define RCTL_LOCAL_SIGNAL 0x00000001
#define RCTL_LOCAL_DENY 0x00000002
#define RCTL_LOCAL_MAXIMAL 0x80000000
#define RCTL_LOCAL_PROJDB 0x40000000
#define RCTL_LOCAL_ACTION_MASK 0xffff0000
#define RCTL_LOCAL_MASK 0xc0000003
/*
* Available global actions and flags.
*/
#define RCTL_GLOBAL_NOACTION 0x00000000
#define RCTL_GLOBAL_SYSLOG 0x00000001
#define RCTL_GLOBAL_NOBASIC 0x80000000
#define RCTL_GLOBAL_LOWERABLE 0x40000000
#define RCTL_GLOBAL_DENY_ALWAYS 0x20000000
#define RCTL_GLOBAL_DENY_NEVER 0x10000000
#define RCTL_GLOBAL_FILE_SIZE 0x08000000
#define RCTL_GLOBAL_CPU_TIME 0x04000000
#define RCTL_GLOBAL_SIGNAL_NEVER 0x02000000
#define RCTL_GLOBAL_INFINITE 0x01000000
#define RCTL_GLOBAL_UNOBSERVABLE 0x00800000
#define RCTL_GLOBAL_SYSLOG_NEVER 0x00080000
#define RCTL_GLOBAL_BYTES 0x00400000
#define RCTL_GLOBAL_SECONDS 0x00200000
#define RCTL_GLOBAL_COUNT 0x00100000
#define RCTL_GLOBAL_ACTION_MASK 0xffff0000
#define RCTL_GLOBAL_MASK 0xfff80001
/*
* getrctl(2) flag values
*/
#define RCTL_FIRST 0x00000000
#define RCTL_NEXT 0x00000001
#define RCTL_USAGE 0x00000002
/*
* setrctl(2) flag values
*/
#define RCTL_INSERT 0x00000000
#define RCTL_DELETE 0x00000001
#define RCTL_REPLACE 0x00000002
#define RCTL_USE_RECIPIENT_PID 0x10000000
#define RCTLSYS_ACTION_MASK 0xffff0000
#define RCTLSYS_MASK 0x10000003
/*
* rctl_priv_t: rctl privilege defined values
* A large amount of space has been deliberately left between these privileges
* to permit future enrichment of the control privilege value.
*/
#define RCPRIV_BASIC 0x01000000
#define RCPRIV_PRIVILEGED 0x04000000
#define RCPRIV_SYSTEM 0x07000000
typedef int rctl_priv_t;
typedef enum {
#define RC_MAX_ENTITY RCENTITY_ZONE
#ifndef _KERNEL
typedef struct rctl_set rctl_set_t;
#else /* _KERNEL */
/*
* rctl_test return bitfield
*/
#define RCT_NONE 0x00000000
#define RCT_DENY 0x00000001
#define RCT_SIGNAL 0x00000002
#define RCT_STRLOG 0x00000004
#define RCT_LK_ABANDONED 0x80000000
/*
* rctl_set_dup flags
*/
#define RCD_DUP 0x1
#define RCD_CALLBACK 0x2
/*
* rctl_action/rctl_test action safety states
*/
typedef struct rctl_val {
int rcv_action_signal; /* signal to send as action */
} rctl_val_t;
typedef int rctl_hndl_t;
struct rctl;
struct proc;
struct task;
struct kproject;
struct zone;
struct kstat;
typedef struct rctl_entity_p_struct {
union {
} rcep_p;
typedef struct rctl_ops {
rctl_entity_p_t *);
} rctl_ops_t;
#define RCTLOP_TEST(r, p, e, v, i, f) \
/*
* Default resource control callback functions.
*/
#define RCTLOP_NO_USAGE(r) \
extern rctl_ops_t rctl_default_ops;
extern rctl_ops_t rctl_absolute_ops;
typedef struct rctl {
} rctl_t;
/*
* The rctl_set is the collection of resource controls associated with an
* individual entity within the system. All of the controls are applicable to
* the same entity, which we call out explicitly in rcs_entity.
*/
typedef struct rctl_set {
} rctl_set_t;
typedef struct rctl_dict_entry {
char *rcd_name; /* resource control name */
int rcd_flagaction; /* global properties/actions */
int rcd_syslog_level; /* event syslog level */
int rcd_strlog_flags; /* derived from syslog level */
typedef struct rctl_alloc_gp {
extern rctl_hndl_t rctlproc_legacy[];
extern uint_t rctlproc_flags[];
extern int rctlproc_signals[];
void rctl_init(void);
void rctlproc_init(void);
rctl_qty_t, rctl_ops_t *);
rctl_hndl_t rctl_hndl_lookup(const char *);
rctl_dict_entry_t *rctl_dict_lookup(const char *);
void rctl_add_legacy_limit(const char *, const char *, const char *,
rctl_entity_p_t *, uint_t);
rctl_set_t *rctl_set_create(void);
rctl_set_t *, rctl_alloc_gp_t *);
void rctl_set_free(rctl_set_t *);
void rctl_prealloc_destroy(rctl_alloc_gp_t *);
size_t rctl_build_name_buf(char **);
struct proc *p);
struct proc *p);
struct proc *p);
/* tag declaration to appease the compiler */
struct cred;
rctl_alloc_gp_t *, int, int, const struct cred *);
/* specific rctl utility functions */
int);
int);
uchar_t);
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_RCTL_H */