class.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
#ifndef _SYS_CLASS_H
#define _SYS_CLASS_H
#pragma ident "%Z%%M% %I% %E% SMI"
#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_id_t, void *);
void (*cl_stop)(kthread_id_t, int, int);
void (*cl_exit)(kthread_id_t);
void (*cl_active)(kthread_id_t);
void (*cl_inactive)(kthread_id_t);
void (*cl_trapret)(kthread_id_t);
void (*cl_preempt)(kthread_id_t);
void (*cl_setrun)(kthread_id_t);
void (*cl_sleep)(kthread_id_t);
void (*cl_tick)(kthread_id_t);
void (*cl_wakeup)(kthread_id_t);
void (*cl_yield)(kthread_id_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;
#ifdef _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 */