| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: db_xxx.c,v 1.64 2011/06/12 03:35:51 rmind Exp $ */ | | 1 | /* $NetBSD: db_xxx.c,v 1.65 2011/12/02 23:57:58 christos Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1982, 1986, 1989, 1991, 1993 | | 4 | * Copyright (c) 1982, 1986, 1989, 1991, 1993 |
5 | * The Regents of the University of California. All rights reserved. | | 5 | * The Regents of the University of California. All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -27,27 +27,27 @@ | | | @@ -27,27 +27,27 @@ |
27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
29 | * SUCH DAMAGE. | | 29 | * SUCH DAMAGE. |
30 | * | | 30 | * |
31 | * from: kern_proc.c 8.4 (Berkeley) 1/4/94 | | 31 | * from: kern_proc.c 8.4 (Berkeley) 1/4/94 |
32 | */ | | 32 | */ |
33 | | | 33 | |
34 | /* | | 34 | /* |
35 | * Miscellaneous DDB functions that are intimate (xxx) with various | | 35 | * Miscellaneous DDB functions that are intimate (xxx) with various |
36 | * data structures and functions used by the kernel (proc, callout). | | 36 | * data structures and functions used by the kernel (proc, callout). |
37 | */ | | 37 | */ |
38 | | | 38 | |
39 | #include <sys/cdefs.h> | | 39 | #include <sys/cdefs.h> |
40 | __KERNEL_RCSID(0, "$NetBSD: db_xxx.c,v 1.64 2011/06/12 03:35:51 rmind Exp $"); | | 40 | __KERNEL_RCSID(0, "$NetBSD: db_xxx.c,v 1.65 2011/12/02 23:57:58 christos Exp $"); |
41 | | | 41 | |
42 | #ifdef _KERNEL_OPT | | 42 | #ifdef _KERNEL_OPT |
43 | #include "opt_kgdb.h" | | 43 | #include "opt_kgdb.h" |
44 | #include "opt_aio.h" | | 44 | #include "opt_aio.h" |
45 | #include "opt_mqueue.h" | | 45 | #include "opt_mqueue.h" |
46 | #endif | | 46 | #endif |
47 | | | 47 | |
48 | #ifndef _KERNEL | | 48 | #ifndef _KERNEL |
49 | #include <stdbool.h> | | 49 | #include <stdbool.h> |
50 | #endif | | 50 | #endif |
51 | | | 51 | |
52 | #include <sys/param.h> | | 52 | #include <sys/param.h> |
53 | #include <sys/systm.h> | | 53 | #include <sys/systm.h> |
| @@ -96,28 +96,31 @@ db_kill_proc(db_expr_t addr, bool haddr, | | | @@ -96,28 +96,31 @@ db_kill_proc(db_expr_t addr, bool haddr, |
96 | if (t == tCOMMA) { | | 96 | if (t == tCOMMA) { |
97 | if (!db_expression(&sig)) { | | 97 | if (!db_expression(&sig)) { |
98 | db_error("sig?\n"); | | 98 | db_error("sig?\n"); |
99 | /*NOTREACHED*/ | | 99 | /*NOTREACHED*/ |
100 | } | | 100 | } |
101 | } else { | | 101 | } else { |
102 | db_unread_token(t); | | 102 | db_unread_token(t); |
103 | sig = 15; | | 103 | sig = 15; |
104 | } | | 104 | } |
105 | if (db_read_token() != tEOL) { | | 105 | if (db_read_token() != tEOL) { |
106 | db_error("?\n"); | | 106 | db_error("?\n"); |
107 | /*NOTREACHED*/ | | 107 | /*NOTREACHED*/ |
108 | } | | 108 | } |
109 | | | 109 | /* We might stop when the mutex is held or when not */ |
| | | 110 | t = mutex_tryenter(proc_lock); |
110 | p = proc_find((pid_t)pid); | | 111 | p = proc_find((pid_t)pid); |
| | | 112 | if (t) |
| | | 113 | mutex_exit(proc_lock); |
111 | if (p == NULL) { | | 114 | if (p == NULL) { |
112 | db_error("no such proc\n"); | | 115 | db_error("no such proc\n"); |
113 | /*NOTREACHED*/ | | 116 | /*NOTREACHED*/ |
114 | } | | 117 | } |
115 | KSI_INIT(&ksi); | | 118 | KSI_INIT(&ksi); |
116 | ksi.ksi_signo = sig; | | 119 | ksi.ksi_signo = sig; |
117 | ksi.ksi_code = SI_USER; | | 120 | ksi.ksi_code = SI_USER; |
118 | ksi.ksi_pid = 0; | | 121 | ksi.ksi_pid = 0; |
119 | ksi.ksi_uid = 0; | | 122 | ksi.ksi_uid = 0; |
120 | kpsignal2(p, &ksi); | | 123 | kpsignal2(p, &ksi); |
121 | #else | | 124 | #else |
122 | db_printf("This command is not currently supported.\n"); | | 125 | db_printf("This command is not currently supported.\n"); |
123 | #endif | | 126 | #endif |