home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / UNIX / Utilities / top-0.5-MI / machine / m_next40_task.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-22  |  3.2 KB  |  98 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.  * are 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.     /* Synchronization/destruction information */
  25.     int        ref_count;    /* Number of references to me */
  26.     boolean_t    active;        /* Task has not been terminated */
  27.  
  28.     /* Miscellaneous */
  29.     char    map[4];        /* Address space description */
  30.     queue_chain_t    pset_tasks;    /* list of tasks assigned to pset */
  31.     int        suspend_count;    /* Internal scheduling only */
  32.  
  33.     /* Thread information */
  34.     queue_head_t    thread_list;    /* list of threads */
  35.     int        thread_count;    /* number of threads */
  36.     processor_set_t    processor_set;    /* processor set for new threads */
  37.     boolean_t    may_assign;    /* can assigned pset be changed? */
  38.     boolean_t    assign_active;    /* waiting for may_assign */
  39.  
  40.     /* Garbage */
  41.     struct utask    *u_address;
  42. #if    NeXT
  43.     struct proc    *proc;        /* corresponding process */
  44. #else    NeXT
  45.     int        proc_index;    /* corresponding process, by index */
  46. #endif    NeXT
  47.  
  48.     /* User-visible scheduling information */
  49.     int        user_stop_count;    /* outstanding stops */
  50.     int        priority;        /* for new threads */
  51.  
  52.     /* Information for kernel-internal tasks */
  53. #if    NeXT
  54.     boolean_t    kernel_privilege; /* Is a kernel task */
  55. #endif    NeXT
  56.     boolean_t    kernel_ipc_space; /* Uses kernel's port names? */
  57.     boolean_t    kernel_vm_space; /* Uses kernel's pmap? */
  58.  
  59.     /* Statistics */
  60.     time_value_t    total_user_time;
  61.                 /* total user time for dead threads */
  62.     time_value_t    total_system_time;
  63.                 /* total system time for dead threads */
  64.  
  65.     /* Special ports */
  66.     port_t        task_self;    /* Port representing the task */
  67.     port_t        task_tself;    /* What the task thinks is task_self */
  68.     port_t        task_notify;    /* Where notifications get sent */
  69.     port_t        exception_port;    /* Where exceptions are sent */
  70.     port_t        bootstrap_port;    /* Port passed on for task startup */
  71.  
  72.     /* IPC structures */
  73.     boolean_t    ipc_privilege;    /* Can use kernel resource pools? */
  74.     char ipc_translation_lock[4];
  75.     queue_head_t    ipc_translations; /* Per-task port naming */
  76.     boolean_t    ipc_active;    /* Can IPC rights be added? */
  77.     port_name_t    ipc_next_name;    /* Next local name to use */
  78. #if    MACH_IPC_XXXHACK
  79.     kern_set_t    ipc_enabled;    /* Port set for PORT_ENABLED */
  80. #endif    MACH_IPC_XXXHACK
  81.  
  82. #if    MACH_IPC_TCACHE
  83. #define OBJ_CACHE_MAX        010    /* Number of cache lines */
  84. #define OBJ_CACHE_MASK        007    /* Mask for name->line */
  85.  
  86.     struct {
  87.         port_name_t    name;
  88.         kern_obj_t    object;
  89.     }        obj_cache[OBJ_CACHE_MAX];
  90.                     /* Fast object translation cache */
  91. #endif    MACH_IPC_TCACHE
  92.  
  93.     /* IPC compatibility garbage */
  94.     boolean_t    ipc_intr_msg;    /* Send signal upon message arrival? */
  95. #define TASK_PORT_REGISTER_MAX 4     /* Number of "registered" ports */
  96.     port_t        ipc_ports_registered[TASK_PORT_REGISTER_MAX];
  97. };
  98.