Module Name:    src
Committed By:   kamil
Date:           Mon Nov 21 03:02:34 UTC 2016

Modified Files:
        src/lib/libpthread_dbg: pthread_dbg.c pthread_dbg.h

Log Message:
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>


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/lib/libpthread_dbg/pthread_dbg.c
cvs rdiff -u -r1.7 -r1.8 src/lib/libpthread_dbg/pthread_dbg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libpthread_dbg/pthread_dbg.c
diff -u src/lib/libpthread_dbg/pthread_dbg.c:1.48 src/lib/libpthread_dbg/pthread_dbg.c:1.49
--- src/lib/libpthread_dbg/pthread_dbg.c:1.48	Sun Nov 20 21:49:24 2016
+++ src/lib/libpthread_dbg/pthread_dbg.c	Mon Nov 21 03:02:34 2016
@@ -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_thre
 	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 
 			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 
 			return val;
 		break;
 	case PT_STATE_ZOMBIE:
+	case PT_STATE_DEAD:
 	default:
 		return TD_ERR_BADTHREAD;
 	}

Index: src/lib/libpthread_dbg/pthread_dbg.h
diff -u src/lib/libpthread_dbg/pthread_dbg.h:1.7 src/lib/libpthread_dbg/pthread_dbg.h:1.8
--- src/lib/libpthread_dbg/pthread_dbg.h:1.7	Sat Oct 22 18:04:40 2016
+++ src/lib/libpthread_dbg/pthread_dbg.h	Mon Nov 21 03:02:34 2016
@@ -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

Reply via email to