Annotation of kernel/kern/task.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
                      3:  *
                      4:  * @APPLE_LICENSE_HEADER_START@
                      5:  * 
                      6:  * Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
                      7:  * Reserved.  This file contains Original Code and/or Modifications of
                      8:  * Original Code as defined in and that are subject to the Apple Public
                      9:  * Source License Version 1.1 (the "License").  You may not use this file
                     10:  * except in compliance with the License.  Please obtain a copy of the
                     11:  * License at http://www.apple.com/publicsource and read it before using
                     12:  * this file.
                     13:  * 
                     14:  * The Original Code and all software distributed under the License are
                     15:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
                     16:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
                     17:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
                     18:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
                     19:  * License for the specific language governing rights and limitations
                     20:  * under the License.
                     21:  * 
                     22:  * @APPLE_LICENSE_HEADER_END@
                     23:  */
                     24: 
                     25: /* 
                     26:  * Mach Operating System
                     27:  * Copyright (c) 1993-1988 Carnegie Mellon University
                     28:  * All Rights Reserved.
                     29:  * 
                     30:  * Permission to use, copy, modify and distribute this software and its
                     31:  * documentation is hereby granted, provided that both the copyright
                     32:  * notice and this permission notice appear in all copies of the
                     33:  * software, derivative works or modified versions, and any portions
                     34:  * thereof, and that both notices appear in supporting documentation.
                     35:  * 
                     36:  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
                     37:  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
                     38:  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
                     39:  * 
                     40:  * Carnegie Mellon requests users of this software to return to
                     41:  * 
                     42:  *  Software Distribution Coordinator  or  [email protected]
                     43:  *  School of Computer Science
                     44:  *  Carnegie Mellon University
                     45:  *  Pittsburgh PA 15213-3890
                     46:  * 
                     47:  * any improvements or extensions that they make and grant Carnegie Mellon
                     48:  * the rights to redistribute these changes.
                     49:  */
                     50: /*
                     51:  *     File:   task.h
                     52:  *     Author: Avadis Tevanian, Jr.
                     53:  *
                     54:  *     This file contains the structure definitions for tasks.
                     55:  *
                     56:  */
                     57: 
                     58: #ifndef        _KERN_TASK_H_
                     59: #define _KERN_TASK_H_
                     60: 
                     61: #import <mach/features.h>
                     62: 
                     63: #include <mach/boolean.h>
                     64: #include <mach/port.h>
                     65: #include <mach/time_value.h>
                     66: #include <mach/mach_param.h>
                     67: #include <mach/task_info.h>
                     68: #include <kern/kern_types.h>
                     69: #include <kern/lock.h>
                     70: #include <kern/queue.h>
                     71: #include <kern/processor.h>
                     72: #include <vm/vm_map.h>
                     73: 
                     74: struct task {
                     75:        /* Synchronization/destruction information */
                     76:        decl_simple_lock_data(,lock)    /* Task's lock */
                     77:        int             ref_count;      /* Number of references to me */
                     78:        boolean_t       active;         /* Task has not been terminated */
                     79: 
                     80:        /* Miscellaneous */
                     81:        vm_map_t        map;            /* Address space description */
                     82:        queue_chain_t   pset_tasks;     /* list of tasks assigned to pset */
                     83:        int             suspend_count;  /* Internal scheduling only */
                     84: 
                     85:        /* Thread information */
                     86:        queue_head_t    thread_list;    /* list of threads */
                     87:        int             thread_count;   /* number of threads */
                     88:        decl_simple_lock_data(,thread_list_lock) /* XXX thread_list lock */
                     89:        processor_set_t processor_set;  /* processor set for new threads */
                     90:        boolean_t       may_assign;     /* can assigned pset be changed? */
                     91:        boolean_t       assign_active;  /* waiting for may_assign */
                     92: 
                     93:        /* Garbage */
                     94:        struct proc     *proc;          /* corresponding process */
                     95: 
                     96:        /* Task-wide thread context information */
                     97:        struct
                     98:            pcb_common  *pcb_common;
                     99: 
                    100:        /* User-visible scheduling information */
                    101:        int             user_stop_count;        /* outstanding stops */
                    102:        int             priority;               /* for new threads */
                    103: 
                    104:        /* Information for kernel-internal tasks */
                    105:        boolean_t       kernel_privilege; /* Is a kernel task */
                    106:        boolean_t       kernel_vm_space; /* Uses kernel's pmap? */
                    107: 
                    108:        /* Statistics */
                    109:        time_value_t    total_user_time;
                    110:                                /* total user time for dead threads */
                    111:        time_value_t    total_system_time;
                    112:                                /* total system time for dead threads */
                    113: 
                    114:        /* IPC structures */
                    115:        decl_simple_lock_data(, itk_lock_data)
                    116:        struct ipc_port *itk_self;      /* not a right, doesn't hold ref */
                    117:        struct ipc_port *itk_sself;     /* a send right */
                    118:        struct ipc_port *itk_exception; /* a send right */
                    119:        struct ipc_port *itk_bootstrap; /* a send right */
                    120:        struct ipc_port *itk_registered[TASK_PORT_REGISTER_MAX];
                    121:                                        /* all send rights */
                    122: 
                    123:        struct ipc_space *itk_space;
                    124: 
                    125: #if    NORMA_TASK
                    126:        long            child_node;     /* if != -1, node for new children */
                    127: #endif /* NORMA_TASK */
                    128: };
                    129: 
                    130: #define task_lock(task)                simple_lock(&(task)->lock)
                    131: #define task_unlock(task)      simple_unlock(&(task)->lock)
                    132: 
                    133: #define        itk_lock_init(task)     simple_lock_init(&(task)->itk_lock_data)
                    134: #define        itk_lock(task)          simple_lock(&(task)->itk_lock_data)
                    135: #define        itk_unlock(task)        simple_unlock(&(task)->itk_lock_data)
                    136: 
                    137: #define ipc_task_lock(t)       simple_lock(&(t)->ipc_translation_lock)
                    138: #define ipc_task_unlock(t)     simple_unlock(&(t)->ipc_translation_lock)
                    139: 
                    140: /*
                    141:  *     Exported routines/macros
                    142:  */
                    143: 
                    144: extern kern_return_t   task_create();
                    145: extern kern_return_t   task_terminate();
                    146: extern kern_return_t   task_suspend();
                    147: extern kern_return_t   task_resume();
                    148: extern kern_return_t   task_threads();
                    149: extern kern_return_t   task_ports();
                    150: extern kern_return_t   task_info();
                    151: extern kern_return_t   task_get_special_port();
                    152: extern kern_return_t   task_set_special_port();
                    153: extern kern_return_t   task_assign();
                    154: extern kern_return_t   task_assign_default();
                    155: 
                    156: /*
                    157:  *     Internal only routines
                    158:  */
                    159: 
                    160: extern void            task_init();
                    161: extern void            task_reference();
                    162: extern void            task_deallocate();
                    163: extern kern_return_t   task_hold();
                    164: extern kern_return_t   task_dowait();
                    165: extern kern_return_t   task_release();
                    166: extern kern_return_t   task_halt();
                    167: 
                    168: extern kern_return_t   task_suspend_nowait();
                    169: extern task_t          kernel_task_create();
                    170: 
                    171: extern task_t  kernel_task;
                    172: 
                    173: #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.