[PATCH v3 1/2] support: Add support_socket_so_timestamp_time64
Florian Weimer
fweimer@redhat.com
Fri Jan 21 12:16:08 GMT 2022
* 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?
Thanks,
Florian
More information about the Libc-alpha
mailing list