class.h revision b819cea2f73f98c5662230cc9affc8cc84f77fcf
/*
* 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
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
*/
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
#ifndef _SYS_CLASS_H
#define _SYS_CLASS_H
#include <sys/priocntl.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* NOTE: Developers making use of the scheduler class switch mechanism
* to develop scheduling class modules should be aware that the
* architecture is not frozen and the kernel interface for scheduling
* class modules may change in future releases of System V. Support
* for the current interface is not guaranteed and class modules
* developed to this interface may require changes in order to work
* with future releases of the system.
*/
/*
* three different ops vectors are bundled together, here.
* one is for each of the fundamental objects acted upon
* by these operators: procs, threads, and the class manager itself.
*/
typedef struct class_ops {
int (*cl_getclinfo)(void *);
int (*cl_parmsin)(void *);
int (*cl_parmsout)(void *, pc_vaparms_t *);
int (*cl_vaparmsin)(void *, pc_vaparms_t *);
int (*cl_vaparmsout)(void *, pc_vaparms_t *);
int (*cl_getclpri)(pcpri_t *);
int (*cl_alloc)(void **, int);
void (*cl_free)(void *);
} class_ops_t;
typedef struct thread_ops {
void (*cl_exitclass)(void *);
void (*cl_parmsget)(kthread_t *, void *);
void (*cl_inactive)(kthread_t *);
void (*cl_trapret)(kthread_t *);
void (*cl_preempt)(kthread_t *);
} thread_ops_t;
typedef struct classfuncs {
} classfuncs_t;
typedef struct sclass {
char *cl_name; /* class name */
/* class specific initialization function */
int cl_count; /* # of threads trying to load class */
} sclass_t;
#if defined(_KERNEL) || defined(_FAKE_KERNEL)
extern int nclass; /* number of configured scheduling classes */
extern char *defaultclass; /* default class for newproc'd processes */
extern int loaded_classes; /* number of classes loaded */
extern pri_t minclsyspri;
extern int scheduler_load(char *, sclass_t *);
extern int getcidbyname(char *, id_t *);
#endif
#define CL_PARMSGET(t, clparmsp) \
#define CL_SET_PROCESS_GROUP(t, s, b, f) \
(*(t)->t_clfuncs->cl_set_process_group)(s, b, f)
#ifdef __cplusplus
}
#endif
#endif /* _SYS_CLASS_H */