The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/mach/thread_info.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /* 
    2  * Mach Operating System
    3  * Copyright (c) 1993-1987 Carnegie Mellon University
    4  * All Rights Reserved.
    5  * 
    6  * Permission to use, copy, modify and distribute this software and its
    7  * documentation is hereby granted, provided that both the copyright
    8  * notice and this permission notice appear in all copies of the
    9  * software, derivative works or modified versions, and any portions
   10  * thereof, and that both notices appear in supporting documentation.
   11  * 
   12  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
   13  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
   14  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
   15  * 
   16  * Carnegie Mellon requests users of this software to return to
   17  * 
   18  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
   19  *  School of Computer Science
   20  *  Carnegie Mellon University
   21  *  Pittsburgh PA 15213-3890
   22  * 
   23  * any improvements or extensions that they make and grant Carnegie Mellon
   24  * the rights to redistribute these changes.
   25  */
   26 /*
   27  * HISTORY
   28  * $Log:        thread_info.h,v $
   29  * Revision 2.6  93/11/17  17:47:38  dbg
   30  *      Added THREAD_POLICY_INFO flavor.
   31  *      [93/05/12            dbg]
   32  * 
   33  * Revision 2.5  93/01/14  17:47:57  danner
   34  *      Cleanup.
   35  *      [92/06/10            pds]
   36  *      64bit cleanup.
   37  *      [92/12/01            af]
   38  * 
   39  * Revision 2.4  91/05/14  17:01:06  mrt
   40  *      Correcting copyright
   41  * 
   42  * Revision 2.3  91/02/05  17:36:34  mrt
   43  *      Changed to new Mach copyright
   44  *      [91/02/01  17:21:39  mrt]
   45  * 
   46  * Revision 2.2  90/06/02  15:00:08  rpd
   47  *      Updated for new scheduling info.
   48  *      [90/03/26  22:40:55  rpd]
   49  * 
   50  * Revision 2.1  89/08/03  16:06:07  rwd
   51  * Created.
   52  * 
   53  * Revision 2.4  89/02/25  18:41:18  gm0w
   54  *      Changes for cleanup.
   55  * 
   56  *  4-Mar-88  David Black (dlb) at Carnegie-Mellon University
   57  *      Added TH_USAGE_SCALE for cpu_usage field.
   58  *
   59  * 15-Jan-88  David Golub (dbg) at Carnegie-Mellon University
   60  *      Changed to generic interface (variable-length array) to allow
   61  *      for expansion.  Renamed to thread_info.
   62  *
   63  *  1-Jun-87  Avadis Tevanian (avie) at Carnegie-Mellon University
   64  *      Created.
   65  *
   66  */
   67 /*
   68  *      File:   mach/thread_info
   69  *
   70  *      Thread information structure and definitions.
   71  *
   72  *      The defintions in this file are exported to the user.  The kernel
   73  *      will translate its internal data structures to these structures
   74  *      as appropriate.
   75  *
   76  */
   77 
   78 #ifndef _MACH_THREAD_INFO_H_
   79 #define _MACH_THREAD_INFO_H_
   80 
   81 #include <mach/boolean.h>
   82 #include <mach/policy.h>
   83 #include <mach/time_value.h>
   84 
   85 /*
   86  *      Generic information structure to allow for expansion.
   87  */
   88 typedef integer_t       *thread_info_t; /* varying array of ints */
   89 
   90 #define THREAD_INFO_MAX         (1024)  /* maximum array size */
   91 typedef integer_t       thread_info_data_t[THREAD_INFO_MAX];
   92 
   93 /*
   94  *      Currently defined information.
   95  */
   96 
   97 /*
   98  *      Basic information for thread.
   99  *      The base and current scheduling priority are
  100  *      valid only if the thread is running the
  101  *      timesharing scheduling policy.
  102  */
  103 #define THREAD_BASIC_INFO       1
  104 
  105 struct thread_basic_info {
  106         time_value_t    user_time;      /* user run time */
  107         time_value_t    system_time;    /* system run time */
  108         integer_t       cpu_usage;      /* scaled cpu usage percentage */
  109         integer_t       base_priority;  /* base scheduling priority */
  110         integer_t       cur_priority;   /* current scheduling priority */
  111         integer_t       run_state;      /* run state (see below) */
  112         integer_t       flags;          /* various flags (see below) */
  113         integer_t       suspend_count;  /* suspend count for thread */
  114         integer_t       sleep_time;     /* number of seconds that thread
  115                                            has been sleeping */
  116 };
  117 
  118 typedef struct thread_basic_info        thread_basic_info_data_t;
  119 typedef struct thread_basic_info        *thread_basic_info_t;
  120 #define THREAD_BASIC_INFO_COUNT \
  121                 (sizeof(thread_basic_info_data_t) / sizeof(natural_t))
  122 
  123 /*
  124  *      Scale factor for usage field.
  125  */
  126 
  127 #define TH_USAGE_SCALE  1000
  128 
  129 /*
  130  *      Thread run states (state field).
  131  */
  132 
  133 #define TH_STATE_RUNNING        1       /* thread is running normally */
  134 #define TH_STATE_STOPPED        2       /* thread is stopped */
  135 #define TH_STATE_WAITING        3       /* thread is waiting normally */
  136 #define TH_STATE_UNINTERRUPTIBLE 4      /* thread is in an uninterruptible
  137                                            wait */
  138 #define TH_STATE_HALTED         5       /* thread is halted at a
  139                                            clean point */
  140 
  141 /*
  142  *      Thread flags (flags field).
  143  */
  144 #define TH_FLAGS_SWAPPED        0x1     /* thread is swapped out */
  145 #define TH_FLAGS_IDLE           0x2     /* thread is an idle thread */
  146 
  147 /*
  148  *      Scheduling information.
  149  *      The contents are valid only for the timesharing
  150  *      and fixed priority policies.
  151  */
  152 #define THREAD_SCHED_INFO       2
  153 
  154 struct thread_sched_info {
  155         integer_t       policy;         /* scheduling policy */
  156         integer_t       data;           /* associated data */
  157         integer_t       base_priority;  /* base priority */
  158         integer_t       max_priority;   /* max priority */
  159         integer_t       cur_priority;   /* current priority */
  160 /*boolean_t*/integer_t  depressed;      /* depressed ? */
  161         integer_t       depress_priority; /* priority depressed from */
  162 };
  163 
  164 typedef struct thread_sched_info        thread_sched_info_data_t;
  165 typedef struct thread_sched_info        *thread_sched_info_t;
  166 #define THREAD_SCHED_INFO_COUNT \
  167                 (sizeof(thread_sched_info_data_t) / sizeof(natural_t))
  168 
  169 /*
  170  *      Thread scheduling policy information.
  171  *      For all policies, this returns the policy name
  172  *      and whether the thread is running with priority
  173  *      depression.  If enough space is allocated, this
  174  *      structure is followed by policy-specific scheduling
  175  *      policy information.
  176  */
  177 #define THREAD_POLICY_INFO      3
  178 
  179 struct thread_policy_info {
  180         integer_t       policy;         /* scheduling policy */
  181         integer_t       depressed;      /* TRUE if currently depressed */
  182 };
  183 
  184 typedef struct thread_policy_info       thread_policy_info_data_t;
  185 typedef struct thread_policy_info       *thread_policy_info_t;
  186 #define THREAD_POLICY_INFO_COUNT \
  187                 (sizeof(thread_policy_info_data_t) / sizeof(integer_t))
  188 
  189 #endif  /* _MACH_THREAD_INFO_H_ */

Cache object: cfe09524c5407599a075bd49a3b03cf2


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.