Annotation of XNU/osfmk/mach/thread_info.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
                      3:  *
                      4:  * @APPLE_LICENSE_HEADER_START@
                      5:  * 
                      6:  * The contents of this file constitute Original Code as defined in and
                      7:  * are subject to the Apple Public Source License Version 1.1 (the
                      8:  * "License").  You may not use this file except in compliance with the
                      9:  * License.  Please obtain a copy of the License at
                     10:  * http://www.apple.com/publicsource and read it before using this file.
                     11:  * 
                     12:  * This Original Code and all software distributed under the License are
                     13:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
                     14:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
                     15:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
                     16:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
                     17:  * License for the specific language governing rights and limitations
                     18:  * under the License.
                     19:  * 
                     20:  * @APPLE_LICENSE_HEADER_END@
                     21:  */
                     22: /*
                     23:  * @OSF_COPYRIGHT@
                     24:  */
                     25: /*
                     26:  * HISTORY
                     27:  * 
                     28:  * Revision 1.1.1.1  1998/09/22 21:05:30  wsanchez
                     29:  * Import of Mac OS X kernel (~semeria)
                     30:  *
                     31:  * Revision 1.1.1.1  1998/03/07 02:25:46  wsanchez
                     32:  * Import of OSF Mach kernel (~mburg)
                     33:  *
                     34:  * Revision 1.2.17.3  1995/01/06  19:52:05  devrcs
                     35:  *     mk6 CR668 - 1.3b26 merge
                     36:  *     64bit cleanup, flavor typedefs
                     37:  *     [1994/10/14  03:43:17  dwm]
                     38:  *
                     39:  * Revision 1.2.17.2  1994/09/23  02:43:16  ezf
                     40:  *     change marker to not FREE
                     41:  *     [1994/09/22  21:43:12  ezf]
                     42:  * 
                     43:  * Revision 1.2.17.1  1994/08/07  20:50:11  bolinger
                     44:  *     Merge up to colo_b7.
                     45:  *     [1994/08/01  21:02:09  bolinger]
                     46:  * 
                     47:  * Revision 1.2.13.3  1994/06/25  03:47:23  dwm
                     48:  *     mk6 CR98 - add flavor interface typedefs.
                     49:  *     [1994/06/24  21:55:01  dwm]
                     50:  * 
                     51:  * Revision 1.2.13.2  1994/05/02  21:36:08  dwm
                     52:  *     Remove nmk15_compat support.
                     53:  *     [1994/05/02  21:09:13  dwm]
                     54:  * 
                     55:  * Revision 1.2.13.1  1994/01/12  17:57:31  dwm
                     56:  *     Fix "ifdef" NMK15_COMPAT to "if"
                     57:  *     [1994/01/12  17:31:16  dwm]
                     58:  * 
                     59:  * Revision 1.2.3.5  1993/08/03  18:29:54  gm
                     60:  *     CR9596: Change KERNEL to MACH_KERNEL.
                     61:  *     [1993/08/02  18:56:17  gm]
                     62:  * 
                     63:  * Revision 1.2.3.4  1993/07/08  19:04:54  watkins
                     64:  *     New version of thread_basic_info structure; old version
                     65:  *     is now under nmk15_compat.
                     66:  *     [1993/07/07  21:04:15  watkins]
                     67:  * 
                     68:  * Revision 1.2.3.3  1993/06/29  21:55:52  watkins
                     69:  *     New definitions for scheduling control interfaces.
                     70:  *     [1993/06/29  20:51:04  watkins]
                     71:  * 
                     72:  * Revision 1.2.3.2  1993/06/09  02:43:43  gm
                     73:  *     Added to OSF/1 R1.3 from NMK15.0.
                     74:  *     [1993/06/02  21:18:25  jeffc]
                     75:  * 
                     76:  * Revision 1.2  1993/04/19  16:39:43  devrcs
                     77:  *     ansi C conformance changes
                     78:  *     [1993/02/02  18:55:07  david]
                     79:  * 
                     80:  * Revision 1.1  1992/09/30  02:32:13  robert
                     81:  *     Initial revision
                     82:  * 
                     83:  * $EndLog$
                     84:  */
                     85: /* CMU_HIST */
                     86: /*
                     87:  * Revision 2.4  91/05/14  17:01:06  mrt
                     88:  *     Correcting copyright
                     89:  * 
                     90:  * Revision 2.3  91/02/05  17:36:34  mrt
                     91:  *     Changed to new Mach copyright
                     92:  *     [91/02/01  17:21:39  mrt]
                     93:  * 
                     94:  * Revision 2.2  90/06/02  15:00:08  rpd
                     95:  *     Updated for new scheduling info.
                     96:  *     [90/03/26  22:40:55  rpd]
                     97:  * 
                     98:  * Revision 2.1  89/08/03  16:06:07  rwd
                     99:  * Created.
                    100:  * 
                    101:  * Revision 2.4  89/02/25  18:41:18  gm0w
                    102:  *     Changes for cleanup.
                    103:  * 
                    104:  *  4-Mar-88  David Black (dlb) at Carnegie-Mellon University
                    105:  *     Added TH_USAGE_SCALE for cpu_usage field.
                    106:  *
                    107:  * 15-Jan-88  David Golub (dbg) at Carnegie-Mellon University
                    108:  *     Changed to generic interface (variable-length array) to allow
                    109:  *     for expansion.  Renamed to thread_info.
                    110:  *
                    111:  *  1-Jun-87  Avadis Tevanian (avie) at Carnegie-Mellon University
                    112:  *     Created.
                    113:  *
                    114:  */
                    115: /* CMU_ENDHIST */
                    116: /* 
                    117:  * Mach Operating System
                    118:  * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
                    119:  * All Rights Reserved.
                    120:  * 
                    121:  * Permission to use, copy, modify and distribute this software and its
                    122:  * documentation is hereby granted, provided that both the copyright
                    123:  * notice and this permission notice appear in all copies of the
                    124:  * software, derivative works or modified versions, and any portions
                    125:  * thereof, and that both notices appear in supporting documentation.
                    126:  * 
                    127:  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
                    128:  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
                    129:  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
                    130:  * 
                    131:  * Carnegie Mellon requests users of this software to return to
                    132:  * 
                    133:  *  Software Distribution Coordinator  or  [email protected]
                    134:  *  School of Computer Science
                    135:  *  Carnegie Mellon University
                    136:  *  Pittsburgh PA 15213-3890
                    137:  * 
                    138:  * any improvements or extensions that they make and grant Carnegie Mellon
                    139:  * the rights to redistribute these changes.
                    140:  */
                    141: /*
                    142:  */
                    143: /*
                    144:  *     File:   mach/thread_info
                    145:  *
                    146:  *     Thread information structure and definitions.
                    147:  *
                    148:  *     The defintions in this file are exported to the user.  The kernel
                    149:  *     will translate its internal data structures to these structures
                    150:  *     as appropriate.
                    151:  *
                    152:  */
                    153: 
                    154: #ifndef        _MACH_THREAD_INFO_H_
                    155: #define _MACH_THREAD_INFO_H_
                    156: 
                    157: #include <mach/boolean.h>
                    158: #include <mach/policy.h>
                    159: #include <mach/time_value.h>
                    160: #include <mach/machine/vm_types.h>
                    161: 
                    162: /*
                    163:  *     Generic information structure to allow for expansion.
                    164:  */
                    165: typedef        natural_t       thread_flavor_t;
                    166: typedef        integer_t       *thread_info_t;         /* varying array of int */
                    167: 
                    168: #define THREAD_INFO_MAX                (1024)  /* maximum array size */
                    169: typedef        integer_t       thread_info_data_t[THREAD_INFO_MAX];
                    170: 
                    171: /*
                    172:  *     Currently defined information.
                    173:  */
                    174: #define THREAD_BASIC_INFO              3     /* basic information */
                    175: 
                    176: struct thread_basic_info {
                    177:         time_value_t    user_time;      /* user run time */
                    178:         time_value_t    system_time;    /* system run time */
                    179:         integer_t       cpu_usage;      /* scaled cpu usage percentage */
                    180:        policy_t        policy;         /* scheduling policy in effect */
                    181:         integer_t       run_state;      /* run state (see below) */
                    182:         integer_t       flags;          /* various flags (see below) */
                    183:         integer_t       suspend_count;  /* suspend count for thread */
                    184:         integer_t       sleep_time;     /* number of seconds that thread
                    185:                                            has been sleeping */
                    186: };
                    187: 
                    188: typedef struct thread_basic_info  thread_basic_info_data_t;
                    189: typedef struct thread_basic_info  *thread_basic_info_t;
                    190: #define THREAD_BASIC_INFO_COUNT   \
                    191:                 (sizeof(thread_basic_info_data_t) / sizeof(natural_t))
                    192: 
                    193: /*
                    194:  *     Scale factor for usage field.
                    195:  */
                    196: 
                    197: #define TH_USAGE_SCALE 1000
                    198: 
                    199: /*
                    200:  *     Thread run states (state field).
                    201:  */
                    202: 
                    203: #define TH_STATE_RUNNING       1       /* thread is running normally */
                    204: #define TH_STATE_STOPPED       2       /* thread is stopped */
                    205: #define TH_STATE_WAITING       3       /* thread is waiting normally */
                    206: #define TH_STATE_UNINTERRUPTIBLE 4     /* thread is in an uninterruptible
                    207:                                           wait */
                    208: #define TH_STATE_HALTED                5       /* thread is halted at a
                    209:                                           clean point */
                    210: 
                    211: /*
                    212:  *     Thread flags (flags field).
                    213:  */
                    214: #define TH_FLAGS_SWAPPED       0x1     /* thread is swapped out */
                    215: #define TH_FLAGS_IDLE          0x2     /* thread is an idle thread */
                    216: 
                    217: #define THREAD_SCHED_TIMESHARE_INFO    10
                    218: #define THREAD_SCHED_RR_INFO           11
                    219: #define THREAD_SCHED_FIFO_INFO         12
                    220: 
                    221: #endif /* _MACH_THREAD_INFO_H_ */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.