bee03a42ce2148e0fdb72476eea0d37c5478c367
2 * Copyright (C) 2017 Francis Deslauriers <francis.deslauriers@efficios.com>
4 * SPDX-License-Identifier: LGPL-2.1-only
16 #include <sys/syscall.h>
17 #include <sys/types.h>
21 * The process waits for the creation of a file passed as argument from an
22 * external processes to execute a syscall and exiting. This is useful for tests
23 * in combinaison with LTTng's PID tracker feature where we can trace the kernel
24 * events generated by our test process only.
27 #if defined(__clang__)
28 #define nooptimization __attribute__((noinline)) __attribute__((optnone))
30 #define nooptimization __attribute__((noinline)) __attribute__((optimize(0)))
35 long nooptimization
my_gettid(void);
36 long nooptimization
my_gettid(void)
40 asm volatile("syscall" : "=a"(ret
) : "0"(__NR_gettid
) : "cc", "rcx", "r11", "memory");
42 asm volatile("int $0x80" : "=a"(ret
) : "0"(__NR_gettid
) : "cc", "edi", "esi", "memory");
44 #error "Userspace callstack test not supported for this architecture."
49 int nooptimization
fct_c(void);
50 int nooptimization
fct_c(void)
55 int nooptimization
fct_b(void);
56 int nooptimization
fct_b(void)
62 int nooptimization
fct_a(void);
63 int nooptimization
fct_a(void)
69 int main(int argc
, char **argv
)
75 fprintf(stderr
, "Error: Missing argument\n");
76 fprintf(stderr
, "USAGE: %s PATH_WAIT_FILE\n", argv
[0]);
84 * Wait for the start_file to be created by an external process
85 * (typically the test script) before executing the syscall
87 ret
= wait_on_file(start_file
);
92 /* Start the callchain to the syscall */
This page took 0.030325 seconds and 3 git commands to generate.