Tue Mar 3 17:09:22 2020 UTC ()
Mark find_event_count() with __used


(kamil)
diff -r1.22 -r1.23 src/tests/lib/libc/sys/t_ptrace_wait.h

cvs diff -r1.22 -r1.23 src/tests/lib/libc/sys/t_ptrace_wait.h (expand / switch to unified diff)

--- src/tests/lib/libc/sys/t_ptrace_wait.h 2020/02/22 19:44:07 1.22
+++ src/tests/lib/libc/sys/t_ptrace_wait.h 2020/03/03 17:09:22 1.23
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: t_ptrace_wait.h,v 1.22 2020/02/22 19:44:07 kamil Exp $ */ 1/* $NetBSD: t_ptrace_wait.h,v 1.23 2020/03/03 17:09:22 kamil Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc. 4 * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * 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.
@@ -674,27 +674,27 @@ trigger_bus(void) @@ -674,27 +674,27 @@ trigger_bus(void)
674 */ 674 */
675 p = mmap(0, 1, PROT_READ|PROT_WRITE, MAP_PRIVATE, fileno(fp), 0); 675 p = mmap(0, 1, PROT_READ|PROT_WRITE, MAP_PRIVATE, fileno(fp), 0);
676 FORKEE_ASSERT_NEQ((uintptr_t)p, (uintptr_t)MAP_FAILED); 676 FORKEE_ASSERT_NEQ((uintptr_t)p, (uintptr_t)MAP_FAILED);
677 677
678 /* Invalid memory access causes CPU trap, translated to SIGBUS */ 678 /* Invalid memory access causes CPU trap, translated to SIGBUS */
679 *p = 'a'; 679 *p = 'a';
680} 680}
681 681
682struct lwp_event_count { 682struct lwp_event_count {
683 lwpid_t lec_lwp; 683 lwpid_t lec_lwp;
684 int lec_count; 684 int lec_count;
685}; 685};
686 686
687static int * 687static int * __used
688find_event_count(struct lwp_event_count list[], lwpid_t lwp, size_t max_lwps) 688find_event_count(struct lwp_event_count list[], lwpid_t lwp, size_t max_lwps)
689{ 689{
690 size_t i; 690 size_t i;
691 691
692 for (i = 0; i < max_lwps; i++) { 692 for (i = 0; i < max_lwps; i++) {
693 if (list[i].lec_lwp == 0) 693 if (list[i].lec_lwp == 0)
694 list[i].lec_lwp = lwp; 694 list[i].lec_lwp = lwp;
695 if (list[i].lec_lwp == lwp) 695 if (list[i].lec_lwp == lwp)
696 return &list[i].lec_count; 696 return &list[i].lec_count;
697 } 697 }
698 698
699 atf_tc_fail("More LWPs reported than expected"); 699 atf_tc_fail("More LWPs reported than expected");
700} 700}