ead6fe3870be9b31595d9f4c55d0deed08b0f39c
2 * Copyright (C) 2017 Francis Deslauriers <francis.deslauriers@efficios.com>
4 * SPDX-License-Identifier: LGPL-2.1-only
10 #include <sys/syscall.h>
17 * The process waits for the creation of a file passed as argument from an
18 * external processes to execute a syscall and exiting. This is useful for tests
19 * in combinaison with LTTng's PID tracker feature where we can trace the kernel
20 * events generated by our test process only.
22 int main(int argc
, char **argv
)
29 fprintf(stderr
, "Error: Missing argument\n");
30 fprintf(stderr
, "USAGE: %s PATH_WAIT_FILE\n", argv
[0]);
38 * Wait for the start_file to be created by an external process
39 * (typically the test script) before executing the syscalls.
41 ret
= wait_on_file(start_file
);
47 * Start generating syscalls. We use syscall(2) to prevent libc to change
48 * the underlying syscall. e.g. calling openat(2) instead of open(2).
50 fd
= syscall(SYS_openat
, AT_FDCWD
, "/proc/cpuinfo", O_RDONLY
);
57 ret
= syscall(SYS_read
, fd
, buf
, MAX_LEN
);
64 ret
= syscall(SYS_close
, fd
);
This page took 0.039149 seconds and 4 git commands to generate.