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 5c97ad5cdSakolb * Common Development and Distribution License (the "License"). 6c97ad5cdSakolb * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 219ac8606fSraf 227c478bd9Sstevel@tonic-gate /* 23c97ad5cdSakolb * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 249ac8606fSraf * Use is subject to license terms. 25*6a0b1217SPatrick Mooney * Copyright 2019 Joyent, Inc. 267c478bd9Sstevel@tonic-gate */ 277c478bd9Sstevel@tonic-gate 287c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 29b4203d75SMarcel Telka /* 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 #include <sys/types.h> 367c478bd9Sstevel@tonic-gate #include <sys/thread.h> 37c97ad5cdSakolb #include <sys/cpucaps.h> 387c478bd9Sstevel@tonic-gate 397c478bd9Sstevel@tonic-gate #ifdef __cplusplus 407c478bd9Sstevel@tonic-gate extern "C" { 417c478bd9Sstevel@tonic-gate #endif 427c478bd9Sstevel@tonic-gate 437c478bd9Sstevel@tonic-gate /* 447c478bd9Sstevel@tonic-gate * time-sharing dispatcher parameter table entry 457c478bd9Sstevel@tonic-gate */ 467c478bd9Sstevel@tonic-gate typedef struct tsdpent { 477c478bd9Sstevel@tonic-gate pri_t ts_globpri; /* global (class independent) priority */ 487c478bd9Sstevel@tonic-gate int ts_quantum; /* time quantum given to procs at this level */ 497c478bd9Sstevel@tonic-gate pri_t ts_tqexp; /* ts_umdpri assigned when proc at this level */ 507c478bd9Sstevel@tonic-gate /* exceeds its time quantum */ 517c478bd9Sstevel@tonic-gate pri_t ts_slpret; /* ts_umdpri assigned when proc at this level */ 527c478bd9Sstevel@tonic-gate /* returns to user mode after sleeping */ 537c478bd9Sstevel@tonic-gate short ts_maxwait; /* bumped to ts_lwait if more than ts_maxwait */ 547c478bd9Sstevel@tonic-gate /* secs elapse before receiving full quantum */ 557c478bd9Sstevel@tonic-gate short ts_lwait; /* ts_umdpri assigned if ts_dispwait exceeds */ 567c478bd9Sstevel@tonic-gate /* ts_maxwait */ 577c478bd9Sstevel@tonic-gate } tsdpent_t; 587c478bd9Sstevel@tonic-gate 59c97ad5cdSakolb #ifdef _KERNEL 607c478bd9Sstevel@tonic-gate /* 617c478bd9Sstevel@tonic-gate * time-sharing class specific thread structure 627c478bd9Sstevel@tonic-gate */ 637c478bd9Sstevel@tonic-gate typedef struct tsproc { 64c97ad5cdSakolb int ts_timeleft; /* time remaining in procs quantum */ 65c97ad5cdSakolb uint_t ts_dispwait; /* wall clock seconds since start */ 66c97ad5cdSakolb /* of quantum (not reset upon preempt) */ 677c478bd9Sstevel@tonic-gate pri_t ts_cpupri; /* system controlled component of ts_umdpri */ 68c97ad5cdSakolb pri_t ts_uprilim; /* user priority limit */ 69c97ad5cdSakolb pri_t ts_upri; /* user priority */ 70c97ad5cdSakolb pri_t ts_umdpri; /* user mode priority within ts class */ 71c97ad5cdSakolb pri_t ts_scpri; /* remembered priority, for schedctl */ 72c97ad5cdSakolb char ts_nice; /* nice value for compatibility */ 73c97ad5cdSakolb char ts_boost; /* interactive priority offset */ 74c97ad5cdSakolb uchar_t ts_flags; /* flags defined below */ 75c97ad5cdSakolb kthread_t *ts_tp; /* pointer to thread */ 76c97ad5cdSakolb struct tsproc *ts_next; /* link to next tsproc on list */ 77c97ad5cdSakolb struct tsproc *ts_prev; /* link to previous tsproc on list */ 78c97ad5cdSakolb caps_sc_t ts_caps; /* CPU caps specific data */ 797c478bd9Sstevel@tonic-gate } tsproc_t; 807c478bd9Sstevel@tonic-gate 817c478bd9Sstevel@tonic-gate /* flags */ 82c97ad5cdSakolb #define TSBACKQ 0x02 /* thread goes to back of dispq if preempted */ 83c97ad5cdSakolb #define TSIA 0x04 /* thread is interactive */ 84c97ad5cdSakolb #define TSIASET 0x08 /* interactive thread is "on" */ 85c97ad5cdSakolb #define TSIANICED 0x10 /* interactive thread has been niced */ 869ac8606fSraf #define TSRESTORE 0x20 /* thread was not preempted, due to schedctl */ 87c97ad5cdSakolb /* restore priority from ts_scpri */ 88c97ad5cdSakolb 89c97ad5cdSakolb #endif /* _KERNEL */ 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