]> granicus.if.org Git - strace/commitdiff
Implement decoding of SO_TIMESTAMP*_NEW control messages
authorDmitry V. Levin <ldv@altlinux.org>
Fri, 17 May 2019 16:16:29 +0000 (16:16 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Fri, 17 May 2019 16:16:29 +0000 (16:16 +0000)
* print_timeval64.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* defs.h (print_timeval64_data_size): New prototype.
* msghdr.c (print_scm_timestamp_new, print_scm_timestampns_new,
print_scm_timestamping_new): New functions.
(cmsg_socket_printers): Add SO_TIMESTAMP_NEW, SO_TIMESTAMPNS_NEW,
and SO_TIMESTAMPING_NEW.
* NEWS: Mention this change.

Makefile.am
NEWS
defs.h
msghdr.c
print_timeval64.c [new file with mode: 0644]

index 08214be08ea6502068df9a7b5b125450f00de454..ef42de72d4152899ddb9d7228c2fe949b0e8cdd9 100644 (file)
@@ -249,6 +249,7 @@ strace_SOURCES =    \
        print_timespec32.c \
        print_timespec64.c \
        print_timeval.c \
+       print_timeval64.c \
        print_timex.c   \
        print_timex.h   \
        print_utils.h   \
diff --git a/NEWS b/NEWS
index 7255f4199889f7f790d509e1312dd20de335581d..11fa59536135675ff4dfbc01c13c7eac23a8c0aa 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ Noteworthy changes in release ?.? (????-??-??)
 
 * Improvements
   * Added C-SKY architecture support.
+  * Implemented decoding of SO_TIMESTAMP*_NEW control messages.
   * Wired up clock_gettime64, clock_settime64, clock_adjtime64,
     clock_getres_time64, clock_nanosleep_time64, timer_gettime64,
     timer_settime64, timerfd_gettime64, timerfd_settime64, utimensat_time64,
diff --git a/defs.h b/defs.h
index a3263369023ffa4fcaffdca0614d68b536375dc3..512ad51f513ccfbd9649e1ac52b2ad78bb76e590 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -1129,6 +1129,9 @@ extern int print_timespec64(struct tcb *, kernel_ulong_t);
 extern const char *sprint_timespec64(struct tcb *, kernel_ulong_t);
 extern int print_timespec64_utime_pair(struct tcb *, kernel_ulong_t);
 extern int print_itimerspec64(struct tcb *, kernel_ulong_t);
+
+extern bool print_timeval64_data_size(const void *arg, size_t size);
+
 extern int print_timex64(struct tcb *, kernel_ulong_t);
 
 # ifdef SPARC64
index bb347729517da90e05cb2dc5c122062eebc16de5..830c59184dfca2d9aee081142388cfb271af2e63 100644 (file)
--- a/msghdr.c
+++ b/msghdr.c
@@ -103,6 +103,27 @@ print_scm_timestamping_old(struct tcb *tcp, const void *cmsg_data,
        print_struct_timespec_array_data_size(cmsg_data, 3, data_len);
 }
 
+static void
+print_scm_timestamp_new(struct tcb *tcp, const void *cmsg_data,
+                       const unsigned int data_len)
+{
+       print_timeval64_data_size(cmsg_data, data_len);
+}
+
+static void
+print_scm_timestampns_new(struct tcb *tcp, const void *cmsg_data,
+                       const unsigned int data_len)
+{
+       print_timespec64_data_size(cmsg_data, data_len);
+}
+
+static void
+print_scm_timestamping_new(struct tcb *tcp, const void *cmsg_data,
+                          const unsigned int data_len)
+{
+       print_timespec64_array_data_size(cmsg_data, 3, data_len);
+}
+
 static void
 print_cmsg_ip_pktinfo(struct tcb *tcp, const void *cmsg_data,
                      const unsigned int data_len)
@@ -202,7 +223,10 @@ static const struct {
        [SCM_SECURITY] = { print_scm_security, 1 },
        [SO_TIMESTAMP_OLD] = { print_scm_timestamp_old, 1 },
        [SO_TIMESTAMPNS_OLD] = { print_scm_timestampns_old, 1 },
-       [SO_TIMESTAMPING_OLD] = { print_scm_timestamping_old, 1 }
+       [SO_TIMESTAMPING_OLD] = { print_scm_timestamping_old, 1 },
+       [SO_TIMESTAMP_NEW] = { print_scm_timestamp_new, 1 },
+       [SO_TIMESTAMPNS_NEW] = { print_scm_timestampns_new, 1 },
+       [SO_TIMESTAMPING_NEW] = { print_scm_timestamping_new, 1 }
 }, cmsg_ip_printers[] = {
        [IP_PKTINFO] = { print_cmsg_ip_pktinfo, sizeof(struct in_pktinfo) },
        [IP_TTL] = { print_cmsg_uint, sizeof(unsigned int) },
diff --git a/print_timeval64.c b/print_timeval64.c
new file mode 100644 (file)
index 0000000..1721b96
--- /dev/null
@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) 2019 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#include "defs.h"
+
+#define TIMESPEC_T kernel_timeval64_t
+#define TIMESPEC_NSEC tv_usec
+#define PRINT_TIMESPEC_DATA_SIZE print_timeval64_data_size
+
+#include "kernel_timeval.h"
+#include "print_timespec.h"