[PATCH v3 1/2] support: Add support_socket_so_timestamp_time64

Adhemerval Zanella adhemerval.zanella@linaro.org
Mon Jan 24 11:45:26 GMT 2022



On 21/01/2022 09:16, Florian Weimer wrote:
> * Adhemerval Zanella:
> 
>> +bool
>> +support_socket_so_timestamp_time64 (int fd)
>> +{
>> +#ifdef __linux__
>> +# if __LINUX_KERNEL_VERSION >= 0x050100                          \
>> +   || __WORDSIZE == 64                                           \
>> +   || (defined __SYSCALL_WORDSIZE && __SYSCALL_WORDSIZE == 64)
>> +  return true;
>> +# else
>> +  int level = SOL_SOCKET;
>> +  int optname = COMPAT_SO_TIMESTAMP_NEW;
>> +  int optval;
>> +  socklen_t len = sizeof (optval);
>> +
>> +  int r = syscall (__NR_getsockopt, fd, level, optname, &optval, &len);
>> +#  ifdef __NR_socketcall
>> +  if (r == -1 && errno == ENOSYS)
>> +    {
>> +      long int args[] = { fd, level, optname, (long int) &optval,
>> +			  sizeof (optval) };
>> +      r = syscall (__NR_socketcall, 15 /* SOCKOP_getsockopt  */ , args);
>> +    }
>> +#  endif
>> +  return r != -1;
>> +# endif
>> +#else
>> +  return false;
>> +#endif
>> +}
> 
> Is the socketcall fallback really required?  Why would anyone backport
> time64 support without also backporting direct system call support?
> 

It does not make sense indeed, all supported architecture already support 
direct socket syscall with a kernel with 64 bit time_t support (v5.1.).
I will remove it.


More information about the Libc-alpha mailing list