summaryrefslogtreecommitdiff
path: root/include/uapi/asm-generic/sockios.h
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2019-04-17 23:56:11 +0300
committerDavid S. Miller <davem@davemloft.net>2019-04-20 00:07:40 +0300
commit0768e17073dc527ccd18ed5f96ce85f9985e9115 (patch)
tree4f9898446f998dd34bd56f5329dcc4bbd97f92d5 /include/uapi/asm-generic/sockios.h
parent5ce5d8a5a4ae64b281bea7ae028c960f12acae21 (diff)
downloadlinux-0768e17073dc527ccd18ed5f96ce85f9985e9115.tar.xz
net: socket: implement 64-bit timestamps
The 'timeval' and 'timespec' data structures used for socket timestamps are going to be redefined in user space based on 64-bit time_t in future versions of the C library to deal with the y2038 overflow problem, which breaks the ABI definition. Unlike many modern ioctl commands, SIOCGSTAMP and SIOCGSTAMPNS do not use the _IOR() macro to encode the size of the transferred data, so it remains ambiguous whether the application uses the old or new layout. The best workaround I could find is rather ugly: we redefine the command code based on the size of the respective data structure with a ternary operator. This lets it get evaluated as late as possible, hopefully after that structure is visible to the caller. We cannot use an #ifdef here, because inux/sockios.h might have been included before any libc header that could determine the size of time_t. The ioctl implementation now interprets the new command codes as always referring to the 64-bit structure on all architectures, while the old architecture specific command code still refers to the old architecture specific layout. The new command number is only used when they are actually different. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/uapi/asm-generic/sockios.h')
-rw-r--r--include/uapi/asm-generic/sockios.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/uapi/asm-generic/sockios.h b/include/uapi/asm-generic/sockios.h
index 64f658c7cec2..44fa3ed70483 100644
--- a/include/uapi/asm-generic/sockios.h
+++ b/include/uapi/asm-generic/sockios.h
@@ -8,7 +8,7 @@
#define FIOGETOWN 0x8903
#define SIOCGPGRP 0x8904
#define SIOCATMARK 0x8905
-#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
-#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
+#define SIOCGSTAMP_OLD 0x8906 /* Get stamp (timeval) */
+#define SIOCGSTAMPNS_OLD 0x8907 /* Get stamp (timespec) */
#endif /* __ASM_GENERIC_SOCKIOS_H */