xref: /onnv-gate/usr/src/uts/common/sys/ts.h (revision 951:bf339f1babfa)
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
50Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
60Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
70Sstevel@tonic-gate  * with the License.
80Sstevel@tonic-gate  *
90Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
100Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
110Sstevel@tonic-gate  * See the License for the specific language governing permissions
120Sstevel@tonic-gate  * and limitations under the License.
130Sstevel@tonic-gate  *
140Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
150Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
160Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
170Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
180Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
190Sstevel@tonic-gate  *
200Sstevel@tonic-gate  * CDDL HEADER END
210Sstevel@tonic-gate  */
22*951Sraf 
230Sstevel@tonic-gate /*
24*951Sraf  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
25*951Sraf  * Use is subject to license terms.
260Sstevel@tonic-gate  */
270Sstevel@tonic-gate 
280Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
290Sstevel@tonic-gate /*	  All Rights Reserved  	*/
300Sstevel@tonic-gate 
310Sstevel@tonic-gate 
320Sstevel@tonic-gate #ifndef _SYS_TS_H
330Sstevel@tonic-gate #define	_SYS_TS_H
340Sstevel@tonic-gate 
350Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"	/* SVr4.0 1.5 */
360Sstevel@tonic-gate 
370Sstevel@tonic-gate #include <sys/types.h>
380Sstevel@tonic-gate #include <sys/thread.h>
390Sstevel@tonic-gate 
400Sstevel@tonic-gate #ifdef	__cplusplus
410Sstevel@tonic-gate extern "C" {
420Sstevel@tonic-gate #endif
430Sstevel@tonic-gate 
440Sstevel@tonic-gate /*
450Sstevel@tonic-gate  * time-sharing dispatcher parameter table entry
460Sstevel@tonic-gate  */
470Sstevel@tonic-gate typedef struct tsdpent {
480Sstevel@tonic-gate 	pri_t	ts_globpri;	/* global (class independent) priority */
490Sstevel@tonic-gate 	int	ts_quantum;	/* time quantum given to procs at this level */
500Sstevel@tonic-gate 	pri_t	ts_tqexp;	/* ts_umdpri assigned when proc at this level */
510Sstevel@tonic-gate 				/*   exceeds its time quantum */
520Sstevel@tonic-gate 	pri_t	ts_slpret;	/* ts_umdpri assigned when proc at this level */
530Sstevel@tonic-gate 				/*  returns to user mode after sleeping */
540Sstevel@tonic-gate 	short	ts_maxwait;	/* bumped to ts_lwait if more than ts_maxwait */
550Sstevel@tonic-gate 				/*  secs elapse before receiving full quantum */
560Sstevel@tonic-gate 	short	ts_lwait;	/* ts_umdpri assigned if ts_dispwait exceeds  */
570Sstevel@tonic-gate 				/*  ts_maxwait */
580Sstevel@tonic-gate } tsdpent_t;
590Sstevel@tonic-gate 
600Sstevel@tonic-gate 
610Sstevel@tonic-gate /*
620Sstevel@tonic-gate  * time-sharing class specific thread structure
630Sstevel@tonic-gate  */
640Sstevel@tonic-gate typedef struct tsproc {
650Sstevel@tonic-gate 	int		ts_timeleft;	/* time remaining in procs quantum */
660Sstevel@tonic-gate 	uint_t		ts_dispwait;	/* wall clock seconds since start */
670Sstevel@tonic-gate 				/*   of quantum (not reset upon preemption */
680Sstevel@tonic-gate 	pri_t	ts_cpupri;	/* system controlled component of ts_umdpri */
690Sstevel@tonic-gate 	pri_t	ts_uprilim;	/* user priority limit */
700Sstevel@tonic-gate 	pri_t	ts_upri;	/* user priority */
710Sstevel@tonic-gate 	pri_t	ts_umdpri;	/* user mode priority within ts class */
72*951Sraf 	pri_t	ts_scpri;	/* remembered priority, for schedctl */
730Sstevel@tonic-gate 	char	ts_nice;	/* nice value for compatibility */
740Sstevel@tonic-gate 	char	ts_boost;	/* interactive priority offset */
75*951Sraf 	uchar_t	ts_flags;	/* flags defined below */
760Sstevel@tonic-gate 	kthread_t *ts_tp;	/* pointer to thread */
770Sstevel@tonic-gate 	struct tsproc *ts_next;	/* link to next tsproc on list */
780Sstevel@tonic-gate 	struct tsproc *ts_prev;	/* link to previous tsproc on list */
790Sstevel@tonic-gate } tsproc_t;
800Sstevel@tonic-gate 
810Sstevel@tonic-gate 
820Sstevel@tonic-gate /* flags */
830Sstevel@tonic-gate #define	TSKPRI	0x01	/* thread at kernel mode priority */
840Sstevel@tonic-gate #define	TSBACKQ	0x02	/* thread goes to back of disp q when preempted */
850Sstevel@tonic-gate #define	TSIA	0x04	/* thread is interactive */
860Sstevel@tonic-gate #define	TSIASET	0x08	/* interactive thread is "on" */
870Sstevel@tonic-gate #define	TSIANICED	0x10	/* interactive thread has been niced */
88*951Sraf #define	TSRESTORE	0x20	/* thread was not preempted, due to schedctl */
89*951Sraf 				/* restore priority from ts_scpri */
900Sstevel@tonic-gate 
910Sstevel@tonic-gate #ifdef	__cplusplus
920Sstevel@tonic-gate }
930Sstevel@tonic-gate #endif
940Sstevel@tonic-gate 
950Sstevel@tonic-gate #endif	/* _SYS_TS_H */
96