]> git.ozlabs.org Git - ccan/blobdiff - ccan/failtest/failtest.c
endian: add constant versions.
[ccan] / ccan / failtest / failtest.c
index b3ee0337ebd96cfb7fe9a3b7cd3114fe473404c8..fda2b344ff52af9464a1bdc6c4aa92b6556546bb 100644 (file)
@@ -91,7 +91,7 @@ static int control_fd = -1;
 /* If we're a child, this is the first call we did ourselves. */
 static struct failtest_call *our_history_start = NULL;
 /* For printing runtime with --trace. */
 /* If we're a child, this is the first call we did ourselves. */
 static struct failtest_call *our_history_start = NULL;
 /* For printing runtime with --trace. */
-static struct timeval start;
+static struct timespec start;
 /* Set when failtest_hook returns FAIL_PROBE */
 static bool probing = false;
 /* Table to track duplicates. */
 /* Set when failtest_hook returns FAIL_PROBE */
 static bool probing = false;
 /* Table to track duplicates. */
@@ -761,7 +761,7 @@ static bool should_fail(struct failtest_call *call)
        if (child == 0) {
                traceindent++;
                if (tracef) {
        if (child == 0) {
                traceindent++;
                if (tracef) {
-                       struct timeval diff;
+                       struct timespec diff;
                        const char *p;
                        char *failpath;
                        struct failtest_call *c;
                        const char *p;
                        char *failpath;
                        struct failtest_call *c;
@@ -776,7 +776,7 @@ static bool should_fail(struct failtest_call *call)
                                p = c->file;
                        trace("%u->%u (%u.%02u): %s (%s:%u)\n",
                              getppid(), getpid(),
                                p = c->file;
                        trace("%u->%u (%u.%02u): %s (%s:%u)\n",
                              getppid(), getpid(),
-                             (int)diff.tv_sec, (int)diff.tv_usec / 10000,
+                             (int)diff.tv_sec, (int)diff.tv_nsec / 10000000,
                              failpath, p, c->line);
                        free(failpath);
                }
                              failpath, p, c->line);
                        free(failpath);
                }
@@ -1260,7 +1260,7 @@ static ssize_t failtest_add_read(int fd, void *buf, size_t count, off_t off,
                                set_cleanup(p, cleanup_read, struct read_call);
                }
        }
                                set_cleanup(p, cleanup_read, struct read_call);
                }
        }
-       trace("%sread %s:%u fd %i %zu@%llu -> %i\n",
+       trace("%sread %s:%u fd %i %zu@%llu -> %zi\n",
              is_pread ? "p" : "", file, line, fd, count, (long long)off,
              p->u.read.ret);
        errno = p->error;
              is_pread ? "p" : "", file, line, fd, count, (long long)off,
              p->u.read.ret);
        errno = p->error;
@@ -1362,7 +1362,7 @@ static ssize_t failtest_add_write(int fd, const void *buf,
                else
                        p->u.write.ret = write(fd, buf, count);
        }
                else
                        p->u.write.ret = write(fd, buf, count);
        }
-       trace("%swrite %s:%i %zu@%llu on fd %i -> %i\n",
+       trace("%swrite %s:%i %zu@%llu on fd %i -> %zi\n",
              p->u.write.is_pwrite ? "p" : "",
              file, line, count, (long long)off, fd, p->u.write.ret);
        errno = p->error;
              p->u.write.is_pwrite ? "p" : "",
              file, line, count, (long long)off, fd, p->u.write.ret);
        errno = p->error;