support: Free gdb_script_name
[glibc.git] / nptl / tst-cleanup4aux.c
blob6c7356e7630a91bd40a03ef21d4e2d1deab3b2b5
1 /* Copyright (C) 2003-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
19 #include <pthread.h>
20 #include <shlib-compat.h>
21 #include <stdio.h>
22 #include <stdlib.h>
23 #include <unistd.h>
25 extern void _pthread_cleanup_push (struct _pthread_cleanup_buffer *__buffer,
26 void (*__routine) (void *),
27 void *__arg);
28 compat_symbol_reference (libpthread, _pthread_cleanup_push,
29 _pthread_cleanup_push, GLIBC_2_0);
30 extern void _pthread_cleanup_pop (struct _pthread_cleanup_buffer *__buffer,
31 int __execute);
32 compat_symbol_reference (libpthread, _pthread_cleanup_pop,
33 _pthread_cleanup_pop, GLIBC_2_0);
35 extern void clh (void *arg);
36 extern void fn0 (void);
37 extern void fn1 (void);
38 extern void fn5 (void);
39 extern void fn7 (void);
40 extern void fn9 (void);
43 static __attribute__((noinline)) void
44 fn3 (void)
46 /* This is the old LinuxThreads pthread_cleanup_{push,pop}. */
47 struct _pthread_cleanup_buffer b;
48 _pthread_cleanup_push (&b, clh, (void *) 4l);
50 fn0 ();
52 _pthread_cleanup_pop (&b, 1);
56 static __attribute__((noinline)) void
57 fn4 (void)
59 pthread_cleanup_push (clh, (void *) 5l);
61 fn3 ();
63 pthread_cleanup_pop (1);
67 void
68 fn5 (void)
70 /* This is the old LinuxThreads pthread_cleanup_{push,pop}. */
71 struct _pthread_cleanup_buffer b;
72 _pthread_cleanup_push (&b, clh, (void *) 6l);
74 fn4 ();
76 _pthread_cleanup_pop (&b, 1);
80 static __attribute__((noinline)) void
81 fn6 (void)
83 pthread_cleanup_push (clh, (void *) 7l);
85 fn0 ();
87 pthread_cleanup_pop (1);
91 void
92 fn7 (void)
94 /* This is the old LinuxThreads pthread_cleanup_{push,pop}. */
95 struct _pthread_cleanup_buffer b;
96 _pthread_cleanup_push (&b, clh, (void *) 8l);
98 fn6 ();
100 _pthread_cleanup_pop (&b, 1);
104 static __attribute__((noinline)) void
105 fn8 (void)
107 pthread_cleanup_push (clh, (void *) 9l);
109 fn1 ();
111 pthread_cleanup_pop (1);
115 void
116 fn9 (void)
118 /* This is the old LinuxThreads pthread_cleanup_{push,pop}. */
119 struct _pthread_cleanup_buffer b;
120 _pthread_cleanup_push (&b, clh, (void *) 10l);
122 fn8 ();
124 _pthread_cleanup_pop (&b, 1);