2 * Copyright (C) 2012 David Goulet <dgoulet@efficios.com>
3 * Copyright (C) 2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 * SPDX-License-Identifier: LGPL-2.1-only
10 #include "signal-helper.hpp"
12 #include <common/macros.hpp>
14 #include <lttng/tracef.h>
23 #include <sys/types.h>
26 const char *str
= "test string";
28 static void create_file(const char *path
)
34 ret
= creat(path
, S_IRWXU
);
36 fprintf(stderr
, "Failed to create file %s\n", path
);
43 int main(int argc
, char **argv
)
46 unsigned int nr_iter
= 100;
47 useconds_t nr_usec
= 0;
48 char *tmp_file_path
= nullptr;
50 if (set_signal_handler()) {
55 nr_iter
= atoi(argv
[1]);
59 /* By default, don't wait unless user specifies. */
60 nr_usec
= atoi(argv
[2]);
64 tmp_file_path
= argv
[3];
67 for (i
= 0; i
< nr_iter
; i
++) {
68 tracef("Test message %d with string \"%s\"", i
, str
);
71 * First loop we create the file if asked to indicate
72 * that at least one tracepoint has been hit.
74 if (i
== 0 && tmp_file_path
) {
75 create_file(tmp_file_path
);
This page took 0.038897 seconds and 4 git commands to generate.