Message ID | 20200329041612.4071-1-vgupta@synopsys.com |
---|---|
State | Superseded |
Headers |
Return-Path: <Vineet.Gupta1@synopsys.com> X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from smtprelay-out1.synopsys.com (smtprelay-out1.synopsys.com [149.117.73.133]) by sourceware.org (Postfix) with ESMTPS id 3FB0A385E44C for <libc-alpha@sourceware.org>; Sun, 29 Mar 2020 04:16:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 3FB0A385E44C Received: from mailhost.synopsys.com (sv1-mailhost2.synopsys.com [10.205.2.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 56F8D40570; Sun, 29 Mar 2020 04:16:19 +0000 (UTC) Received: from vineetg-Latitude-E7450.internal.synopsys.com (unknown [10.13.182.230]) by mailhost.synopsys.com (Postfix) with ESMTP id 43D4AA0077; Sun, 29 Mar 2020 04:16:13 +0000 (UTC) From: Vineet Gupta <Vineet.Gupta1@synopsys.com> To: libc-alpha@sourceware.org Cc: Alistair Francis <alistair.francis@wdc.com>, Lukasz Majewski <lukma@denx.de>, Stepan Golosunov <stepan@golosunov.pp.ru>, linux-snps-arc@lists.infradead.org, Vineet Gupta <Vineet.Gupta1@synopsys.com> Subject: [PATCH] provide y2038 safe socket constants Date: Sat, 28 Mar 2020 21:16:12 -0700 Message-Id: <20200329041612.4071-1-vgupta@synopsys.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-20.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list <libc-alpha.sourceware.org> List-Unsubscribe: <http://sourceware.org/mailman/options/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe> List-Archive: <http://sourceware.org/pipermail/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-request@sourceware.org?subject=help> List-Subscribe: <http://sourceware.org/mailman/listinfo/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=subscribe> X-List-Received-Date: Sun, 29 Mar 2020 04:16:38 -0000 |
Series |
provide y2038 safe socket constants
|
|
Commit Message
Vineet Gupta
March 29, 2020, 4:16 a.m. UTC
These will be used by upcoming RV32 and ARC ports and any future ports
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
---
sysdeps/unix/sysv/linux/bits/socket-constants.h | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
Comments
ping ! On 3/28/20 9:16 PM, Vineet Gupta wrote: > These will be used by upcoming RV32 and ARC ports and any future ports > > Signed-off-by: Vineet Gupta <vgupta@synopsys.com> > --- > sysdeps/unix/sysv/linux/bits/socket-constants.h | 14 ++++++++++++-- > 1 file changed, 12 insertions(+), 2 deletions(-) > > diff --git a/sysdeps/unix/sysv/linux/bits/socket-constants.h b/sysdeps/unix/sysv/linux/bits/socket-constants.h > index 9dcc19cd5380..8a48ae7d0ca2 100644 > --- a/sysdeps/unix/sysv/linux/bits/socket-constants.h > +++ b/sysdeps/unix/sysv/linux/bits/socket-constants.h > @@ -20,6 +20,8 @@ > # error "Never include <bits/socket-constants.h> directly; use <sys/socket.h> instead." > #endif > > +#include <bits/timesize.h> > + > #define SOL_SOCKET 1 > #define SO_ACCEPTCONN 30 > #define SO_BROADCAST 6 > @@ -30,9 +32,17 @@ > #define SO_OOBINLINE 10 > #define SO_RCVBUF 8 > #define SO_RCVLOWAT 18 > -#define SO_RCVTIMEO 20 > +#if __TIMESIZE == 64 && __WORDSIZE == 32 > +# define SO_RCVTIMEO 66 > +#else > +# define SO_RCVTIMEO 20 > +#endif > #define SO_REUSEADDR 2 > #define SO_SNDBUF 7 > #define SO_SNDLOWAT 19 > -#define SO_SNDTIMEO 21 > +#if __TIMESIZE == 64 && __WORDSIZE == 32 > +# define SO_SNDTIMEO 67 > +#else > +# define SO_SNDTIMEO 21 > +#endif > #define SO_TYPE 3 >
* Vineet Gupta via Libc-alpha: > These will be used by upcoming RV32 and ARC ports and any future ports > > Signed-off-by: Vineet Gupta <vgupta@synopsys.com> > --- > sysdeps/unix/sysv/linux/bits/socket-constants.h | 14 ++++++++++++-- > 1 file changed, 12 insertions(+), 2 deletions(-) > > diff --git a/sysdeps/unix/sysv/linux/bits/socket-constants.h b/sysdeps/unix/sysv/linux/bits/socket-constants.h > index 9dcc19cd5380..8a48ae7d0ca2 100644 > --- a/sysdeps/unix/sysv/linux/bits/socket-constants.h > +++ b/sysdeps/unix/sysv/linux/bits/socket-constants.h What about the parallel changes to the sysdeps overrides? I would expect changes for hppa, mips, powerpc. (Not sure about the alpha situation.)
+CC libc-alpha which got lost in the thread. On 3/31/20 1:18 PM, Florian Weimer wrote: > * Vineet Gupta: > >> On 3/31/20 12:34 PM, Florian Weimer wrote: >>> What about the parallel changes to the sysdeps overrides? I would> expect changes for hppa, mips, powerpc. (Not sure about the alpha >>> situation.) >> >> This patch fixes the existing/future asm-generic ABI enabled arches >> and the ones you refer to are not. So IMHO that would be a separate >> patch if at all. > > Ahh, I think the commit message could make this clearer (although it > it's somewhat implied). Sure I can make it more explicit. > The commit message also lacks a period at the > end. Will fix for v2. > But is the conditional correct for x32? It has to be keep using the > old macro definitions. I was not sure as some of the other patches in area don't seem to do that. Hence I CC'ed Stephan who had earlier commented on x32.
On Tue, 31 Mar 2020, Florian Weimer wrote: > What about the parallel changes to the sysdeps overrides? I would > expect changes for hppa, mips, powerpc. (Not sure about the alpha > situation.) This fix is only about the case where the *default* ABI in glibc requires these different values. The header will need further changes (to use a conditional not based on __TIMESIZE) when _TIME_BITS=64 is supported on platforms that currently have 32-bit time_t. That's the point at which changes for other architectures are needed - once we have an appropriate conditional for "the current compilation uses 64-bit time but kernel long is 32-bit" (or something like that). I'm concerned the present patch is wrong for x32, however; that has __TIMESIZE == 64 && __WORDSIZE == 32 but should use the old values; the patch should be using __SYSCALL_WORDSIZE when available in place of __WORDSIZE.
On 3/31/20 1:45 PM, Joseph Myers wrote: > I'm concerned the present patch is wrong for x32, however; that has > __TIMESIZE == 64 && __WORDSIZE == 32 but should use the old values; the > patch should be using __SYSCALL_WORDSIZE when available in place of > __WORDSIZE. Something like below ? -#if __TIMESIZE == 64 && __WORDSIZE == 32 +#if TIMESIZE == 64 && (__WORDSIZE == 32 \ && (!defined __SYSCALL_WORDSIZE || __SYSCALL_WORDSIZE == 32)) Also is it ok to littler the code (multiple times, this patch and else where) with this or should we define a new __32BIT_ARCH_NOT_X32 or some such ?
On Tue, 31 Mar 2020, Vineet Gupta via Libc-alpha wrote: > On 3/31/20 1:45 PM, Joseph Myers wrote: > > I'm concerned the present patch is wrong for x32, however; that has > > __TIMESIZE == 64 && __WORDSIZE == 32 but should use the old values; the > > patch should be using __SYSCALL_WORDSIZE when available in place of > > __WORDSIZE. > > Something like below ? > > -#if __TIMESIZE == 64 && __WORDSIZE == 32 > > +#if TIMESIZE == 64 && (__WORDSIZE == 32 \ > && (!defined __SYSCALL_WORDSIZE || __SYSCALL_WORDSIZE == 32)) Yes, that sort of thing.
diff --git a/sysdeps/unix/sysv/linux/bits/socket-constants.h b/sysdeps/unix/sysv/linux/bits/socket-constants.h index 9dcc19cd5380..8a48ae7d0ca2 100644 --- a/sysdeps/unix/sysv/linux/bits/socket-constants.h +++ b/sysdeps/unix/sysv/linux/bits/socket-constants.h @@ -20,6 +20,8 @@ # error "Never include <bits/socket-constants.h> directly; use <sys/socket.h> instead." #endif +#include <bits/timesize.h> + #define SOL_SOCKET 1 #define SO_ACCEPTCONN 30 #define SO_BROADCAST 6 @@ -30,9 +32,17 @@ #define SO_OOBINLINE 10 #define SO_RCVBUF 8 #define SO_RCVLOWAT 18 -#define SO_RCVTIMEO 20 +#if __TIMESIZE == 64 && __WORDSIZE == 32 +# define SO_RCVTIMEO 66 +#else +# define SO_RCVTIMEO 20 +#endif #define SO_REUSEADDR 2 #define SO_SNDBUF 7 #define SO_SNDLOWAT 19 -#define SO_SNDTIMEO 21 +#if __TIMESIZE == 64 && __WORDSIZE == 32 +# define SO_SNDTIMEO 67 +#else +# define SO_SNDTIMEO 21 +#endif #define SO_TYPE 3