xref: /titanic_52/usr/src/uts/common/sys/ts.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright (c) 1997-1998 by Sun Microsystems, Inc.
24*7c478bd9Sstevel@tonic-gate  * All rights reserved.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
28*7c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate 
31*7c478bd9Sstevel@tonic-gate #ifndef _SYS_TS_H
32*7c478bd9Sstevel@tonic-gate #define	_SYS_TS_H
33*7c478bd9Sstevel@tonic-gate 
34*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"	/* SVr4.0 1.5 */
35*7c478bd9Sstevel@tonic-gate 
36*7c478bd9Sstevel@tonic-gate #include <sys/types.h>
37*7c478bd9Sstevel@tonic-gate #include <sys/thread.h>
38*7c478bd9Sstevel@tonic-gate 
39*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
40*7c478bd9Sstevel@tonic-gate extern "C" {
41*7c478bd9Sstevel@tonic-gate #endif
42*7c478bd9Sstevel@tonic-gate 
43*7c478bd9Sstevel@tonic-gate /*
44*7c478bd9Sstevel@tonic-gate  * time-sharing dispatcher parameter table entry
45*7c478bd9Sstevel@tonic-gate  */
46*7c478bd9Sstevel@tonic-gate typedef struct tsdpent {
47*7c478bd9Sstevel@tonic-gate 	pri_t	ts_globpri;	/* global (class independent) priority */
48*7c478bd9Sstevel@tonic-gate 	int	ts_quantum;	/* time quantum given to procs at this level */
49*7c478bd9Sstevel@tonic-gate 	pri_t	ts_tqexp;	/* ts_umdpri assigned when proc at this level */
50*7c478bd9Sstevel@tonic-gate 				/*   exceeds its time quantum */
51*7c478bd9Sstevel@tonic-gate 	pri_t	ts_slpret;	/* ts_umdpri assigned when proc at this level */
52*7c478bd9Sstevel@tonic-gate 				/*  returns to user mode after sleeping */
53*7c478bd9Sstevel@tonic-gate 	short	ts_maxwait;	/* bumped to ts_lwait if more than ts_maxwait */
54*7c478bd9Sstevel@tonic-gate 				/*  secs elapse before receiving full quantum */
55*7c478bd9Sstevel@tonic-gate 	short	ts_lwait;	/* ts_umdpri assigned if ts_dispwait exceeds  */
56*7c478bd9Sstevel@tonic-gate 				/*  ts_maxwait */
57*7c478bd9Sstevel@tonic-gate } tsdpent_t;
58*7c478bd9Sstevel@tonic-gate 
59*7c478bd9Sstevel@tonic-gate 
60*7c478bd9Sstevel@tonic-gate /*
61*7c478bd9Sstevel@tonic-gate  * time-sharing class specific thread structure
62*7c478bd9Sstevel@tonic-gate  */
63*7c478bd9Sstevel@tonic-gate typedef struct tsproc {
64*7c478bd9Sstevel@tonic-gate 	int		ts_timeleft;	/* time remaining in procs quantum */
65*7c478bd9Sstevel@tonic-gate 	uint_t		ts_dispwait;	/* wall clock seconds since start */
66*7c478bd9Sstevel@tonic-gate 				/*   of quantum (not reset upon preemption */
67*7c478bd9Sstevel@tonic-gate 	pri_t	ts_cpupri;	/* system controlled component of ts_umdpri */
68*7c478bd9Sstevel@tonic-gate 	pri_t	ts_uprilim;	/* user priority limit */
69*7c478bd9Sstevel@tonic-gate 	pri_t	ts_upri;	/* user priority */
70*7c478bd9Sstevel@tonic-gate 	pri_t	ts_umdpri;	/* user mode priority within ts class */
71*7c478bd9Sstevel@tonic-gate 	char	ts_nice;	/* nice value for compatibility */
72*7c478bd9Sstevel@tonic-gate 	char	ts_boost;	/* interactive priority offset */
73*7c478bd9Sstevel@tonic-gate 	unsigned char ts_flags;	/* flags defined below */
74*7c478bd9Sstevel@tonic-gate 	kthread_t *ts_tp;	/* pointer to thread */
75*7c478bd9Sstevel@tonic-gate 	struct tsproc *ts_next;	/* link to next tsproc on list */
76*7c478bd9Sstevel@tonic-gate 	struct tsproc *ts_prev;	/* link to previous tsproc on list */
77*7c478bd9Sstevel@tonic-gate } tsproc_t;
78*7c478bd9Sstevel@tonic-gate 
79*7c478bd9Sstevel@tonic-gate 
80*7c478bd9Sstevel@tonic-gate /* flags */
81*7c478bd9Sstevel@tonic-gate #define	TSKPRI	0x01	/* thread at kernel mode priority */
82*7c478bd9Sstevel@tonic-gate #define	TSBACKQ	0x02	/* thread goes to back of disp q when preempted */
83*7c478bd9Sstevel@tonic-gate #define	TSIA	0x04	/* thread is interactive */
84*7c478bd9Sstevel@tonic-gate #define	TSIASET	0x08	/* interactive thread is "on" */
85*7c478bd9Sstevel@tonic-gate #define	TSIANICED	0x10	/* interactive thread has been niced */
86*7c478bd9Sstevel@tonic-gate 
87*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
88*7c478bd9Sstevel@tonic-gate }
89*7c478bd9Sstevel@tonic-gate #endif
90*7c478bd9Sstevel@tonic-gate 
91*7c478bd9Sstevel@tonic-gate #endif	/* _SYS_TS_H */
92