Add glibc.malloc.mxfast tunable
[glibc.git] / nptl / tst-audit-threads.h
blobb2b54cd47e0dfe8f7d25ece647c8fa2ee6bee0f4
1 /* Helper header for test-audit-threads.
3 Copyright (C) 2018-2019 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
20 /* We use this helper to create a large number of functions, all of
21 which will be resolved lazily and thus have their PLT updated.
22 This is done to provide enough functions that we can statistically
23 observe a thread vs. PLT resolution failure if one exists. */
25 #define CONCAT(a, b) a ## b
26 #define NUM(x, y) CONCAT (x, y)
28 #define FUNC10(x) \
29 FUNC (NUM (x, 0)); \
30 FUNC (NUM (x, 1)); \
31 FUNC (NUM (x, 2)); \
32 FUNC (NUM (x, 3)); \
33 FUNC (NUM (x, 4)); \
34 FUNC (NUM (x, 5)); \
35 FUNC (NUM (x, 6)); \
36 FUNC (NUM (x, 7)); \
37 FUNC (NUM (x, 8)); \
38 FUNC (NUM (x, 9))
40 #define FUNC100(x) \
41 FUNC10 (NUM (x, 0)); \
42 FUNC10 (NUM (x, 1)); \
43 FUNC10 (NUM (x, 2)); \
44 FUNC10 (NUM (x, 3)); \
45 FUNC10 (NUM (x, 4)); \
46 FUNC10 (NUM (x, 5)); \
47 FUNC10 (NUM (x, 6)); \
48 FUNC10 (NUM (x, 7)); \
49 FUNC10 (NUM (x, 8)); \
50 FUNC10 (NUM (x, 9))
52 #define FUNC1000(x) \
53 FUNC100 (NUM (x, 0)); \
54 FUNC100 (NUM (x, 1)); \
55 FUNC100 (NUM (x, 2)); \
56 FUNC100 (NUM (x, 3)); \
57 FUNC100 (NUM (x, 4)); \
58 FUNC100 (NUM (x, 5)); \
59 FUNC100 (NUM (x, 6)); \
60 FUNC100 (NUM (x, 7)); \
61 FUNC100 (NUM (x, 8)); \
62 FUNC100 (NUM (x, 9))
64 #define FUNC7000() \
65 FUNC1000 (1); \
66 FUNC1000 (2); \
67 FUNC1000 (3); \
68 FUNC1000 (4); \
69 FUNC1000 (5); \
70 FUNC1000 (6); \
71 FUNC1000 (7);
73 #ifdef FUNC
74 # undef FUNC
75 #endif
77 #ifdef externnum
78 # define FUNC(x) extern int CONCAT (retNum, x) (void)
79 #endif
81 #ifdef definenum
82 # define FUNC(x) int CONCAT (retNum, x) (void) { return x; }
83 #endif
85 #ifdef callnum
86 # define FUNC(x) CONCAT (retNum, x) (); sync_all (x)
87 #endif
89 /* A value of 7000 functions is chosen as an arbitrarily large
90 number of functions that will allow us enough attempts to
91 verify lazy resolution operation. */
92 FUNC7000 ();