Browse Source

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.
Dmitry V. Levin 6 months ago
parent
commit
e26b1a755a
5 changed files with 45 additions and 1 deletions
  1. 1
    0
      Makefile.am
  2. 1
    0
      NEWS
  3. 3
    0
      defs.h
  4. 25
    1
      msghdr.c
  5. 15
    0
      print_timeval64.c

+ 1
- 0
Makefile.am View File

@@ -249,6 +249,7 @@ strace_SOURCES =	\
249 249
 	print_timespec32.c \
250 250
 	print_timespec64.c \
251 251
 	print_timeval.c	\
252
+	print_timeval64.c \
252 253
 	print_timex.c	\
253 254
 	print_timex.h	\
254 255
 	print_utils.h	\

+ 1
- 0
NEWS View File

@@ -6,6 +6,7 @@ Noteworthy changes in release ?.? (????-??-??)
6 6
 
7 7
 * Improvements
8 8
   * Added C-SKY architecture support.
9
+  * Implemented decoding of SO_TIMESTAMP*_NEW control messages.
9 10
   * Wired up clock_gettime64, clock_settime64, clock_adjtime64,
10 11
     clock_getres_time64, clock_nanosleep_time64, timer_gettime64,
11 12
     timer_settime64, timerfd_gettime64, timerfd_settime64, utimensat_time64,

+ 3
- 0
defs.h View File

@@ -1129,6 +1129,9 @@ extern int print_timespec64(struct tcb *, kernel_ulong_t);
1129 1129
 extern const char *sprint_timespec64(struct tcb *, kernel_ulong_t);
1130 1130
 extern int print_timespec64_utime_pair(struct tcb *, kernel_ulong_t);
1131 1131
 extern int print_itimerspec64(struct tcb *, kernel_ulong_t);
1132
+
1133
+extern bool print_timeval64_data_size(const void *arg, size_t size);
1134
+
1132 1135
 extern int print_timex64(struct tcb *, kernel_ulong_t);
1133 1136
 
1134 1137
 # ifdef SPARC64

+ 25
- 1
msghdr.c View File

@@ -103,6 +103,27 @@ print_scm_timestamping_old(struct tcb *tcp, const void *cmsg_data,
103 103
 	print_struct_timespec_array_data_size(cmsg_data, 3, data_len);
104 104
 }
105 105
 
106
+static void
107
+print_scm_timestamp_new(struct tcb *tcp, const void *cmsg_data,
108
+			const unsigned int data_len)
109
+{
110
+	print_timeval64_data_size(cmsg_data, data_len);
111
+}
112
+
113
+static void
114
+print_scm_timestampns_new(struct tcb *tcp, const void *cmsg_data,
115
+			const unsigned int data_len)
116
+{
117
+	print_timespec64_data_size(cmsg_data, data_len);
118
+}
119
+
120
+static void
121
+print_scm_timestamping_new(struct tcb *tcp, const void *cmsg_data,
122
+			   const unsigned int data_len)
123
+{
124
+	print_timespec64_array_data_size(cmsg_data, 3, data_len);
125
+}
126
+
106 127
 static void
107 128
 print_cmsg_ip_pktinfo(struct tcb *tcp, const void *cmsg_data,
108 129
 		      const unsigned int data_len)
@@ -202,7 +223,10 @@ static const struct {
202 223
 	[SCM_SECURITY] = { print_scm_security, 1 },
203 224
 	[SO_TIMESTAMP_OLD] = { print_scm_timestamp_old, 1 },
204 225
 	[SO_TIMESTAMPNS_OLD] = { print_scm_timestampns_old, 1 },
205
-	[SO_TIMESTAMPING_OLD] = { print_scm_timestamping_old, 1 }
226
+	[SO_TIMESTAMPING_OLD] = { print_scm_timestamping_old, 1 },
227
+	[SO_TIMESTAMP_NEW] = { print_scm_timestamp_new, 1 },
228
+	[SO_TIMESTAMPNS_NEW] = { print_scm_timestampns_new, 1 },
229
+	[SO_TIMESTAMPING_NEW] = { print_scm_timestamping_new, 1 }
206 230
 }, cmsg_ip_printers[] = {
207 231
 	[IP_PKTINFO] = { print_cmsg_ip_pktinfo, sizeof(struct in_pktinfo) },
208 232
 	[IP_TTL] = { print_cmsg_uint, sizeof(unsigned int) },

+ 15
- 0
print_timeval64.c View File

@@ -0,0 +1,15 @@
1
+/*
2
+ * Copyright (c) 2019 Dmitry V. Levin <ldv@altlinux.org>
3
+ * All rights reserved.
4
+ *
5
+ * SPDX-License-Identifier: LGPL-2.1-or-later
6
+ */
7
+
8
+#include "defs.h"
9
+
10
+#define TIMESPEC_T kernel_timeval64_t
11
+#define TIMESPEC_NSEC tv_usec
12
+#define PRINT_TIMESPEC_DATA_SIZE print_timeval64_data_size
13
+
14
+#include "kernel_timeval.h"
15
+#include "print_timespec.h"

Loading…
Cancel
Save