xref: /titanic_53/usr/src/uts/common/sys/ts.h (revision 9ac8606f19e304e832a685ae7060cc3c284b9779)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
22*9ac8606fSraf 
237c478bd9Sstevel@tonic-gate /*
24*9ac8606fSraf  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
25*9ac8606fSraf  * Use is subject to license terms.
267c478bd9Sstevel@tonic-gate  */
277c478bd9Sstevel@tonic-gate 
287c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
297c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate #ifndef _SYS_TS_H
337c478bd9Sstevel@tonic-gate #define	_SYS_TS_H
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"	/* SVr4.0 1.5 */
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate #include <sys/types.h>
387c478bd9Sstevel@tonic-gate #include <sys/thread.h>
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
417c478bd9Sstevel@tonic-gate extern "C" {
427c478bd9Sstevel@tonic-gate #endif
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate /*
457c478bd9Sstevel@tonic-gate  * time-sharing dispatcher parameter table entry
467c478bd9Sstevel@tonic-gate  */
477c478bd9Sstevel@tonic-gate typedef struct tsdpent {
487c478bd9Sstevel@tonic-gate 	pri_t	ts_globpri;	/* global (class independent) priority */
497c478bd9Sstevel@tonic-gate 	int	ts_quantum;	/* time quantum given to procs at this level */
507c478bd9Sstevel@tonic-gate 	pri_t	ts_tqexp;	/* ts_umdpri assigned when proc at this level */
517c478bd9Sstevel@tonic-gate 				/*   exceeds its time quantum */
527c478bd9Sstevel@tonic-gate 	pri_t	ts_slpret;	/* ts_umdpri assigned when proc at this level */
537c478bd9Sstevel@tonic-gate 				/*  returns to user mode after sleeping */
547c478bd9Sstevel@tonic-gate 	short	ts_maxwait;	/* bumped to ts_lwait if more than ts_maxwait */
557c478bd9Sstevel@tonic-gate 				/*  secs elapse before receiving full quantum */
567c478bd9Sstevel@tonic-gate 	short	ts_lwait;	/* ts_umdpri assigned if ts_dispwait exceeds  */
577c478bd9Sstevel@tonic-gate 				/*  ts_maxwait */
587c478bd9Sstevel@tonic-gate } tsdpent_t;
597c478bd9Sstevel@tonic-gate 
607c478bd9Sstevel@tonic-gate 
617c478bd9Sstevel@tonic-gate /*
627c478bd9Sstevel@tonic-gate  * time-sharing class specific thread structure
637c478bd9Sstevel@tonic-gate  */
647c478bd9Sstevel@tonic-gate typedef struct tsproc {
657c478bd9Sstevel@tonic-gate 	int		ts_timeleft;	/* time remaining in procs quantum */
667c478bd9Sstevel@tonic-gate 	uint_t		ts_dispwait;	/* wall clock seconds since start */
677c478bd9Sstevel@tonic-gate 				/*   of quantum (not reset upon preemption */
687c478bd9Sstevel@tonic-gate 	pri_t	ts_cpupri;	/* system controlled component of ts_umdpri */
697c478bd9Sstevel@tonic-gate 	pri_t	ts_uprilim;	/* user priority limit */
707c478bd9Sstevel@tonic-gate 	pri_t	ts_upri;	/* user priority */
717c478bd9Sstevel@tonic-gate 	pri_t	ts_umdpri;	/* user mode priority within ts class */
72*9ac8606fSraf 	pri_t	ts_scpri;	/* remembered priority, for schedctl */
737c478bd9Sstevel@tonic-gate 	char	ts_nice;	/* nice value for compatibility */
747c478bd9Sstevel@tonic-gate 	char	ts_boost;	/* interactive priority offset */
75*9ac8606fSraf 	uchar_t	ts_flags;	/* flags defined below */
767c478bd9Sstevel@tonic-gate 	kthread_t *ts_tp;	/* pointer to thread */
777c478bd9Sstevel@tonic-gate 	struct tsproc *ts_next;	/* link to next tsproc on list */
787c478bd9Sstevel@tonic-gate 	struct tsproc *ts_prev;	/* link to previous tsproc on list */
797c478bd9Sstevel@tonic-gate } tsproc_t;
807c478bd9Sstevel@tonic-gate 
817c478bd9Sstevel@tonic-gate 
827c478bd9Sstevel@tonic-gate /* flags */
837c478bd9Sstevel@tonic-gate #define	TSKPRI	0x01	/* thread at kernel mode priority */
847c478bd9Sstevel@tonic-gate #define	TSBACKQ	0x02	/* thread goes to back of disp q when preempted */
857c478bd9Sstevel@tonic-gate #define	TSIA	0x04	/* thread is interactive */
867c478bd9Sstevel@tonic-gate #define	TSIASET	0x08	/* interactive thread is "on" */
877c478bd9Sstevel@tonic-gate #define	TSIANICED	0x10	/* interactive thread has been niced */
88*9ac8606fSraf #define	TSRESTORE	0x20	/* thread was not preempted, due to schedctl */
89*9ac8606fSraf 				/* restore priority from ts_scpri */
907c478bd9Sstevel@tonic-gate 
917c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
927c478bd9Sstevel@tonic-gate }
937c478bd9Sstevel@tonic-gate #endif
947c478bd9Sstevel@tonic-gate 
957c478bd9Sstevel@tonic-gate #endif	/* _SYS_TS_H */
96