Privatize headers
[ust.git] / ust-consumerd / ust-consumerd.c
index ce2ee40a339a96b05e880c7355af1a2e63a2f2f6..0761253183eef1b5509a201a63e46611456f1b68 100644 (file)
@@ -24,6 +24,7 @@
 #include <fcntl.h>
 #include <unistd.h>
 #include <signal.h>
+#include <inttypes.h>
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -192,8 +193,8 @@ int on_open_buffer(struct ustconsumer_callbacks *data, struct buffer_info *buf)
                trace_path = USTCONSUMER_DEFAULT_TRACE_PATH;
        }
 
-       if (asprintf(&tmp, "%s/%u_%lld", trace_path, buf->pid, buf->pidunique) < 0) {
-               ERR("on_open_buffer : asprintf failed (%s/%u_%lld)",
+       if (asprintf(&tmp, "%s/%u_%" PRId64 "", trace_path, buf->pid, buf->pidunique) < 0) {
+               ERR("on_open_buffer : asprintf failed (%s/%u_%" PRId64 ")",
                    trace_path, buf->pid, buf->pidunique);
                return 1;
        }
@@ -205,12 +206,16 @@ int on_open_buffer(struct ustconsumer_callbacks *data, struct buffer_info *buf)
        }
        free(tmp);
 
-       if (asprintf(&tmp, "%s/%u_%lld/%s", trace_path, buf->pid, buf->pidunique, buf->name) < 0) {
-               ERR("on_open_buffer : asprintf failed (%s/%u_%lld/%s)",
+       if (asprintf(&tmp, "%s/%u_%" PRId64 "/%s", trace_path, buf->pid, buf->pidunique, buf->name) < 0) {
+               ERR("on_open_buffer : asprintf failed (%s/%u_%" PRId64 "/%s)",
                    trace_path, buf->pid, buf->pidunique, buf->name);
                return 1;
        }
+again:
        result = fd = open(tmp, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 00600);
+       if (result == -1 && errno == EINTR)
+               goto again;
+
        if(result == -1) {
                PERROR("open");
                ERR("failed opening trace file %s", tmp);
@@ -225,7 +230,12 @@ int on_open_buffer(struct ustconsumer_callbacks *data, struct buffer_info *buf)
 int on_close_buffer(struct ustconsumer_callbacks *data, struct buffer_info *buf)
 {
        struct buffer_info_local *buf_local = buf->user_data;
-       int result = close(buf_local->file_fd);
+       int result;
+
+again:
+       result = close(buf_local->file_fd);
+       if (result == -1 && errno == EINTR)
+               goto again;
        free(buf_local);
        if(result == -1) {
                PERROR("close");
This page took 0.023579 seconds and 4 git commands to generate.