Annotation of OSKit-Mach/kern/task.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Mach Operating System
                      3:  * Copyright (c) 1993-1988 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  [email protected]
                     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:  *     File:   task.h
                     28:  *     Author: Avadis Tevanian, Jr.
                     29:  *
                     30:  *     This file contains the structure definitions for tasks.
                     31:  *
                     32:  */
                     33: 
                     34: #ifndef        _KERN_TASK_H_
                     35: #define _KERN_TASK_H_
                     36: 
                     37: #include <norma_task.h>
                     38: #include <fast_tas.h>
                     39: #include <net_atm.h>
                     40: 
                     41: #include <mach/boolean.h>
                     42: #include <mach/port.h>
                     43: #include <mach/time_value.h>
                     44: #include <mach/mach_param.h>
                     45: #include <mach/task_info.h>
                     46: #include <kern/kern_types.h>
                     47: #include <kern/lock.h>
                     48: #include <kern/queue.h>
                     49: #include <kern/pc_sample.h>
                     50: #include <kern/processor.h>
                     51: #include <kern/syscall_emulation.h>
                     52: #include <vm/vm_map.h>
                     53: #include <machine/task.h>
                     54: 
                     55: #if    NET_ATM
                     56: typedef struct nw_ep_owned {
                     57:   unsigned int ep;
                     58:   struct nw_ep_owned *next;
                     59: } nw_ep_owned_s, *nw_ep_owned_t;
                     60: #endif
                     61: 
                     62: struct task {
                     63:        /* Synchronization/destruction information */
                     64:        decl_simple_lock_data(,lock)    /* Task's lock */
                     65:        int             ref_count;      /* Number of references to me */
                     66:        boolean_t       active;         /* Task has not been terminated */
                     67: 
                     68:        /* Miscellaneous */
                     69:        vm_map_t        map;            /* Address space description */
                     70:        queue_chain_t   pset_tasks;     /* list of tasks assigned to pset */
                     71:        int             suspend_count;  /* Internal scheduling only */
                     72: 
                     73:        /* Thread information */
                     74:        queue_head_t    thread_list;    /* list of threads */
                     75:        int             thread_count;   /* number of threads */
                     76:        processor_set_t processor_set;  /* processor set for new threads */
                     77:        boolean_t       may_assign;     /* can assigned pset be changed? */
                     78:        boolean_t       assign_active;  /* waiting for may_assign */
                     79: 
                     80:        /* User-visible scheduling information */
                     81:        int             user_stop_count;        /* outstanding stops */
                     82:        int             priority;               /* for new threads */
                     83: 
                     84:        /* Statistics */
                     85:        time_value_t    total_user_time;
                     86:                                /* total user time for dead threads */
                     87:        time_value_t    total_system_time;
                     88:                                /* total system time for dead threads */
                     89: 
                     90:        time_value_t    creation_time; /* time stamp at creation */
                     91: 
                     92:        /* IPC structures */
                     93:        decl_simple_lock_data(, itk_lock_data)
                     94:        struct ipc_port *itk_self;      /* not a right, doesn't hold ref */
                     95:        struct ipc_port *itk_sself;     /* a send right */
                     96:        struct ipc_port *itk_exception; /* a send right */
                     97:        struct ipc_port *itk_bootstrap; /* a send right */
                     98:        struct ipc_port *itk_registered[TASK_PORT_REGISTER_MAX];
                     99:                                        /* all send rights */
                    100: 
                    101:        struct ipc_space *itk_space;
                    102: 
                    103:        /* User space system call emulation support */
                    104:        struct  eml_dispatch    *eml_dispatch;
                    105: 
                    106:        sample_control_t pc_sample;
                    107: 
                    108: #if    NORMA_TASK
                    109:        long            child_node;     /* if != -1, node for new children */
                    110: #endif /* NORMA_TASK */
                    111: 
                    112: #if    FAST_TAS
                    113: #define TASK_FAST_TAS_NRAS     8
                    114:        vm_offset_t     fast_tas_base[TASK_FAST_TAS_NRAS];
                    115:        vm_offset_t     fast_tas_end[TASK_FAST_TAS_NRAS];
                    116: #endif /* FAST_TAS */
                    117: 
                    118: #if    NET_ATM
                    119:        nw_ep_owned_t   nw_ep_owned;
                    120: #endif /* NET_ATM */
                    121: 
                    122:        /* Hardware specific data.  */
                    123:        machine_task_t machine;
                    124: };
                    125: 
                    126: #define task_lock(task)                simple_lock(&(task)->lock)
                    127: #define task_unlock(task)      simple_unlock(&(task)->lock)
                    128: 
                    129: #define        itk_lock_init(task)     simple_lock_init(&(task)->itk_lock_data)
                    130: #define        itk_lock(task)          simple_lock(&(task)->itk_lock_data)
                    131: #define        itk_unlock(task)        simple_unlock(&(task)->itk_lock_data)
                    132: 
                    133: /*
                    134:  *     Exported routines/macros
                    135:  */
                    136: 
                    137: extern kern_return_t   task_create(
                    138:        task_t          parent_task,
                    139:        boolean_t       inherit_memory,
                    140:        task_t          *child_task);
                    141: extern kern_return_t   task_terminate(
                    142:        task_t          task);
                    143: extern kern_return_t   task_suspend(
                    144:        task_t          task);
                    145: extern kern_return_t   task_resume(
                    146:        task_t          task);
                    147: extern kern_return_t   task_threads(
                    148:        task_t          task,
                    149:        thread_array_t  *thread_list,
                    150:        natural_t       *count);
                    151: extern kern_return_t   task_info(
                    152:        task_t          task,
                    153:        int             flavor,
                    154:        task_info_t     task_info_out,
                    155:        natural_t       *task_info_count);
                    156: extern kern_return_t   task_get_special_port(
                    157:        task_t          task,
                    158:        int             which,
                    159:        struct ipc_port **portp);
                    160: extern kern_return_t   task_set_special_port(
                    161:        task_t          task,
                    162:        int             which,
                    163:        struct ipc_port *port);
                    164: extern kern_return_t   task_assign(
                    165:        task_t          task,
                    166:        processor_set_t new_pset,
                    167:        boolean_t       assign_threads);
                    168: extern kern_return_t   task_assign_default(
                    169:        task_t          task,
                    170:        boolean_t       assign_threads);
                    171: 
                    172: /*
                    173:  *     Internal only routines
                    174:  */
                    175: 
                    176: extern void            task_init();
                    177: extern void            task_reference();
                    178: extern void            task_deallocate();
                    179: extern kern_return_t   task_hold();
                    180: extern kern_return_t   task_dowait();
                    181: extern kern_return_t   task_release();
                    182: extern kern_return_t   task_halt();
                    183: 
                    184: extern kern_return_t   task_suspend_nowait();
                    185: extern task_t          kernel_task_create();
                    186: 
                    187: extern task_t  kernel_task;
                    188: 
                    189: #endif /* _KERN_TASK_H_ */

unix.superglobalmegacorp.com

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