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*2c164fafSPatrick Mooney * Copyright 2019 Joyent, Inc. 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> 39c97ad5cdSakolb #include <sys/cpucaps.h> 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate #ifdef __cplusplus 427c478bd9Sstevel@tonic-gate extern "C" { 437c478bd9Sstevel@tonic-gate #endif 447c478bd9Sstevel@tonic-gate 457c478bd9Sstevel@tonic-gate /* 467c478bd9Sstevel@tonic-gate * time-sharing dispatcher parameter table entry 477c478bd9Sstevel@tonic-gate */ 487c478bd9Sstevel@tonic-gate typedef struct tsdpent { 497c478bd9Sstevel@tonic-gate pri_t ts_globpri; /* global (class independent) priority */ 507c478bd9Sstevel@tonic-gate int ts_quantum; /* time quantum given to procs at this level */ 517c478bd9Sstevel@tonic-gate pri_t ts_tqexp; /* ts_umdpri assigned when proc at this level */ 527c478bd9Sstevel@tonic-gate /* exceeds its time quantum */ 537c478bd9Sstevel@tonic-gate pri_t ts_slpret; /* ts_umdpri assigned when proc at this level */ 547c478bd9Sstevel@tonic-gate /* returns to user mode after sleeping */ 557c478bd9Sstevel@tonic-gate short ts_maxwait; /* bumped to ts_lwait if more than ts_maxwait */ 567c478bd9Sstevel@tonic-gate /* secs elapse before receiving full quantum */ 577c478bd9Sstevel@tonic-gate short ts_lwait; /* ts_umdpri assigned if ts_dispwait exceeds */ 587c478bd9Sstevel@tonic-gate /* ts_maxwait */ 597c478bd9Sstevel@tonic-gate } tsdpent_t; 607c478bd9Sstevel@tonic-gate 61c97ad5cdSakolb #ifdef _KERNEL 627c478bd9Sstevel@tonic-gate /* 637c478bd9Sstevel@tonic-gate * time-sharing class specific thread structure 647c478bd9Sstevel@tonic-gate */ 657c478bd9Sstevel@tonic-gate typedef struct tsproc { 667c478bd9Sstevel@tonic-gate int ts_timeleft; /* time remaining in procs quantum */ 677c478bd9Sstevel@tonic-gate uint_t ts_dispwait; /* wall clock seconds since start */ 68c97ad5cdSakolb /* of quantum (not reset upon preempt) */ 697c478bd9Sstevel@tonic-gate pri_t ts_cpupri; /* system controlled component of ts_umdpri */ 707c478bd9Sstevel@tonic-gate pri_t ts_uprilim; /* user priority limit */ 717c478bd9Sstevel@tonic-gate pri_t ts_upri; /* user priority */ 727c478bd9Sstevel@tonic-gate pri_t ts_umdpri; /* user mode priority within ts class */ 739ac8606fSraf pri_t ts_scpri; /* remembered priority, for schedctl */ 747c478bd9Sstevel@tonic-gate char ts_nice; /* nice value for compatibility */ 757c478bd9Sstevel@tonic-gate char ts_boost; /* interactive priority offset */ 769ac8606fSraf uchar_t ts_flags; /* flags defined below */ 777c478bd9Sstevel@tonic-gate kthread_t *ts_tp; /* pointer to thread */ 787c478bd9Sstevel@tonic-gate struct tsproc *ts_next; /* link to next tsproc on list */ 797c478bd9Sstevel@tonic-gate struct tsproc *ts_prev; /* link to previous tsproc on list */ 80c97ad5cdSakolb caps_sc_t ts_caps; /* CPU caps specific data */ 817c478bd9Sstevel@tonic-gate } tsproc_t; 827c478bd9Sstevel@tonic-gate 837c478bd9Sstevel@tonic-gate /* flags */ 84c97ad5cdSakolb #define TSBACKQ 0x02 /* thread goes to back of dispq if 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 */ 889ac8606fSraf #define TSRESTORE 0x20 /* thread was not preempted, due to schedctl */ 899ac8606fSraf /* restore priority from ts_scpri */ 907c478bd9Sstevel@tonic-gate 91c97ad5cdSakolb #endif /* _KERNEL */ 92c97ad5cdSakolb 937c478bd9Sstevel@tonic-gate #ifdef __cplusplus 947c478bd9Sstevel@tonic-gate } 957c478bd9Sstevel@tonic-gate #endif 967c478bd9Sstevel@tonic-gate 977c478bd9Sstevel@tonic-gate #endif /* _SYS_TS_H */ 98