hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/include/uapi/linux/sockios.h
....@@ -19,6 +19,7 @@
1919 #ifndef _LINUX_SOCKIOS_H
2020 #define _LINUX_SOCKIOS_H
2121
22
+#include <asm/bitsperlong.h>
2223 #include <asm/sockios.h>
2324
2425 /* Linux-specific socket ioctls */
....@@ -27,6 +28,26 @@
2728
2829 #define SOCK_IOC_TYPE 0x89
2930
31
+/*
32
+ * the timeval/timespec data structure layout is defined by libc,
33
+ * so we need to cover both possible versions on 32-bit.
34
+ */
35
+/* Get stamp (timeval) */
36
+#define SIOCGSTAMP_NEW _IOR(SOCK_IOC_TYPE, 0x06, long long[2])
37
+/* Get stamp (timespec) */
38
+#define SIOCGSTAMPNS_NEW _IOR(SOCK_IOC_TYPE, 0x07, long long[2])
39
+
40
+#if __BITS_PER_LONG == 64 || (defined(__x86_64__) && defined(__ILP32__))
41
+/* on 64-bit and x32, avoid the ?: operator */
42
+#define SIOCGSTAMP SIOCGSTAMP_OLD
43
+#define SIOCGSTAMPNS SIOCGSTAMPNS_OLD
44
+#else
45
+#define SIOCGSTAMP ((sizeof(struct timeval)) == 8 ? \
46
+ SIOCGSTAMP_OLD : SIOCGSTAMP_NEW)
47
+#define SIOCGSTAMPNS ((sizeof(struct timespec)) == 8 ? \
48
+ SIOCGSTAMPNS_OLD : SIOCGSTAMPNS_NEW)
49
+#endif
50
+
3051 /* Routing table calls. */
3152 #define SIOCADDRT 0x890B /* add routing table entry */
3253 #define SIOCDELRT 0x890C /* delete routing table entry */