summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2019-05-17 16:16:29 +0000
committerDmitry V. Levin <ldv@altlinux.org>2019-05-17 16:16:29 +0000
commite26b1a755a66bf868a00003ca29498e1a3d150a0 (patch)
treea195e37e35a02c8a58b9ff17244ed101dea57d8e
parent3f7ad363fb4eaf2239db3edaceba965a801636e7 (diff)
downloadstrace-e26b1a755a66bf868a00003ca29498e1a3d150a0.tar.gz
Implement decoding of SO_TIMESTAMP*_NEW control messages
* 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.
-rw-r--r--Makefile.am1
-rw-r--r--NEWS1
-rw-r--r--defs.h3
-rw-r--r--msghdr.c26
-rw-r--r--print_timeval64.c15
5 files changed, 45 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index 08214be08..ef42de72d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -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 7255f4199..11fa59536 100644
--- 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 a32633690..512ad51f5 100644
--- 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
diff --git a/msghdr.c b/msghdr.c
index bb3477295..830c59184 100644
--- a/msghdr.c
+++ b/msghdr.c
@@ -104,6 +104,27 @@ print_scm_timestamping_old(struct tcb *tcp, const void *cmsg_data,
}
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
index 000000000..1721b96f9
--- /dev/null
+++ b/print_timeval64.c
@@ -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"