Annotation of kernel/mach/thread_info.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
                      3:  *
                      4:  * @APPLE_LICENSE_HEADER_START@
                      5:  * 
                      6:  * Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
                      7:  * Reserved.  This file contains Original Code and/or Modifications of
                      8:  * Original Code as defined in and that are subject to the Apple Public
                      9:  * Source License Version 1.1 (the "License").  You may not use this file
                     10:  * except in compliance with the License.  Please obtain a copy of the
                     11:  * License at http://www.apple.com/publicsource and read it before using
                     12:  * this file.
                     13:  * 
                     14:  * The Original Code and all software distributed under the License are
                     15:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
                     16:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
                     17:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
                     18:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
                     19:  * License for the specific language governing rights and limitations
                     20:  * under the License.
                     21:  * 
                     22:  * @APPLE_LICENSE_HEADER_END@
                     23:  */
                     24: 
                     25: /* 
                     26:  * Mach Operating System
                     27:  * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
                     28:  * All Rights Reserved.
                     29:  * 
                     30:  * Permission to use, copy, modify and distribute this software and its
                     31:  * documentation is hereby granted, provided that both the copyright
                     32:  * notice and this permission notice appear in all copies of the
                     33:  * software, derivative works or modified versions, and any portions
                     34:  * thereof, and that both notices appear in supporting documentation.
                     35:  * 
                     36:  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
                     37:  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
                     38:  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
                     39:  * 
                     40:  * Carnegie Mellon requests users of this software to return to
                     41:  * 
                     42:  *  Software Distribution Coordinator  or  [email protected]
                     43:  *  School of Computer Science
                     44:  *  Carnegie Mellon University
                     45:  *  Pittsburgh PA 15213-3890
                     46:  * 
                     47:  * any improvements or extensions that they make and grant Carnegie Mellon
                     48:  * the rights to redistribute these changes.
                     49:  */
                     50: /*
                     51:  *     File:   mach/thread_info
                     52:  *
                     53:  *     Thread information structure and definitions.
                     54:  *
                     55:  *     The defintions in this file are exported to the user.  The kernel
                     56:  *     will translate its internal data structures to these structures
                     57:  *     as appropriate.
                     58:  *
                     59:  */
                     60: 
                     61: #ifndef        _MACH_THREAD_INFO_H_
                     62: #define _MACH_THREAD_INFO_H_
                     63: 
                     64: #import <mach/machine/vm_types.h>
                     65: #import <mach/boolean.h>
                     66: #import <mach/policy.h>
                     67: #import <mach/time_value.h>
                     68: 
                     69: /*
                     70:  *     Generic information structure to allow for expansion.
                     71:  */
                     72: typedef        integer_t       *thread_info_t;         /* varying array of ints */
                     73: 
                     74: #define THREAD_INFO_MAX                (1024)  /* maximum array size */
                     75: typedef        integer_t       thread_info_data_t[THREAD_INFO_MAX];
                     76: 
                     77: /*
                     78:  *     Currently defined information.
                     79:  */
                     80: #define THREAD_BASIC_INFO      1               /* basic information */
                     81: 
                     82: struct thread_basic_info {
                     83:        time_value_t    user_time;      /* user run time */
                     84:        time_value_t    system_time;    /* system run time */
                     85:        integer_t       cpu_usage;      /* scaled cpu usage percentage */
                     86:        integer_t       base_priority;  /* base scheduling priority */
                     87:        integer_t       cur_priority;   /* current scheduling priority */
                     88:        integer_t       run_state;      /* run state (see below) */
                     89:        integer_t       flags;          /* various flags (see below) */
                     90:        integer_t       suspend_count;  /* suspend count for thread */
                     91:        integer_t       sleep_time;     /* number of seconds that thread
                     92:                                           has been sleeping */
                     93: };
                     94: 
                     95: typedef struct thread_basic_info       thread_basic_info_data_t;
                     96: typedef struct thread_basic_info       *thread_basic_info_t;
                     97: #define THREAD_BASIC_INFO_COUNT        \
                     98:                (sizeof(thread_basic_info_data_t) / sizeof(natural_t))
                     99: 
                    100: /*
                    101:  *     Scale factor for usage field.
                    102:  */
                    103: 
                    104: #define TH_USAGE_SCALE 1000
                    105: 
                    106: /*
                    107:  *     Thread run states (state field).
                    108:  */
                    109: 
                    110: #define TH_STATE_RUNNING       1       /* thread is running normally */
                    111: #define TH_STATE_STOPPED       2       /* thread is stopped */
                    112: #define TH_STATE_WAITING       3       /* thread is waiting normally */
                    113: #define TH_STATE_UNINTERRUPTIBLE 4     /* thread is in an uninterruptible
                    114:                                           wait */
                    115: #define TH_STATE_HALTED                5       /* thread is halted at a
                    116:                                           clean point */
                    117: 
                    118: /*
                    119:  *     Thread flags (flags field).
                    120:  */
                    121: #define TH_FLAGS_SWAPPED       0x1     /* thread is swapped out */
                    122: #define TH_FLAGS_IDLE          0x2     /* thread is an idle thread */
                    123: 
                    124: #define THREAD_SCHED_INFO      2
                    125: 
                    126: struct thread_sched_info {
                    127:        integer_t       policy;         /* scheduling policy */
                    128:        integer_t       data;           /* associated data */
                    129:        integer_t       base_priority;  /* base priority */
                    130:        integer_t       max_priority;   /* max priority */
                    131:        integer_t       cur_priority;   /* current priority */
                    132: /*boolean_t*/integer_t depressed;      /* depressed ? */
                    133:        integer_t       depress_priority; /* priority depressed from */
                    134: };
                    135: 
                    136: typedef struct thread_sched_info       thread_sched_info_data_t;
                    137: typedef struct thread_sched_info       *thread_sched_info_t;
                    138: #define        THREAD_SCHED_INFO_COUNT \
                    139:                (sizeof(thread_sched_info_data_t) / sizeof(natural_t))
                    140: 
                    141: #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.