[PATCH] provide y2038 safe socket constants

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] provide y2038 safe socket constants

Sourceware - libc-alpha mailing list
These will be used by upcoming RV32 and ARC ports and any future ports

Signed-off-by: Vineet Gupta <[hidden email]>
---
 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
--
2.20.1

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] provide y2038 safe socket constants

Sourceware - libc-alpha mailing list
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 <[hidden email]>
> ---
>  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
>

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] provide y2038 safe socket constants

Florian Weimer
In reply to this post by Sourceware - libc-alpha mailing list
* Vineet Gupta via Libc-alpha:

> These will be used by upcoming RV32 and ARC ports and any future ports
>
> Signed-off-by: Vineet Gupta <[hidden email]>
> ---
>  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.)
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] provide y2038 safe socket constants

Sourceware - libc-alpha mailing list
+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.


Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] provide y2038 safe socket constants

Joseph Myers
In reply to this post by Florian Weimer
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.

--
Joseph S. Myers
[hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] provide y2038 safe socket constants

Sourceware - libc-alpha mailing list
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 ?
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] provide y2038 safe socket constants

Joseph Myers
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.

--
Joseph S. Myers
[hidden email]
Reply | Threaded
Open this post in threaded view
|

[PATCH v2] provide y2038 safe socket constants for default/asm-generic ABI

Sourceware - libc-alpha mailing list
These will be used by upcoming RV32 and ARC ports and any future ports.

Signed-off-by: Alistair Francis <[hidden email]>
Signed-off-by: Vineet Gupta <[hidden email]>
---
This is a straight copy of code originally written by Alistair, hence
adding his SOB as well
---
 sysdeps/unix/sysv/linux/bits/socket-constants.h | 16 ++++++++++++++--
 1 file changed, 14 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..d02e1cbc7cf1 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,19 @@
 #define SO_OOBINLINE 10
 #define SO_RCVBUF 8
 #define SO_RCVLOWAT 18
-#define SO_RCVTIMEO 20
+#if (__TIMESIZE == 64 && __WORDSIZE == 32 \
+     && (!defined __SYSCALL_WORDSIZE || __SYSCALL_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 \
+     && (!defined __SYSCALL_WORDSIZE || __SYSCALL_WORDSIZE == 32))
+# define SO_SNDTIMEO 67
+#else
+# define SO_SNDTIMEO 21
+#endif
 #define SO_TYPE 3
--
2.20.1

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v2] provide y2038 safe socket constants for default/asm-generic ABI

Sourceware - libc-alpha mailing list
On 3/31/20 2:32 PM, Vineet Gupta via Libc-alpha wrote:
> These will be used by upcoming RV32 and ARC ports and any future ports.
>
> Signed-off-by: Alistair Francis <[hidden email]>
> Signed-off-by: Vineet Gupta <[hidden email]>

ping !

> ---
> This is a straight copy of code originally written by Alistair, hence
> adding his SOB as well
> ---
>  sysdeps/unix/sysv/linux/bits/socket-constants.h | 16 ++++++++++++++--
>  1 file changed, 14 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..d02e1cbc7cf1 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,19 @@
>  #define SO_OOBINLINE 10
>  #define SO_RCVBUF 8
>  #define SO_RCVLOWAT 18
> -#define SO_RCVTIMEO 20
> +#if (__TIMESIZE == 64 && __WORDSIZE == 32 \
> +     && (!defined __SYSCALL_WORDSIZE || __SYSCALL_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 \
> +     && (!defined __SYSCALL_WORDSIZE || __SYSCALL_WORDSIZE == 32))
> +# define SO_SNDTIMEO 67
> +#else
> +# define SO_SNDTIMEO 21
> +#endif
>  #define SO_TYPE 3
>

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v2] provide y2038 safe socket constants for default/asm-generic ABI

Sourceware - libc-alpha mailing list
On 4/6/20 11:55 AM, Vineet Gupta via Libc-alpha wrote:
> On 3/31/20 2:32 PM, Vineet Gupta via Libc-alpha wrote:
>> These will be used by upcoming RV32 and ARC ports and any future ports.
>>
>> Signed-off-by: Alistair Francis <[hidden email]>
>> Signed-off-by: Vineet Gupta <[hidden email]>
>
> ping !

ping ^2 !

>
>> ---
>> This is a straight copy of code originally written by Alistair, hence
>> adding his SOB as well
>> ---
>>  sysdeps/unix/sysv/linux/bits/socket-constants.h | 16 ++++++++++++++--
>>  1 file changed, 14 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..d02e1cbc7cf1 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,19 @@
>>  #define SO_OOBINLINE 10
>>  #define SO_RCVBUF 8
>>  #define SO_RCVLOWAT 18
>> -#define SO_RCVTIMEO 20
>> +#if (__TIMESIZE == 64 && __WORDSIZE == 32 \
>> +     && (!defined __SYSCALL_WORDSIZE || __SYSCALL_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 \
>> +     && (!defined __SYSCALL_WORDSIZE || __SYSCALL_WORDSIZE == 32))
>> +# define SO_SNDTIMEO 67
>> +#else
>> +# define SO_SNDTIMEO 21
>> +#endif
>>  #define SO_TYPE 3
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v2] provide y2038 safe socket constants for default/asm-generic ABI

Joseph Myers
In reply to this post by Sourceware - libc-alpha mailing list
This patch is OK.

--
Joseph S. Myers
[hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v2] provide y2038 safe socket constants for default/asm-generic ABI

Sourceware - libc-alpha mailing list
On 4/17/20 4:20 PM, Joseph Myers wrote:
> This patch is OK.

For commit now ?
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v2] provide y2038 safe socket constants for default/asm-generic ABI

Sourceware - libc-alpha mailing list
In reply to this post by Joseph Myers
On 4/17/20 4:20 PM, Joseph Myers wrote:
> This patch is OK.
>

pushed !

Thx,
-vineet