Annotation of Gnu-Mach/kern/task.h, revision 1.1.1.4

1.1.1.3   root        1: /*
1.1       root        2:  * Mach Operating System
                      3:  * Copyright (c) 1993-1988 Carnegie Mellon University
                      4:  * All Rights Reserved.
1.1.1.3   root        5:  *
1.1       root        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.
1.1.1.3   root       11:  *
1.1       root       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.
1.1.1.3   root       15:  *
1.1       root       16:  * Carnegie Mellon requests users of this software to return to
1.1.1.3   root       17:  *
1.1       root       18:  *  Software Distribution Coordinator  or  [email protected]
                     19:  *  School of Computer Science
                     20:  *  Carnegie Mellon University
                     21:  *  Pittsburgh PA 15213-3890
1.1.1.3   root       22:  *
1.1       root       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 <mach/boolean.h>
                     38: #include <mach/port.h>
                     39: #include <mach/time_value.h>
                     40: #include <mach/mach_param.h>
                     41: #include <mach/task_info.h>
                     42: #include <kern/kern_types.h>
                     43: #include <kern/lock.h>
                     44: #include <kern/queue.h>
                     45: #include <kern/pc_sample.h>
                     46: #include <kern/processor.h>
                     47: #include <kern/syscall_emulation.h>
1.1.1.4 ! root       48: #include <vm/vm_types.h>
        !            49: #include <machine/task.h>
1.1       root       50: 
                     51: struct task {
                     52:        /* Synchronization/destruction information */
                     53:        decl_simple_lock_data(,lock)    /* Task's lock */
                     54:        int             ref_count;      /* Number of references to me */
                     55:        boolean_t       active;         /* Task has not been terminated */
                     56: 
                     57:        /* Miscellaneous */
                     58:        vm_map_t        map;            /* Address space description */
                     59:        queue_chain_t   pset_tasks;     /* list of tasks assigned to pset */
                     60:        int             suspend_count;  /* Internal scheduling only */
                     61: 
                     62:        /* Thread information */
                     63:        queue_head_t    thread_list;    /* list of threads */
                     64:        int             thread_count;   /* number of threads */
                     65:        processor_set_t processor_set;  /* processor set for new threads */
                     66:        boolean_t       may_assign;     /* can assigned pset be changed? */
                     67:        boolean_t       assign_active;  /* waiting for may_assign */
                     68: 
                     69:        /* User-visible scheduling information */
                     70:        int             user_stop_count;        /* outstanding stops */
                     71:        int             priority;               /* for new threads */
                     72: 
                     73:        /* Statistics */
                     74:        time_value_t    total_user_time;
                     75:                                /* total user time for dead threads */
                     76:        time_value_t    total_system_time;
                     77:                                /* total system time for dead threads */
                     78: 
1.1.1.2   root       79:        time_value_t    creation_time; /* time stamp at creation */
                     80: 
1.1       root       81:        /* IPC structures */
                     82:        decl_simple_lock_data(, itk_lock_data)
                     83:        struct ipc_port *itk_self;      /* not a right, doesn't hold ref */
                     84:        struct ipc_port *itk_sself;     /* a send right */
                     85:        struct ipc_port *itk_exception; /* a send right */
                     86:        struct ipc_port *itk_bootstrap; /* a send right */
                     87:        struct ipc_port *itk_registered[TASK_PORT_REGISTER_MAX];
                     88:                                        /* all send rights */
                     89: 
                     90:        struct ipc_space *itk_space;
                     91: 
                     92:        /* User space system call emulation support */
                     93:        struct  eml_dispatch    *eml_dispatch;
                     94: 
                     95:        sample_control_t pc_sample;
                     96: 
                     97: #if    FAST_TAS
1.1.1.3   root       98: #define TASK_FAST_TAS_NRAS     8
1.1       root       99:        vm_offset_t     fast_tas_base[TASK_FAST_TAS_NRAS];
                    100:        vm_offset_t     fast_tas_end[TASK_FAST_TAS_NRAS];
                    101: #endif /* FAST_TAS */
                    102: 
1.1.1.4 ! root      103:        /* Hardware specific data.  */
        !           104:        machine_task_t  machine;
        !           105: 
        !           106:        /* Statistics */
        !           107:        natural_t       faults;         /* page faults counter */
        !           108:        natural_t       zero_fills;     /* zero fill pages counter */
        !           109:        natural_t       reactivations;  /* reactivated pages counter */
        !           110:        natural_t       pageins;        /* actual pageins couter */
        !           111:        natural_t       cow_faults;     /* copy-on-write faults counter */
        !           112:        natural_t       messages_sent;  /* messages sent counter */
        !           113:        natural_t       messages_received; /* messages received counter */
1.1       root      114: };
                    115: 
                    116: #define task_lock(task)                simple_lock(&(task)->lock)
                    117: #define task_unlock(task)      simple_unlock(&(task)->lock)
                    118: 
                    119: #define        itk_lock_init(task)     simple_lock_init(&(task)->itk_lock_data)
                    120: #define        itk_lock(task)          simple_lock(&(task)->itk_lock_data)
                    121: #define        itk_unlock(task)        simple_unlock(&(task)->itk_lock_data)
                    122: 
                    123: /*
                    124:  *     Exported routines/macros
                    125:  */
                    126: 
                    127: extern kern_return_t   task_create(
                    128:        task_t          parent_task,
                    129:        boolean_t       inherit_memory,
                    130:        task_t          *child_task);
                    131: extern kern_return_t   task_terminate(
                    132:        task_t          task);
                    133: extern kern_return_t   task_suspend(
                    134:        task_t          task);
                    135: extern kern_return_t   task_resume(
                    136:        task_t          task);
                    137: extern kern_return_t   task_threads(
                    138:        task_t          task,
                    139:        thread_array_t  *thread_list,
                    140:        natural_t       *count);
                    141: extern kern_return_t   task_info(
                    142:        task_t          task,
                    143:        int             flavor,
                    144:        task_info_t     task_info_out,
                    145:        natural_t       *task_info_count);
                    146: extern kern_return_t   task_get_special_port(
                    147:        task_t          task,
                    148:        int             which,
                    149:        struct ipc_port **portp);
                    150: extern kern_return_t   task_set_special_port(
                    151:        task_t          task,
                    152:        int             which,
                    153:        struct ipc_port *port);
                    154: extern kern_return_t   task_assign(
                    155:        task_t          task,
                    156:        processor_set_t new_pset,
                    157:        boolean_t       assign_threads);
                    158: extern kern_return_t   task_assign_default(
                    159:        task_t          task,
                    160:        boolean_t       assign_threads);
1.1.1.4 ! root      161: extern void consider_task_collect(void);
1.1       root      162: 
                    163: /*
                    164:  *     Internal only routines
                    165:  */
                    166: 
1.1.1.4 ! root      167: extern void            task_init(void);
        !           168: extern void            task_reference(task_t);
        !           169: extern void            task_deallocate(task_t);
        !           170: extern kern_return_t   task_hold(task_t);
        !           171: extern kern_return_t   task_dowait(task_t, boolean_t);
        !           172: extern kern_return_t   task_release(task_t);
1.1       root      173: 
                    174: extern task_t  kernel_task;
                    175: 
1.1.1.3   root      176: #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.