aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux/sparc/socket-constants-time64.h
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2020-09-07 14:13:58 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-06-14 18:00:06 -0300
commit8dfb169c80b56cf25494d052ddf410dc55f2f5a3 (patch)
tree47ef6107ecb9e9323c8703e5424b77676a27f743 /sysdeps/unix/sysv/linux/sparc/socket-constants-time64.h
parent5767b0ddcb592546fe8d978dd8f06904756373dd (diff)
downloadglibc-8dfb169c80b56cf25494d052ddf410dc55f2f5a3.tar
glibc-8dfb169c80b56cf25494d052ddf410dc55f2f5a3.tar.gz
glibc-8dfb169c80b56cf25494d052ddf410dc55f2f5a3.tar.bz2
glibc-8dfb169c80b56cf25494d052ddf410dc55f2f5a3.zip
linux: Add fallback for 64-bit time_t SO_{RCV,SND}TIMEO
The constant values will be changed for __TIMESIZE=64, so binaries built with 64-bit time support might fail to work properly on old kernels. Both {get,set}sockopt will retry the syscall with the old constant values and the timeout value adjusted when kernel returns ENOTPROTOPT. It also adds an internal only SO_{RCV,SND}TIMEO where COMPAT_SO_{RCV,SND}TIMEO_OLD indicates pre 32-bit time support and COMPAT_SO_{RCV,SND}TIMEO_NEW indicates time64 support. It allows to refer to constant independently of the time_t ABI and kernel version used. Checked on x86_64-linux-gnu and i686-linux-gnu (on 5.4 and on 4.15 kernel). Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'sysdeps/unix/sysv/linux/sparc/socket-constants-time64.h')
-rw-r--r--sysdeps/unix/sysv/linux/sparc/socket-constants-time64.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/sparc/socket-constants-time64.h b/sysdeps/unix/sysv/linux/sparc/socket-constants-time64.h
new file mode 100644
index 0000000000..f4668db537
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/socket-constants-time64.h
@@ -0,0 +1,30 @@
+/* Compat socket constants used in 64-bit compat code.
+ Copyright (C) 2021 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef _SOCKET_CONSTANTS_TIME64_H
+#define _SOCKET_CONSTANTS_TIME64_H
+
+/* The compat code requires the SO_* constants used for both 32 and 64-bit
+ time_t, however they were only added on v5.1 kernel. */
+
+#define COMPAT_SO_RCVTIMEO_OLD 8192
+#define COMPAT_SO_SNDTIMEO_OLD 16384
+#define COMPAT_SO_RCVTIMEO_NEW 68
+#define COMPAT_SO_SNDTIMEO_NEW 69
+
+#endif