Kill SA thread states (TD_STATE_*) in pthread_dbg and add TD_STATE_DEAD

Scheduler Activation types were removed in NetBSD 5.0. Old type set is not
matching the new world POSIX threads library.

Only TD_STATE_RUNNING, TD_STATE_ZOMBIE are still applicable - keep it.

Keep TD_STATE_UNKNOWN as generic unrecognized type.

Add new TD_STATE_DEAD one. The TD_STATE_DEAD type is represented by number
6 in the POSIX threads library, but for the sake of compatibility with
older software using pthread_dbg - renumber it to 7, as six was reserved
for TD_STATE_SUSPENDED.

Old removed state types are marked as reserved and unused.

Sponsored by <The NetBSD Foundation>
This commit is contained in:
kamil 2016-11-21 03:02:34 +00:00
parent fa99ca920a
commit 2bd33bc337
2 changed files with 13 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: pthread_dbg.c,v 1.48 2016/11/20 21:49:24 kamil Exp $ */
/* $NetBSD: pthread_dbg.c,v 1.49 2016/11/21 03:02:34 kamil Exp $ */
/*-
* Copyright (c) 2002 Wasabi Systems, Inc.
@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: pthread_dbg.c,v 1.48 2016/11/20 21:49:24 kamil Exp $");
__RCSID("$NetBSD: pthread_dbg.c,v 1.49 2016/11/21 03:02:34 kamil Exp $");
#define __EXPOSE_STACK 1
@ -225,14 +225,12 @@ td_thr_info(td_thread_t *thread, td_thread_info_t *info)
case PT_STATE_RUNNING:
info->thread_state = TD_STATE_RUNNING;
break;
#ifdef XXXLWP
case PT_STATE_SUSPENDED:
info->thread_state = TD_STATE_SUSPENDED;
break;
#endif
case PT_STATE_ZOMBIE:
info->thread_state = TD_STATE_ZOMBIE;
break;
case PT_STATE_DEAD:
info->thread_state = TD_STATE_DEAD;
break;
default:
info->thread_state = TD_STATE_UNKNOWN;
}
@ -306,6 +304,7 @@ td_thr_getregs(td_thread_t *thread, int regset, void *buf)
return val;
break;
case PT_STATE_ZOMBIE:
case PT_STATE_DEAD:
default:
return TD_ERR_BADTHREAD;
}
@ -333,6 +332,7 @@ td_thr_setregs(td_thread_t *thread, int regset, void *buf)
return val;
break;
case PT_STATE_ZOMBIE:
case PT_STATE_DEAD:
default:
return TD_ERR_BADTHREAD;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: pthread_dbg.h,v 1.7 2016/10/22 18:04:40 skrll Exp $ */
/* $NetBSD: pthread_dbg.h,v 1.8 2016/11/21 03:02:34 kamil Exp $ */
/*-
* Copyright (c) 2002 Wasabi Systems, Inc.
@ -77,11 +77,12 @@ typedef struct td_thread_info_st {
#define TD_STATE_UNKNOWN 0
#define TD_STATE_RUNNING 1 /* On a processor */
#define TD_STATE_RUNNABLE 2 /* On a run queue */
#define TD_STATE_BLOCKED 3 /* Blocked in the kernel */
#define TD_STATE_SLEEPING 4 /* Blocked on a sync object */
#define TD_STATE_UNUSED2 2 /* former TD_STATE_RUNNABLE for SA */
#define TD_STATE_UNUSED3 3 /* former TD_STATE_BLOCKED for SA */
#define TD_STATE_UNUSED4 4 /* former TD_STATE_SLEEPING for SA */
#define TD_STATE_ZOMBIE 5
#define TD_STATE_SUSPENDED 6 /* Removed from run queues */
#define TD_STATE_UNUSED6 6 /* former TD_STATE_SUSPENDED for SA */
#define TD_STATE_DEAD 7
#define TD_TYPE_UNKNOWN 0
#define TD_TYPE_USER 1