home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / UNIX / Utilities / top-0.5-MI / machine / m_next_task.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-22  |  3.3 KB  |  106 lines

  1. /* 
  2.  * This is a stripped-down and hacked version of task.h from NextStep 2.1
  3.  * from the Informer.app by Max Tardiveau.
  4.  *
  5.  * tpugh 2/14/1996
  6.  * I've modify this task structure to account some unknown variables in
  7.  * NeXT's new (unpublished) task structure, so I can get to the utask structure.
  8.  * tmp1[3] is in the right place, but tmp2[3] may not be in the right place.
  9.  * So do not be surprised if any other variable in the structure, except utask,
  10.  * is incorrectly aligned.
  11.  *
  12.  */
  13.  
  14.  
  15. #import <mach/boolean.h>
  16. #import <mach/port.h>
  17. #import <mach/time_value.h>
  18. #import <kernserv/lock.h>
  19. #import <kernserv/queue.h>
  20. #import <mach/mach_param.h>
  21. #import <mach/mach_types.h>
  22.  
  23. struct task {
  24. #ifdef NEXTSTEP33
  25.     int tmp1[3];
  26. #endif
  27.     /* Synchronization/destruction information */
  28.     char lock[4];
  29.     int        ref_count;    /* Number of references to me */
  30.     boolean_t    active;        /* Task has not been terminated */
  31.  
  32.     /* Miscellaneous */
  33.     char    map[4];        /* Address space description */
  34.     queue_chain_t    pset_tasks;    /* list of tasks assigned to pset */
  35.     int        suspend_count;    /* Internal scheduling only */
  36.  
  37.     /* Thread information */
  38.     queue_head_t    thread_list;    /* list of threads */
  39.     int        thread_count;    /* number of threads */
  40.     char thread_list_lock[4]; /* XXX thread_list lock */
  41.     processor_set_t    processor_set;    /* processor set for new threads */
  42. #ifdef NEXTSTEP33
  43.     int tmp2[3];
  44. #endif
  45.     boolean_t    may_assign;    /* can assigned pset be changed? */
  46.     boolean_t    assign_active;    /* waiting for may_assign */
  47.  
  48.     /* Garbage */
  49.     struct utask    *u_address;
  50. #if    NeXT
  51.     struct proc    *proc;        /* corresponding process */
  52. #else    NeXT
  53.     int        proc_index;    /* corresponding process, by index */
  54. #endif    NeXT
  55.  
  56.     /* User-visible scheduling information */
  57.     int        user_stop_count;    /* outstanding stops */
  58.     int        priority;        /* for new threads */
  59.  
  60.     /* Information for kernel-internal tasks */
  61. #if    NeXT
  62.     boolean_t    kernel_privilege; /* Is a kernel task */
  63. #endif    NeXT
  64.     boolean_t    kernel_ipc_space; /* Uses kernel's port names? */
  65.     boolean_t    kernel_vm_space; /* Uses kernel's pmap? */
  66.  
  67.     /* Statistics */
  68.     time_value_t    total_user_time;
  69.                 /* total user time for dead threads */
  70.     time_value_t    total_system_time;
  71.                 /* total system time for dead threads */
  72.  
  73.     /* Special ports */
  74.     port_t        task_self;    /* Port representing the task */
  75.     port_t        task_tself;    /* What the task thinks is task_self */
  76.     port_t        task_notify;    /* Where notifications get sent */
  77.     port_t        exception_port;    /* Where exceptions are sent */
  78.     port_t        bootstrap_port;    /* Port passed on for task startup */
  79.  
  80.     /* IPC structures */
  81.     boolean_t    ipc_privilege;    /* Can use kernel resource pools? */
  82.     char ipc_translation_lock[4];
  83.     queue_head_t    ipc_translations; /* Per-task port naming */
  84.     boolean_t    ipc_active;    /* Can IPC rights be added? */
  85.     port_name_t    ipc_next_name;    /* Next local name to use */
  86. #if    MACH_IPC_XXXHACK
  87.     kern_set_t    ipc_enabled;    /* Port set for PORT_ENABLED */
  88. #endif    MACH_IPC_XXXHACK
  89.  
  90. #if    MACH_IPC_TCACHE
  91. #define OBJ_CACHE_MAX        010    /* Number of cache lines */
  92. #define OBJ_CACHE_MASK        007    /* Mask for name->line */
  93.  
  94.     struct {
  95.         port_name_t    name;
  96.         kern_obj_t    object;
  97.     }        obj_cache[OBJ_CACHE_MAX];
  98.                     /* Fast object translation cache */
  99. #endif    MACH_IPC_TCACHE
  100.  
  101.     /* IPC compatibility garbage */
  102.     boolean_t    ipc_intr_msg;    /* Send signal upon message arrival? */
  103. #define TASK_PORT_REGISTER_MAX 4     /* Number of "registered" ports */
  104.     port_t        ipc_ports_registered[TASK_PORT_REGISTER_MAX];
  105. };
  106.