Blame nptl/tst-cleanup4aux.c

Packit 6c4009
/* Copyright (C) 2003-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
   Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library; if not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
#include <pthread.h>
Packit 6c4009
#include <stdio.h>
Packit 6c4009
#include <stdlib.h>
Packit 6c4009
#include <unistd.h>
Packit 6c4009
Packit 6c4009
extern void _pthread_cleanup_push (struct _pthread_cleanup_buffer *__buffer,
Packit 6c4009
                                   void (*__routine) (void *),
Packit 6c4009
                                   void *__arg);
Packit 6c4009
extern void _pthread_cleanup_pop (struct _pthread_cleanup_buffer *__buffer,
Packit 6c4009
                                  int __execute);
Packit 6c4009
Packit 6c4009
extern void clh (void *arg);
Packit 6c4009
extern void fn0 (void);
Packit 6c4009
extern void fn1 (void);
Packit 6c4009
extern void fn5 (void);
Packit 6c4009
extern void fn7 (void);
Packit 6c4009
extern void fn9 (void);
Packit 6c4009
Packit 6c4009
Packit 6c4009
static __attribute__((noinline)) void
Packit 6c4009
fn3 (void)
Packit 6c4009
{
Packit 6c4009
  /* This is the old LinuxThreads pthread_cleanup_{push,pop}.  */
Packit 6c4009
     struct _pthread_cleanup_buffer b;
Packit 6c4009
  _pthread_cleanup_push (&b, clh, (void *) 4l);
Packit 6c4009
Packit 6c4009
  fn0 ();
Packit 6c4009
Packit 6c4009
  _pthread_cleanup_pop (&b, 1);
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
Packit 6c4009
static __attribute__((noinline)) void
Packit 6c4009
fn4 (void)
Packit 6c4009
{
Packit 6c4009
  pthread_cleanup_push (clh, (void *) 5l);
Packit 6c4009
Packit 6c4009
  fn3 ();
Packit 6c4009
Packit 6c4009
  pthread_cleanup_pop (1);
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
Packit 6c4009
void
Packit 6c4009
fn5 (void)
Packit 6c4009
{
Packit 6c4009
  /* This is the old LinuxThreads pthread_cleanup_{push,pop}.  */
Packit 6c4009
     struct _pthread_cleanup_buffer b;
Packit 6c4009
  _pthread_cleanup_push (&b, clh, (void *) 6l);
Packit 6c4009
Packit 6c4009
  fn4 ();
Packit 6c4009
Packit 6c4009
  _pthread_cleanup_pop (&b, 1);
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
Packit 6c4009
static __attribute__((noinline)) void
Packit 6c4009
fn6 (void)
Packit 6c4009
{
Packit 6c4009
  pthread_cleanup_push (clh, (void *) 7l);
Packit 6c4009
Packit 6c4009
  fn0 ();
Packit 6c4009
Packit 6c4009
  pthread_cleanup_pop (1);
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
Packit 6c4009
void
Packit 6c4009
fn7 (void)
Packit 6c4009
{
Packit 6c4009
  /* This is the old LinuxThreads pthread_cleanup_{push,pop}.  */
Packit 6c4009
     struct _pthread_cleanup_buffer b;
Packit 6c4009
  _pthread_cleanup_push (&b, clh, (void *) 8l);
Packit 6c4009
Packit 6c4009
  fn6 ();
Packit 6c4009
Packit 6c4009
  _pthread_cleanup_pop (&b, 1);
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
Packit 6c4009
static __attribute__((noinline)) void
Packit 6c4009
fn8 (void)
Packit 6c4009
{
Packit 6c4009
  pthread_cleanup_push (clh, (void *) 9l);
Packit 6c4009
Packit 6c4009
  fn1 ();
Packit 6c4009
Packit 6c4009
  pthread_cleanup_pop (1);
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
Packit 6c4009
void
Packit 6c4009
fn9 (void)
Packit 6c4009
{
Packit 6c4009
  /* This is the old LinuxThreads pthread_cleanup_{push,pop}.  */
Packit 6c4009
     struct _pthread_cleanup_buffer b;
Packit 6c4009
  _pthread_cleanup_push (&b, clh, (void *) 10l);
Packit 6c4009
Packit 6c4009
  fn8 ();
Packit 6c4009
Packit 6c4009
  _pthread_cleanup_pop (&b, 1);
Packit 6c4009
}