Browse Source

Implement printers for kernel_timespec64_t

They are going to be used to re-implement parsers of syscalls that deal
with 64-bit timespec, and to implement parsers of new *time64 syscalls.

* defs.h (print_timespec64_data_size, print_timespec64_array_data_size,
print_timespec64, sprint_timespec64, print_timespec64_utime_pair,
print_itimerspec64): New prototypes.
* print_timespec64.c: New file.
* Makefile.am (strace_SOURCES): Add it.
Dmitry V. Levin 6 months ago
parent
commit
e2e0bd4224
3 changed files with 29 additions and 0 deletions
  1. 1
    0
      Makefile.am
  2. 9
    0
      defs.h
  3. 19
    0
      print_timespec64.c

+ 1
- 0
Makefile.am View File

@@ -245,6 +245,7 @@ strace_SOURCES =	\
245 245
 	print_timespec.c \
246 246
 	print_timespec.h \
247 247
 	print_timespec32.c \
248
+	print_timespec64.c \
248 249
 	print_timeval.c	\
249 250
 	print_timex.c	\
250 251
 	print_utils.h	\

+ 9
- 0
defs.h View File

@@ -1120,6 +1120,15 @@ extern int print_timespec32_utime_pair(struct tcb *, kernel_ulong_t);
1120 1120
 extern int print_itimerspec32(struct tcb *, kernel_ulong_t);
1121 1121
 # endif /* HAVE_ARCH_TIME32_SYSCALLS */
1122 1122
 
1123
+extern bool print_timespec64_data_size(const void *arg, size_t size);
1124
+extern bool print_timespec64_array_data_size(const void *arg,
1125
+					     unsigned int nmemb,
1126
+					     size_t size);
1127
+extern int print_timespec64(struct tcb *, kernel_ulong_t);
1128
+extern const char *sprint_timespec64(struct tcb *, kernel_ulong_t);
1129
+extern int print_timespec64_utime_pair(struct tcb *, kernel_ulong_t);
1130
+extern int print_itimerspec64(struct tcb *, kernel_ulong_t);
1131
+
1123 1132
 # ifdef ALPHA
1124 1133
 typedef struct {
1125 1134
 	int tv_sec, tv_usec;

+ 19
- 0
print_timespec64.c View File

@@ -0,0 +1,19 @@
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_timespec64_t
11
+#define PRINT_TIMESPEC_DATA_SIZE print_timespec64_data_size
12
+#define PRINT_TIMESPEC_ARRAY_DATA_SIZE print_timespec64_array_data_size
13
+#define PRINT_TIMESPEC print_timespec64
14
+#define SPRINT_TIMESPEC sprint_timespec64
15
+#define PRINT_TIMESPEC_UTIME_PAIR print_timespec64_utime_pair
16
+#define PRINT_ITIMERSPEC print_itimerspec64
17
+
18
+#include "kernel_timespec.h"
19
+#include "print_timespec.h"

Loading…
Cancel
Save