glibc/sysdeps/unix/sysv/linux/powerpc/socket-constants-time64.h
Adhemerval Zanella 8dfb169c80 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>
2021-06-14 18:00:06 -03:00

31 lines
1.2 KiB
C

/* 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 18
#define COMPAT_SO_SNDTIMEO_OLD 19
#define COMPAT_SO_RCVTIMEO_NEW 66
#define COMPAT_SO_SNDTIMEO_NEW 67
#endif