2 * Copyright (C) 2017 Francis Deslauriers <francis.deslauriers@efficios.com>
3 * Copyright (C) 2018 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 * SPDX-License-Identifier: LGPL-2.1-only
13 #include <sys/types.h>
18 #define LTTNG_MODULES_FILE "/proc/lttng-test-filter-event"
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.
26 int main(int argc
, char **argv
)
29 char *start_file
, *nr_events_str
;
33 fprintf(stderr
, "Error: Missing argument\n");
34 fprintf(stderr
, "USAGE: %s PATH_WAIT_FILE NR_EVENTS\n",
41 nr_events_str
= argv
[2];
44 * Wait for the start_file to be created by an external process
45 * (typically the test script) before executing the syscalls.
47 ret
= wait_on_file(start_file
);
53 * Start generating events.
55 fd
= open(LTTNG_MODULES_FILE
, O_RDWR
);
62 len
= write(fd
, nr_events_str
, strlen(nr_events_str
) + 1);
63 if (len
!= (ssize_t
) strlen(nr_events_str
) + 1) {
72 int closeret
= close(fd
);
This page took 0.030723 seconds and 4 git commands to generate.