mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-28 00:21:52 +03:00
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>
This commit is contained in:
30
sysdeps/unix/sysv/linux/sparc/socket-constants-time64.h
Normal file
30
sysdeps/unix/sysv/linux/sparc/socket-constants-time64.h
Normal file
@ -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
|
Reference in New Issue
Block a user