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

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>
1.1.1.5 ! root       42: #include <mach_debug/mach_debug_types.h>
1.1       root       43: #include <kern/kern_types.h>
                     44: #include <kern/lock.h>
                     45: #include <kern/queue.h>
                     46: #include <kern/pc_sample.h>
                     47: #include <kern/processor.h>
                     48: #include <kern/syscall_emulation.h>
1.1.1.4   root       49: #include <vm/vm_types.h>
                     50: #include <machine/task.h>
1.1       root       51: 
1.1.1.5 ! root       52: /*
        !            53:  * Task name buffer size.  The size is chosen so that struct task fits
        !            54:  * into three cache lines.  The size of a cache line on a typical CPU
        !            55:  * is 64 bytes.
        !            56:  */
        !            57: #define TASK_NAME_SIZE 32
        !            58: 
1.1       root       59: struct task {
                     60:        /* Synchronization/destruction information */
                     61:        decl_simple_lock_data(,lock)    /* Task's lock */
                     62:        int             ref_count;      /* Number of references to me */
1.1.1.5 ! root       63: 
        !            64:        /* Flags */
        !            65:        unsigned int    active:1,       /* Task has not been terminated */
        !            66:        /* boolean_t */ may_assign:1,   /* can assigned pset be changed? */
        !            67:                        assign_active:1;        /* waiting for may_assign */
1.1       root       68: 
                     69:        /* Miscellaneous */
                     70:        vm_map_t        map;            /* Address space description */
                     71:        queue_chain_t   pset_tasks;     /* list of tasks assigned to pset */
                     72:        int             suspend_count;  /* Internal scheduling only */
                     73: 
                     74:        /* Thread information */
                     75:        queue_head_t    thread_list;    /* list of threads */
                     76:        int             thread_count;   /* number of threads */
                     77:        processor_set_t processor_set;  /* processor set for new threads */
                     78: 
                     79:        /* User-visible scheduling information */
                     80:        int             user_stop_count;        /* outstanding stops */
                     81:        int             priority;               /* for new threads */
                     82: 
                     83:        /* Statistics */
                     84:        time_value_t    total_user_time;
                     85:                                /* total user time for dead threads */
                     86:        time_value_t    total_system_time;
                     87:                                /* total system time for dead threads */
                     88: 
1.1.1.2   root       89:        time_value_t    creation_time; /* time stamp at creation */
                     90: 
1.1       root       91:        /* IPC structures */
                     92:        decl_simple_lock_data(, itk_lock_data)
                     93:        struct ipc_port *itk_self;      /* not a right, doesn't hold ref */
                     94:        struct ipc_port *itk_sself;     /* a send right */
                     95:        struct ipc_port *itk_exception; /* a send right */
                     96:        struct ipc_port *itk_bootstrap; /* a send right */
                     97:        struct ipc_port *itk_registered[TASK_PORT_REGISTER_MAX];
                     98:                                        /* all send rights */
                     99: 
                    100:        struct ipc_space *itk_space;
                    101: 
                    102:        /* User space system call emulation support */
                    103:        struct  eml_dispatch    *eml_dispatch;
                    104: 
                    105:        sample_control_t pc_sample;
                    106: 
                    107: #if    FAST_TAS
1.1.1.3   root      108: #define TASK_FAST_TAS_NRAS     8
1.1       root      109:        vm_offset_t     fast_tas_base[TASK_FAST_TAS_NRAS];
                    110:        vm_offset_t     fast_tas_end[TASK_FAST_TAS_NRAS];
                    111: #endif /* FAST_TAS */
                    112: 
1.1.1.4   root      113:        /* Hardware specific data.  */
                    114:        machine_task_t  machine;
                    115: 
                    116:        /* Statistics */
                    117:        natural_t       faults;         /* page faults counter */
                    118:        natural_t       zero_fills;     /* zero fill pages counter */
                    119:        natural_t       reactivations;  /* reactivated pages counter */
                    120:        natural_t       pageins;        /* actual pageins couter */
                    121:        natural_t       cow_faults;     /* copy-on-write faults counter */
                    122:        natural_t       messages_sent;  /* messages sent counter */
                    123:        natural_t       messages_received; /* messages received counter */
1.1.1.5 ! root      124: 
        !           125:        char    name[TASK_NAME_SIZE];
1.1       root      126: };
                    127: 
                    128: #define task_lock(task)                simple_lock(&(task)->lock)
                    129: #define task_unlock(task)      simple_unlock(&(task)->lock)
                    130: 
                    131: #define        itk_lock_init(task)     simple_lock_init(&(task)->itk_lock_data)
                    132: #define        itk_lock(task)          simple_lock(&(task)->itk_lock_data)
                    133: #define        itk_unlock(task)        simple_unlock(&(task)->itk_lock_data)
                    134: 
                    135: /*
                    136:  *     Exported routines/macros
                    137:  */
                    138: 
                    139: extern kern_return_t   task_create(
                    140:        task_t          parent_task,
                    141:        boolean_t       inherit_memory,
                    142:        task_t          *child_task);
                    143: extern kern_return_t   task_terminate(
                    144:        task_t          task);
                    145: extern kern_return_t   task_suspend(
                    146:        task_t          task);
                    147: extern kern_return_t   task_resume(
                    148:        task_t          task);
                    149: extern kern_return_t   task_threads(
                    150:        task_t          task,
                    151:        thread_array_t  *thread_list,
                    152:        natural_t       *count);
                    153: extern kern_return_t   task_info(
                    154:        task_t          task,
                    155:        int             flavor,
                    156:        task_info_t     task_info_out,
                    157:        natural_t       *task_info_count);
                    158: extern kern_return_t   task_get_special_port(
                    159:        task_t          task,
                    160:        int             which,
                    161:        struct ipc_port **portp);
                    162: extern kern_return_t   task_set_special_port(
                    163:        task_t          task,
                    164:        int             which,
                    165:        struct ipc_port *port);
                    166: extern kern_return_t   task_assign(
                    167:        task_t          task,
                    168:        processor_set_t new_pset,
                    169:        boolean_t       assign_threads);
                    170: extern kern_return_t   task_assign_default(
                    171:        task_t          task,
                    172:        boolean_t       assign_threads);
1.1.1.5 ! root      173: extern kern_return_t   task_set_name(
        !           174:        task_t                  task,
        !           175:        kernel_debug_name_t     name);
1.1.1.4   root      176: extern void consider_task_collect(void);
1.1       root      177: 
                    178: /*
                    179:  *     Internal only routines
                    180:  */
                    181: 
1.1.1.4   root      182: extern void            task_init(void);
                    183: extern void            task_reference(task_t);
                    184: extern void            task_deallocate(task_t);
1.1.1.5 ! root      185: extern void            task_hold_locked(task_t);
1.1.1.4   root      186: extern kern_return_t   task_hold(task_t);
                    187: extern kern_return_t   task_dowait(task_t, boolean_t);
                    188: extern kern_return_t   task_release(task_t);
1.1       root      189: 
                    190: extern task_t  kernel_task;
                    191: 
1.1.1.3   root      192: #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.