forked from bottlerocket-os/bottlerocket
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path0007-linux-Use-socket-constants-time64.h-on-tst-socket-ti.patch
120 lines (100 loc) · 4.28 KB
/
0007-linux-Use-socket-constants-time64.h-on-tst-socket-ti.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
From f055faf801cbffd9a0311774589de1cc745ccbe4 Mon Sep 17 00:00:00 2001
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Mon, 14 Feb 2022 10:35:30 -0300
Subject: [PATCH 07/28] linux: Use socket-constants-time64.h on
tst-socket-timestamp-compat
The kernel header might not define the SO_TIMESTAMP{NS}_OLD or
SO_TIMESTAMP{NS}_NEW if it older than v5.1.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
(cherry picked from commit fee62d6c6285548027e222c8dae597fec6577f23)
---
.../sysv/linux/tst-socket-timestamp-compat.c | 25 ++++++++++---------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/sysdeps/unix/sysv/linux/tst-socket-timestamp-compat.c b/sysdeps/unix/sysv/linux/tst-socket-timestamp-compat.c
index 0ff1a214e6..2b1feb4766 100644
--- a/sysdeps/unix/sysv/linux/tst-socket-timestamp-compat.c
+++ b/sysdeps/unix/sysv/linux/tst-socket-timestamp-compat.c
@@ -22,6 +22,7 @@
#include <support/xsocket.h>
#include <support/xunistd.h>
#include <stdbool.h>
+#include <socket-constants-time64.h>
/* AF_INET socket and address used to receive data. */
static int srv;
@@ -88,7 +89,7 @@ do_test_large_buffer (bool mc)
/* Enable 32 bit timeval precision and check if no 64 bit timeval stamp
is created. */
{
- int r = setsockopt (srv, SOL_SOCKET, SO_TIMESTAMP_OLD, &(int){1},
+ int r = setsockopt (srv, SOL_SOCKET, COMPAT_SO_TIMESTAMP_OLD, &(int){1},
sizeof (int));
TEST_VERIFY_EXIT (r != -1);
@@ -103,10 +104,10 @@ do_test_large_buffer (bool mc)
if (cmsg->cmsg_level != SOL_SOCKET)
continue;
- if (sizeof (time_t) > 4 && cmsg->cmsg_type == SO_TIMESTAMP_NEW)
+ if (sizeof (time_t) > 4 && cmsg->cmsg_type == COMPAT_SO_TIMESTAMP_NEW)
found_timestamp = true;
else
- TEST_VERIFY (cmsg->cmsg_type != SO_TIMESTAMP_NEW);
+ TEST_VERIFY (cmsg->cmsg_type != COMPAT_SO_TIMESTAMP_NEW);
}
TEST_COMPARE (found_timestamp, sizeof (time_t) > 4);
@@ -114,7 +115,7 @@ do_test_large_buffer (bool mc)
/* Same as before, but for timespec. */
{
- int r = setsockopt (srv, SOL_SOCKET, SO_TIMESTAMPNS_OLD, &(int){1},
+ int r = setsockopt (srv, SOL_SOCKET, COMPAT_SO_TIMESTAMPNS_OLD, &(int){1},
sizeof (int));
TEST_VERIFY_EXIT (r != -1);
@@ -129,10 +130,10 @@ do_test_large_buffer (bool mc)
if (cmsg->cmsg_level != SOL_SOCKET)
continue;
- if (sizeof (time_t) > 4 && cmsg->cmsg_type == SO_TIMESTAMPNS_NEW)
+ if (sizeof (time_t) > 4 && cmsg->cmsg_type == COMPAT_SO_TIMESTAMPNS_NEW)
found_timestamp = true;
else
- TEST_VERIFY (cmsg->cmsg_type != SO_TIMESTAMPNS_NEW);
+ TEST_VERIFY (cmsg->cmsg_type != COMPAT_SO_TIMESTAMPNS_NEW);
}
TEST_COMPARE (found_timestamp, sizeof (time_t) > 4);
@@ -151,7 +152,7 @@ do_test_small_buffer (bool mc)
/* Enable 32 bit timeval precision and check if no 64 bit timeval stamp
is created. */
{
- int r = setsockopt (srv, SOL_SOCKET, SO_TIMESTAMP_OLD, &(int){1},
+ int r = setsockopt (srv, SOL_SOCKET, COMPAT_SO_TIMESTAMP_OLD, &(int){1},
sizeof (int));
TEST_VERIFY_EXIT (r != -1);
@@ -172,10 +173,10 @@ do_test_small_buffer (bool mc)
if (cmsg->cmsg_level != SOL_SOCKET)
continue;
- if (sizeof (time_t) > 4 && cmsg->cmsg_type == SO_TIMESTAMP_NEW)
+ if (sizeof (time_t) > 4 && cmsg->cmsg_type == COMPAT_SO_TIMESTAMP_NEW)
found_timestamp = true;
else
- TEST_VERIFY (cmsg->cmsg_type != SO_TIMESTAMP_NEW);
+ TEST_VERIFY (cmsg->cmsg_type != COMPAT_SO_TIMESTAMP_NEW);
}
if (sizeof (time_t) > 4)
@@ -192,7 +193,7 @@ do_test_small_buffer (bool mc)
/* Same as before, but for timespec. */
{
- int r = setsockopt (srv, SOL_SOCKET, SO_TIMESTAMPNS_OLD, &(int){1},
+ int r = setsockopt (srv, SOL_SOCKET, COMPAT_SO_TIMESTAMPNS_OLD, &(int){1},
sizeof (int));
TEST_VERIFY_EXIT (r != -1);
@@ -213,10 +214,10 @@ do_test_small_buffer (bool mc)
if (cmsg->cmsg_level != SOL_SOCKET)
continue;
- if (sizeof (time_t) > 4 && cmsg->cmsg_type == SO_TIMESTAMPNS_NEW)
+ if (sizeof (time_t) > 4 && cmsg->cmsg_type == COMPAT_SO_TIMESTAMPNS_NEW)
found_timestamp = true;
else
- TEST_VERIFY (cmsg->cmsg_type != SO_TIMESTAMPNS_NEW);
+ TEST_VERIFY (cmsg->cmsg_type != COMPAT_SO_TIMESTAMPNS_NEW);
}
if (sizeof (time_t) > 4)
--
2.33.1