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