Annotation of XNU/osfmk/kern/mk_sp.h, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
        !             3:  *
        !             4:  * @APPLE_LICENSE_HEADER_START@
        !             5:  * 
        !             6:  * The contents of this file constitute Original Code as defined in and
        !             7:  * are subject to the Apple Public Source License Version 1.1 (the
        !             8:  * "License").  You may not use this file except in compliance with the
        !             9:  * License.  Please obtain a copy of the License at
        !            10:  * http://www.apple.com/publicsource and read it before using this file.
        !            11:  * 
        !            12:  * This Original Code and all software distributed under the License are
        !            13:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
        !            14:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
        !            15:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
        !            16:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
        !            17:  * License for the specific language governing rights and limitations
        !            18:  * under the License.
        !            19:  * 
        !            20:  * @APPLE_LICENSE_HEADER_END@
        !            21:  */
        !            22: /*
        !            23:  * @OSF_COPYRIGHT@
        !            24:  * 
        !            25:  */
        !            26: 
        !            27: #ifndef        _MK_SP_H_
        !            28: #define _MK_SP_H_
        !            29: 
        !            30: /*
        !            31: * Include Files
        !            32: */
        !            33: 
        !            34: #include <kern/counters.h>
        !            35: 
        !            36: /*
        !            37:  * Scheduling policy operation prototypes
        !            38:  */
        !            39: 
        !            40: sf_return_t    _mk_sp_init(
        !            41:                                sf_object_t                     policy,
        !            42:                                int                                     policy_id,
        !            43:                                int                                     priority_mask_length,
        !            44:                                sf_priority_mask         *priority_mask);
        !            45: 
        !            46: sf_return_t    _mk_sp_enable_processor_set(
        !            47:                                sf_object_t                     policy,
        !            48:                                processor_set_t         processor_set);
        !            49: 
        !            50: sf_return_t    _mk_sp_disable_processor_set(
        !            51:                                sf_object_t                     policy,
        !            52:                                processor_set_t         processor_set);
        !            53: 
        !            54: sf_return_t    _mk_sp_enable_processor(
        !            55:                                sf_object_t                     policy,
        !            56:                                processor_t                     processor);
        !            57: 
        !            58: sf_return_t    _mk_sp_disable_processor(
        !            59:                                sf_object_t                     policy,
        !            60:                                processor_t                     processor);
        !            61: 
        !            62: sf_return_t    _mk_sp_thread_update_mpri(
        !            63:                                sf_object_t                     policy,
        !            64:                                sched_thread_t          thread);
        !            65: 
        !            66: sf_return_t    _mk_sp_thread_unblock(
        !            67:                                sf_object_t                     policy,
        !            68:                                sched_thread_t          thread);
        !            69: 
        !            70: sf_return_t    _mk_sp_thread_done(
        !            71:                                sf_object_t                     policy,
        !            72:                                sched_thread_t          old_thread);
        !            73: 
        !            74: sf_return_t    _mk_sp_thread_begin(
        !            75:                                sf_object_t                     policy,
        !            76:                                sched_thread_t          new_thread);
        !            77: 
        !            78: sf_return_t    _mk_sp_thread_dispatch(
        !            79:                                sf_object_t                     policy,
        !            80:                                sched_thread_t          old_thread);
        !            81: 
        !            82: sf_return_t    _mk_sp_thread_attach(
        !            83:                                sf_object_t                     policy,
        !            84:                                sched_thread_t          thread);
        !            85: 
        !            86: sf_return_t    _mk_sp_thread_detach(
        !            87:                                sf_object_t                     policy,
        !            88:                                sched_thread_t          thread);
        !            89: 
        !            90: sf_return_t    _mk_sp_thread_processor(
        !            91:                                sf_object_t                     policy,
        !            92:                                sched_thread_t          *thread,
        !            93:                                processor_t                     processor);
        !            94: 
        !            95: sf_return_t    _mk_sp_thread_processor_set(
        !            96:                                sf_object_t                     policy,
        !            97:                                sched_thread_t          thread,
        !            98:                                processor_set_t         processor_set);
        !            99: 
        !           100: sf_return_t    _mk_sp_thread_set(
        !           101:                                sf_object_t                     policy,
        !           102:                                sched_thread_t          thread,
        !           103:                                sp_attributes_t         policy_attributes);
        !           104: 
        !           105: sf_return_t    _mk_sp_thread_get(
        !           106:                                sf_object_t                             policy,
        !           107:                                sched_thread_t                  thread,
        !           108:                                sp_attributes_t                 policy_attributes,
        !           109:                                sp_attributes_size_t    size);
        !           110: 
        !           111: int                    _mk_sp_db_print_sched_stats(
        !           112:                                sf_object_t                     policy,
        !           113:                                sched_thread_t          thread);
        !           114: 
        !           115: void           _mk_sp_swtch_pri(
        !           116:                                sf_object_t                     policy,
        !           117:                                int                                     pri);
        !           118: 
        !           119: kern_return_t  _mk_sp_thread_switch(
        !           120:                                        sf_object_t                     policy,
        !           121:                                        thread_act_t            hint_act,
        !           122:                                        int                                     option,
        !           123:                                        mach_msg_timeout_t      option_time);
        !           124: 
        !           125: kern_return_t  _mk_sp_thread_depress_abort(
        !           126:                                        sf_object_t                     policy,
        !           127:                                        sched_thread_t          thread);
        !           128: 
        !           129: void           _mk_sp_thread_depress_timeout(
        !           130:                                        sf_object_t                     policy,
        !           131:                                        thread_t                        thread);
        !           132: 
        !           133: sf_return_t    _mk_sp_task_attach(
        !           134:                                        sf_object_t                     policy,
        !           135:                                        task_t                          task);
        !           136: 
        !           137: sf_return_t    _mk_sp_task_detach(
        !           138:                                        sf_object_t                     policy,
        !           139:                                        task_t                          task);
        !           140: 
        !           141: kern_return_t  _mk_sp_task_policy(
        !           142:                                        sf_object_t                             policy,
        !           143:                                        task_t                                  task,
        !           144:                                        policy_t                                policy_id,
        !           145:                                        policy_base_t                   base,
        !           146:                                        mach_msg_type_number_t  count,
        !           147:                                        boolean_t                               set_limit,
        !           148:                                        boolean_t                               change,
        !           149:                                        policy_limit_t                  *limit_ptr,
        !           150:                                        int                                             *lc_ptr);
        !           151: 
        !           152: kern_return_t  _mk_sp_task_set_policy(
        !           153:                                        sf_object_t                             policy,
        !           154:                                        task_t                                  task,
        !           155:                                        processor_set_t                 pset,
        !           156:                                        policy_t                                policy_id,
        !           157:                                        policy_base_t                   base,
        !           158:                                        mach_msg_type_number_t  base_count,
        !           159:                                        policy_limit_t                  limit,
        !           160:                                        mach_msg_type_number_t  limit_count,
        !           161:                                        boolean_t                               change);
        !           162: 
        !           163: kern_return_t  _mk_sp_task_set_sched(
        !           164:                                        sf_object_t                             policy,
        !           165:                                        task_t                                  task,
        !           166:                                        policy_t                                policy_id,
        !           167:                                        sched_attr_t                    sched_attr,
        !           168:                                        mach_msg_type_number_t  sched_attrCnt,
        !           169:                                        boolean_t                               set_limit,
        !           170:                                        boolean_t                               change);
        !           171: 
        !           172: kern_return_t  _mk_sp_task_get_sched(
        !           173:                                        sf_object_t                             policy,
        !           174:                                        task_t                                  task,
        !           175:                                        policy_t                                policy_id,
        !           176:                                        sched_attr_t                    sched_attr,
        !           177:                                        mach_msg_type_number_t  sched_attrCnt,
        !           178:                                        mach_msg_type_number_t  sched_attr_size);
        !           179: 
        !           180: boolean_t      _mk_sp_thread_runnable(
        !           181:                                        sf_object_t                     policy,
        !           182:                                        sched_thread_t          thread);
        !           183: 
        !           184: sf_return_t    _mk_sp_alarm_expired(
        !           185:                                        sf_object_t                     policy,
        !           186:                                        long                            alarm_seqno,
        !           187:                                        kern_return_t           result,
        !           188:                                        int                                     alarm_type,
        !           189:                                        mach_timespec_t         wakeup_time,
        !           190:                                        void                            *alarm_data);
        !           191: 
        !           192: /*
        !           193:  * Type definitions
        !           194:  */
        !           195: typedef int    mk_sp_state_t;
        !           196: 
        !           197: #define        MK_SP_ATTACHED  ( 0x0001 )
        !           198: #define        MK_SP_RUNNABLE  ( 0x0002 )
        !           199: #define        MK_SP_BLOCKED   ( 0x0004 )
        !           200: 
        !           201: /*
        !           202:  * MK Scheduling Policy per-thread scheduling information
        !           203:  */
        !           204: 
        !           205: typedef struct mk_sp_info {
        !           206:        mk_sp_state_t   th_state;               /* thread state */
        !           207:        int                             priority;               /* thread's priority *//*** ???base?**/
        !           208:        int                             max_priority;   /* maximum priority */
        !           209:        int                             sched_data;             /* for use by policy */
        !           210:        int                             policy;                 /* scheduling policy */
        !           211:        int                             depress_priority; /* depressed from this priority */
        !           212:        unsigned int    cpu_usage;              /* exp. decaying cpu usage [%cpu] */
        !           213:        unsigned int    sched_usage;    /* load-weighted cpu usage [sched] */
        !           214:        unsigned int    sched_stamp;    /* last time priority was updated */
        !           215:        int                             unconsumed_quantum; /* leftover quantum (RR/FIFO) */
        !           216: #ifdef MACH_ASSERT
        !           217:        /* counters tracking number of calls to policy routines */
        !           218:        unsigned int    c_mk_sp_thread_attach;
        !           219:        unsigned int    c_mk_sp_thread_detach;
        !           220:        unsigned int    c_mk_sp_thread_begin;
        !           221:        unsigned int    c_mk_sp_thread_done;
        !           222:        unsigned int    c_mk_sp_thread_dispatch;
        !           223:        unsigned int    c_mk_sp_thread_unblock;
        !           224:        unsigned int    c_mk_sp_thread_set;
        !           225:        unsigned int    c_mk_sp_thread_get;
        !           226:        unsigned int    c_mk_sp_thread_runnable;
        !           227:        unsigned int    c_mk_sp_alarm_expired;
        !           228: #endif /* MACH_ASSERT */
        !           229: } mk_sp_info_struct_t, *mk_sp_info_t;
        !           230: 
        !           231: #define        MK_SP_INFO_NULL         ((mk_sp_info_t) NULL)
        !           232: 
        !           233: /*
        !           234:  * Definitions of standard scheduling operations for this policy
        !           235:  */
        !           236: extern sp_ops_t                mk_sp_ops;
        !           237: 
        !           238: extern mach_counter_t  c_mk_sp_init,
        !           239:                        c_mk_sp_enable_processor_set,
        !           240:                        c_mk_sp_disable_processor_set,
        !           241:                        c_mk_sp_enable_processor,
        !           242:                        c_mk_sp_disable_processor,
        !           243:                        c_mk_sp_thread_update_mpri,
        !           244:                        c_mk_sp_thread_unblock,
        !           245:                        c_mk_sp_thread_done,
        !           246:                        c_mk_sp_thread_begin,
        !           247:                        c_mk_sp_thread_dispatch,
        !           248:                        c_mk_sp_thread_attach,
        !           249:                        c_mk_sp_thread_detach,
        !           250:                        c_mk_sp_thread_processor,
        !           251:                        c_mk_sp_thread_processor_set,
        !           252:                        c_mk_sp_thread_set,
        !           253:                        c_mk_sp_thread_get,
        !           254:                        c_mk_sp_db_print_sched_stats,
        !           255:                        c_mk_sp_swtch_pri,
        !           256:                        c_mk_sp_thread_switch,
        !           257:                        c_mk_sp_thread_depress_abort,
        !           258:                        c_mk_sp_thread_depress_timeout,
        !           259:                        c_mk_sp_task_attach,
        !           260:                        c_mk_sp_task_detach,
        !           261:                        c_mk_sp_task_policy,
        !           262:                        c_mk_sp_task_set_policy,
        !           263:                        c_mk_sp_task_set_sched,
        !           264:                        c_mk_sp_task_get_sched,
        !           265:                        c_mk_sp_thread_runnable,
        !           266:                        c_mk_sp_alarm_expired;
        !           267: 
        !           268: #endif /* _MK_SP_H_ */

unix.superglobalmegacorp.com

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