2 * Copyright (C) - 2017 Francis Deslauriers <francis.deslauriers@efficios.com>
4 * This library is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License as published by the
6 * Free Software Foundation; version 2.1 of the License.
8 * This library is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this library; if not, write to the Free Software Foundation,
15 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 #include <sys/syscall.h>
27 * The process waits for the creation of a file passed as argument from an
28 * external processes to execute a syscall and exiting. This is useful for tests
29 * in combinaison with LTTng's PID tracker feature where we can trace the kernel
30 * events generated by our test process only.
32 int main(int argc
, char **argv
)
39 fprintf(stderr
, "Error: Missing argument\n");
40 fprintf(stderr
, "USAGE: %s PATH_WAIT_FILE\n", argv
[0]);
48 * Wait for the start_file to be created by an external process
49 * (typically the test script) before executing the syscalls.
51 ret
= wait_on_file(start_file
);
57 * Start generating syscalls. We use syscall(2) to prevent libc to change
58 * the underlying syscall. e.g. calling openat(2) instead of open(2).
60 fd
= syscall(SYS_openat
, AT_FDCWD
, "/proc/cpuinfo", O_RDONLY
);
67 ret
= syscall(SYS_read
, fd
, buf
, MAX_LEN
);
74 ret
= syscall(SYS_close
, fd
);
This page took 0.034669 seconds and 5 git commands to generate.