(root)/
strace-6.5/
tests/
stack-fcall.h
       1  /*
       2   * Copyright (c) 2017-2020 The strace developers.
       3   * All rights reserved.
       4   *
       5   * SPDX-License-Identifier: GPL-2.0-or-later
       6   */
       7  
       8  #include <unistd.h>
       9  #include "scno.h"
      10  #include "gcc_compat.h"
      11  
      12  #ifdef MANGLE
      13  
      14  # define f0 _ZN2ns2f0Ei
      15  # define f1 _ZN2ns2f1Ei
      16  # define f2 _ZN2ns2f2Ei
      17  # define f3 _ZN2ns2f3Ei
      18  
      19  #endif
      20  
      21  int f0(int i, unsigned long) ATTRIBUTE_NOINLINE;
      22  int f1(int i, unsigned long) ATTRIBUTE_NOINLINE;
      23  int f2(int i, unsigned long) ATTRIBUTE_NOINLINE;
      24  int f3(int i, unsigned long) ATTRIBUTE_NOINLINE;
      25  
      26  #define COMPLEX_BODY(i, f)				\
      27  	do {						\
      28  		int tid = syscall(__NR_gettid, f);	\
      29  		if (i == tid)				\
      30  			return 0;			\
      31  		switch ((unsigned int) tid & 3) {	\
      32  			case 0:				\
      33  				i += f0(tid, f);	\
      34  				break;			\
      35  			case 1:				\
      36  				i += f1(tid, f);	\
      37  				break;			\
      38  			case 2:				\
      39  				i += f2(tid, f);	\
      40  				break;			\
      41  			case 3:				\
      42  				i += f3(tid, f);	\
      43  				break;			\
      44  		}					\
      45  	} while (0)