SoW-2019-0002: Dynamic Snapshot
[lttng-tools.git] / tests / utils / testapp / gen-ust-tracef / gen-ust-tracef.c
index 0f70ef0f32134acc4e9aa81f3898a2bab24476cc..c5e721136eb4d1af5e77b22f7a7107dc00310af3 100644 (file)
@@ -1,19 +1,9 @@
 /*
 /*
- * Copyright (C) 2012 David Goulet <dgoulet@efficios.com>
- * Copyright (C) 2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ * Copyright (C) 2012 David Goulet <dgoulet@efficios.com>
+ * Copyright (C) 2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
  *
  *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by the
- * Free Software Foundation; version 2.1 of the License.
+ * SPDX-License-Identifier: LGPL-2.1-only
  *
  *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
 #define _LGPL_SOURCE
  */
 
 #define _LGPL_SOURCE
 #include <unistd.h>
 
 #include <lttng/tracef.h>
 #include <unistd.h>
 
 #include <lttng/tracef.h>
+#include "signal-helper.h"
 
 const char *str = "test string";
 
 
 const char *str = "test string";
 
-void create_file(const char *path)
+static void create_file(const char *path)
 {
        int ret;
 
 {
        int ret;
 
@@ -54,6 +45,10 @@ int main(int argc, char **argv)
        useconds_t nr_usec = 0;
        char *tmp_file_path = NULL;
 
        useconds_t nr_usec = 0;
        char *tmp_file_path = NULL;
 
+       if (set_signal_handler()) {
+               return 1;
+       }
+
        if (argc >= 2) {
                nr_iter = atoi(argv[1]);
        }
        if (argc >= 2) {
                nr_iter = atoi(argv[1]);
        }
@@ -78,6 +73,9 @@ int main(int argc, char **argv)
                        create_file(tmp_file_path);
                }
                usleep(nr_usec);
                        create_file(tmp_file_path);
                }
                usleep(nr_usec);
+               if (should_quit) {
+                       break;
+               }
        }
 
        return 0;
        }
 
        return 0;
This page took 0.024411 seconds and 5 git commands to generate.