1/*- 2 * Copyright (c) 1998 Berkeley Software Design, Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 13 unchanged lines hidden (view full) --- 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * 28 * from BSDI $Id: mutex_witness.c,v 1.1.2.20 2000/04/27 03:10:27 cp Exp $ 29 * and BSDI $Id: synch_machdep.c,v 2.3.2.39 2000/04/27 03:10:25 cp Exp $ |
30 * $FreeBSD: head/sys/kern/kern_mutex.c 69881 2000-12-12 01:14:32Z jake $ |
31 */ 32 33/* 34 * Main Entry: witness 35 * Pronunciation: 'wit-n&s 36 * Function: noun 37 * Etymology: Middle English witnesse, from Old English witnes knowledge, 38 * testimony, witness, from 2wit --- 1309 unchanged lines hidden (view full) --- 1348 1349static void 1350witness_free(struct witness *w) 1351{ 1352 w->w_next = w_free; 1353 w_free = w; 1354} 1355 |
1356int |
1357witness_list(struct proc *p) 1358{ 1359 struct mtx *m; |
1360 int nheld; |
1361 |
1362 nheld = 0; |
1363 for ((m = LIST_FIRST(&p->p_heldmtx)); m != NULL; 1364 m = LIST_NEXT(m, mtx_held)) { 1365 printf("\t\"%s\" (%p) locked at %s:%d\n", 1366 m->mtx_description, m, 1367 m->mtx_witness->w_file, m->mtx_witness->w_line); |
1368 nheld++; |
1369 } |
1370 1371 return (nheld); |
1372} 1373 1374void 1375witness_save(struct mtx *m, const char **filep, int *linep) 1376{ 1377 *filep = m->mtx_witness->w_file; 1378 *linep = m->mtx_witness->w_line; 1379} 1380 1381void 1382witness_restore(struct mtx *m, const char *file, int line) 1383{ 1384 m->mtx_witness->w_file = file; 1385 m->mtx_witness->w_line = line; 1386} 1387 1388#endif /* WITNESS */ |