X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/43866e378188c25dd1e2208016ab3cbeb086ae6c..4452a7af2eac33dbad800bcc91f2399d62c18f53:/osfmk/ddb/db_task_thread.c?ds=sidebyside diff --git a/osfmk/ddb/db_task_thread.c b/osfmk/ddb/db_task_thread.c index 765382c97..01eca330e 100644 --- a/osfmk/ddb/db_task_thread.c +++ b/osfmk/ddb/db_task_thread.c @@ -1,16 +1,19 @@ /* * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. * - * @APPLE_LICENSE_HEADER_START@ - * - * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER @@ -20,80 +23,11 @@ * Please see the License for the specific language governing rights and * limitations under the License. * - * @APPLE_LICENSE_HEADER_END@ + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ /* * @OSF_COPYRIGHT@ */ -/* - * HISTORY - * - * Revision 1.1.1.1 1998/09/22 21:05:48 wsanchez - * Import of Mac OS X kernel (~semeria) - * - * Revision 1.1.1.1 1998/03/07 02:26:09 wsanchez - * Import of OSF Mach kernel (~mburg) - * - * Revision 1.1.16.3 1996/01/09 19:16:26 devrcs - * Make db_lookup_task_id() globally available (remove static). - * Changed declarations of 'register foo' to 'register int foo'. - * [1995/12/01 21:42:37 jfraser] - * - * Merged '64-bit safe' changes from DEC alpha port. - * [1995/11/21 18:03:48 jfraser] - * - * Revision 1.1.16.2 1994/09/23 01:21:59 ezf - * change marker to not FREE - * [1994/09/22 21:11:09 ezf] - * - * Revision 1.1.16.1 1994/06/11 21:12:29 bolinger - * Merge up to NMK17.2. - * [1994/06/11 20:02:43 bolinger] - * - * Revision 1.1.14.1 1994/02/08 10:59:02 bernadat - * Added support of DB_VAR_SHOW. - * [93/08/12 paire] - * [94/02/08 bernadat] - * - * Revision 1.1.12.3 1994/03/17 22:35:35 dwm - * The infamous name change: thread_activation + thread_shuttle = thread. - * [1994/03/17 21:25:50 dwm] - * - * Revision 1.1.12.2 1994/01/17 18:08:54 dwm - * Add patchable integer force_act_lookup to force successful - * lookup, to allow stack trace on orphaned act/thread pairs. - * [1994/01/17 16:06:50 dwm] - * - * Revision 1.1.12.1 1994/01/12 17:50:52 dwm - * Coloc: initial restructuring to follow Utah model. - * [1994/01/12 17:13:23 dwm] - * - * Revision 1.1.3.3 1993/07/27 18:28:15 elliston - * Add ANSI prototypes. CR #9523. - * [1993/07/27 18:13:06 elliston] - * - * Revision 1.1.3.2 1993/06/02 23:12:39 jeffc - * Added to OSF/1 R1.3 from NMK15.0. - * [1993/06/02 20:57:24 jeffc] - * - * Revision 1.1 1992/09/30 02:01:27 robert - * Initial revision - * - * $EndLog$ - */ -/* CMU_HIST */ -/* - * Revision 2.2 91/10/09 16:03:04 af - * Revision 2.1.3.1 91/10/05 13:07:50 jeffreyh - * Created for task/thread handling. - * [91/08/29 tak] - * - * Revision 2.1.3.1 91/10/05 13:07:50 jeffreyh - * Created for task/thread handling. - * [91/08/29 tak] - * - */ -/* CMU_ENDHIST */ /* * Mach Operating System * Copyright (c) 1991,1990 Carnegie Mellon University @@ -141,8 +75,8 @@ #define DB_MAX_THREADID 0x10000 /* max # of threads in a task */ #define DB_MAX_PSETS 0x10000 /* max # of processor sets */ -task_t db_default_task; /* default target task */ -thread_act_t db_default_act; /* default target thr_act */ +task_t db_default_task = TASK_NULL; /* default target task */ +thread_t db_default_act = THREAD_NULL; /* default target thr_act */ @@ -150,7 +84,7 @@ thread_act_t db_default_act; /* default target thr_act */ */ task_t db_lookup_task_id(register int task_id); -static thread_act_t db_lookup_act_id( +static thread_t db_lookup_act_id( task_t task, register int thread_id); @@ -187,15 +121,15 @@ db_lookup_task(task_t target_task) int db_lookup_task_act( task_t task, - thread_act_t target_act) + thread_t target_act) { - register thread_act_t thr_act; + register thread_t thr_act; register int act_id; act_id = 0; - if (queue_first(&task->thr_acts) == 0) + if (queue_first(&task->threads) == 0) return(-1); - queue_iterate(&task->thr_acts, thr_act, thread_act_t, thr_acts) { + queue_iterate(&task->threads, thr_act, thread_t, task_threads) { if (target_act == thr_act) return(act_id); if (act_id++ >= DB_MAX_THREADID) @@ -209,7 +143,7 @@ db_lookup_task_act( * as the thread id. */ int -db_lookup_act(thread_act_t target_act) +db_lookup_act(thread_t target_act) { register int act_id; register task_t task; @@ -224,7 +158,7 @@ db_lookup_act(thread_act_t target_act) queue_iterate(&pset->tasks, task, task_t, pset_tasks) { if (ntask++ > DB_MAX_TASKID) return(-1); - if (task->thr_act_count == 0) + if (task->thread_count == 0) continue; act_id = db_lookup_task_act(task, target_act); if (act_id >= 0) @@ -238,7 +172,7 @@ db_lookup_act(thread_act_t target_act) */ int force_act_lookup = 0; boolean_t -db_check_act_address_valid(thread_act_t thr_act) +db_check_act_address_valid(thread_t thr_act) { if (!force_act_lookup && db_lookup_act(thr_act) < 0) { db_printf("Bad thr_act address 0x%x\n", thr_act); @@ -274,23 +208,23 @@ db_lookup_task_id(register task_id) /* * convert (task_id, act_id) pair to thr_act address */ -static thread_act_t +static thread_t db_lookup_act_id( task_t task, register int act_id) { - register thread_act_t thr_act; + register thread_t thr_act; if (act_id > DB_MAX_THREADID) - return(THR_ACT_NULL); - if (queue_first(&task->thr_acts) == 0) - return(THR_ACT_NULL); - queue_iterate(&task->thr_acts, thr_act, thread_act_t, thr_acts) { + return(THREAD_NULL); + if (queue_first(&task->threads) == 0) + return(THREAD_NULL); + queue_iterate(&task->threads, thr_act, thread_t, task_threads) { if (act_id-- <= 0) return(thr_act); } - return(THR_ACT_NULL); + return(THREAD_NULL); } /* @@ -299,15 +233,15 @@ db_lookup_act_id( */ boolean_t db_get_next_act( - thread_act_t *actp, + thread_t *actp, int position) { db_expr_t value; - thread_act_t thr_act; + thread_t thr_act; - *actp = THR_ACT_NULL; + *actp = THREAD_NULL; if (db_expression(&value)) { - thr_act = (thread_act_t) value; + thr_act = (thread_t) value; if (!db_check_act_address_valid(thr_act)) { db_flush_lex(); return(FALSE); @@ -328,7 +262,7 @@ void db_init_default_act(void) { if (db_lookup_act(db_default_act) < 0) { - db_default_act = THR_ACT_NULL; + db_default_act = THREAD_NULL; db_default_task = TASK_NULL; } else db_default_task = db_default_act->task; @@ -345,7 +279,7 @@ db_set_default_act( int flag, db_var_aux_param_t ap) /* unused */ { - thread_act_t thr_act; + thread_t thr_act; int task_id; int act_id; @@ -365,8 +299,8 @@ db_set_default_act( *valuep = (db_expr_t) db_default_act; return(0); } - thr_act = (thread_act_t) *valuep; - if (thr_act != THR_ACT_NULL && !db_check_act_address_valid(thr_act)) + thr_act = (thread_t) *valuep; + if (thr_act != THREAD_NULL && !db_check_act_address_valid(thr_act)) db_error(0); /* NOTREACHED */ db_default_act = thr_act; @@ -386,7 +320,7 @@ db_get_task_act( db_var_aux_param_t ap) { task_t task; - thread_act_t thr_act; + thread_t thr_act; int task_id; if (flag == DB_VAR_SHOW) { @@ -410,7 +344,7 @@ db_get_task_act( *valuep = (db_expr_t) task; return(0); } - if ((thr_act = db_lookup_act_id(task, ap->suffix[1])) == THR_ACT_NULL){ + if ((thr_act = db_lookup_act_id(task, ap->suffix[1])) == THREAD_NULL){ db_printf("no such thr_act($task%d.%d)\n", ap->suffix[0], ap->suffix[1]); db_error(0);