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 5*3792Sakolb * Common Development and Distribution License (the "License"). 6*3792Sakolb * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 21951Sraf 220Sstevel@tonic-gate /* 23*3792Sakolb * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 24951Sraf * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 280Sstevel@tonic-gate /* All Rights Reserved */ 290Sstevel@tonic-gate 300Sstevel@tonic-gate 310Sstevel@tonic-gate #ifndef _SYS_TS_H 320Sstevel@tonic-gate #define _SYS_TS_H 330Sstevel@tonic-gate 340Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5 */ 350Sstevel@tonic-gate 360Sstevel@tonic-gate #include <sys/types.h> 370Sstevel@tonic-gate #include <sys/thread.h> 38*3792Sakolb #include <sys/cpucaps.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 60*3792Sakolb #ifdef _KERNEL 610Sstevel@tonic-gate /* 620Sstevel@tonic-gate * time-sharing class specific thread structure 630Sstevel@tonic-gate */ 640Sstevel@tonic-gate typedef struct tsproc { 65*3792Sakolb int ts_timeleft; /* time remaining in procs quantum */ 66*3792Sakolb uint_t ts_dispwait; /* wall clock seconds since start */ 67*3792Sakolb /* of quantum (not reset upon preempt) */ 680Sstevel@tonic-gate pri_t ts_cpupri; /* system controlled component of ts_umdpri */ 69*3792Sakolb pri_t ts_uprilim; /* user priority limit */ 70*3792Sakolb pri_t ts_upri; /* user priority */ 71*3792Sakolb pri_t ts_umdpri; /* user mode priority within ts class */ 72*3792Sakolb pri_t ts_scpri; /* remembered priority, for schedctl */ 73*3792Sakolb char ts_nice; /* nice value for compatibility */ 74*3792Sakolb char ts_boost; /* interactive priority offset */ 75*3792Sakolb uchar_t ts_flags; /* flags defined below */ 76*3792Sakolb kthread_t *ts_tp; /* pointer to thread */ 77*3792Sakolb struct tsproc *ts_next; /* link to next tsproc on list */ 78*3792Sakolb struct tsproc *ts_prev; /* link to previous tsproc on list */ 79*3792Sakolb caps_sc_t ts_caps; /* CPU caps specific data */ 800Sstevel@tonic-gate } tsproc_t; 810Sstevel@tonic-gate 82*3792Sakolb /* flags */ 83*3792Sakolb #define TSKPRI 0x01 /* thread at kernel mode priority */ 84*3792Sakolb #define TSBACKQ 0x02 /* thread goes to back of dispq if preempted */ 85*3792Sakolb #define TSIA 0x04 /* thread is interactive */ 86*3792Sakolb #define TSIASET 0x08 /* interactive thread is "on" */ 87*3792Sakolb #define TSIANICED 0x10 /* interactive thread has been niced */ 88*3792Sakolb #define TSRESTORE 0x20 /* thread was not preempted, due to schedctl */ 89*3792Sakolb /* restore priority from ts_scpri */ 900Sstevel@tonic-gate 91*3792Sakolb #endif /* _KERNEL */ 920Sstevel@tonic-gate 930Sstevel@tonic-gate #ifdef __cplusplus 940Sstevel@tonic-gate } 950Sstevel@tonic-gate #endif 960Sstevel@tonic-gate 970Sstevel@tonic-gate #endif /* _SYS_TS_H */ 98