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
22 #include <sys/syscall.h>
29 * The process waits for the creation of a file passed as argument from an
30 * external processes to execute a syscall and exiting. This is useful for tests
31 * in combinaison with LTTng's PID tracker feature where we can trace the kernel
32 * events generated by our test process only.
34 int main(int argc
, char **argv
)
41 fprintf(stderr
, "Error: Missing argument\n");
42 fprintf(stderr
, "USAGE: %s PATH_WAIT_FILE\n", argv
[0]);
50 * Wait for the start_file to be created by an external process
51 * (typically the test script) before executing the syscalls.
53 ret
= wait_on_file(start_file
);
59 * Start generating syscalls. We use syscall(2) to prevent libc to change
60 * the underlying syscall. e.g. calling openat(2) instead of open(2).
62 fd
= syscall(SYS_open
, "/proc/cpuinfo", O_RDONLY
);
69 ret
= syscall(SYS_read
, fd
, buf
, MAX_LEN
);
76 ret
= syscall(SYS_close
, fd
);
This page took 0.038334 seconds and 5 git commands to generate.