Sat May 2 21:01:01 2009 UTC ()
make flushpendq drop only entries for the current thread.


(mlelstv)
diff -r1.34 -r1.35 src/usr.bin/ktruss/dump.c

cvs diff -r1.34 -r1.35 src/usr.bin/ktruss/dump.c (expand / switch to unified diff)

--- src/usr.bin/ktruss/dump.c 2009/05/02 18:26:53 1.34
+++ src/usr.bin/ktruss/dump.c 2009/05/02 21:01:01 1.35
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: dump.c,v 1.34 2009/05/02 18:26:53 christos Exp $ */ 1/* $NetBSD: dump.c,v 1.35 2009/05/02 21:01:01 mlelstv Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1988, 1993 4 * Copyright (c) 1988, 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.
@@ -29,27 +29,27 @@ @@ -29,27 +29,27 @@
29 * SUCH DAMAGE. 29 * SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33#ifndef lint 33#ifndef lint
34__COPYRIGHT("@(#) Copyright (c) 1988, 1993\ 34__COPYRIGHT("@(#) Copyright (c) 1988, 1993\
35 The Regents of the University of California. All rights reserved."); 35 The Regents of the University of California. All rights reserved.");
36#endif /* not lint */ 36#endif /* not lint */
37 37
38#ifndef lint 38#ifndef lint
39#if 0 39#if 0
40static char sccsid[] = "@(#)kdump.c 8.4 (Berkeley) 4/28/95"; 40static char sccsid[] = "@(#)kdump.c 8.4 (Berkeley) 4/28/95";
41#endif 41#endif
42__RCSID("$NetBSD: dump.c,v 1.34 2009/05/02 18:26:53 christos Exp $"); 42__RCSID("$NetBSD: dump.c,v 1.35 2009/05/02 21:01:01 mlelstv Exp $");
43#endif /* not lint */ 43#endif /* not lint */
44 44
45#include <sys/param.h> 45#include <sys/param.h>
46#define _KERNEL 46#define _KERNEL
47#include <sys/errno.h> 47#include <sys/errno.h>
48#undef _KERNEL 48#undef _KERNEL
49#include <sys/ioctl.h> 49#include <sys/ioctl.h>
50#include <sys/time.h> 50#include <sys/time.h>
51#include <sys/uio.h> 51#include <sys/uio.h>
52#include <sys/ktrace.h> 52#include <sys/ktrace.h>
53#include <sys/ptrace.h> 53#include <sys/ptrace.h>
54#include <sys/queue.h> 54#include <sys/queue.h>
55 55
@@ -206,31 +206,31 @@ getrecord(FILE *fp) @@ -206,31 +206,31 @@ getrecord(FILE *fp)
206 KTE_LID(kte) == (lid)) 206 KTE_LID(kte) == (lid))
207 207
208void 208void
209putpendq(struct ktr_entry *kte) 209putpendq(struct ktr_entry *kte)
210{ 210{
211 211
212 TAILQ_INSERT_TAIL(&ktependq, kte, kte_list); 212 TAILQ_INSERT_TAIL(&ktependq, kte, kte_list);
213} 213}
214 214
215void 215void
216flushpendq(struct ktr_entry *us) 216flushpendq(struct ktr_entry *us)
217{ 217{
218 struct ktr_entry *kte, *kte_next; 218 struct ktr_entry *kte, *kte_next;
219 int pid = KTE_PID(us); 219 int pid = KTE_PID(us), lid = KTE_LID(us);
220 220
221 for (kte = TAILQ_FIRST(&ktependq); kte != NULL; kte = kte_next) { 221 for (kte = TAILQ_FIRST(&ktependq); kte != NULL; kte = kte_next) {
222 kte_next = TAILQ_NEXT(kte, kte_list); 222 kte_next = TAILQ_NEXT(kte, kte_list);
223 if (KTE_PID(kte) == pid) { 223 if (KTE_PID(kte) == pid || KTE_LID(kte) == lid) {
224 TAILQ_REMOVE(&ktependq, kte, kte_list); 224 TAILQ_REMOVE(&ktependq, kte, kte_list);
225 free(kte); 225 free(kte);
226 } 226 }
227 } 227 }
228} 228}
229 229
230struct ktr_entry * 230struct ktr_entry *
231getpendq(struct ktr_header *us, int type, struct kteq *kteq) 231getpendq(struct ktr_header *us, int type, struct kteq *kteq)
232{ 232{
233 struct ktr_entry *kte, *kte_next; 233 struct ktr_entry *kte, *kte_next;
234 int pid = us->ktr_pid, lid = us->ktr_lid; 234 int pid = us->ktr_pid, lid = us->ktr_lid;
235 235
236 if (kteq != NULL) 236 if (kteq != NULL)