[PATCH] msghdr: print SCM_TIMESTAMP* control messages

Dmitry V. Levin ldv at altlinux.org
Wed Jun 14 16:05:07 UTC 2017


On Wed, Jun 14, 2017 at 04:23:31PM +0200, Miroslav Lichvar wrote:
> Add support for printing control messages containing software or
> hardware timestamps, which are typically enabled by NTP and PTP
> implementations.
> 
> * print_timespec.c (print_struct_timespec): New function.
> * xlat/scmvals.in: Add SCM_TIMESTAMP* values.
> * msghdr.c (print_scm_timestamp, print_scm_timestampns,
>   print_scm_timestamping): New functions.
>   (cmsg_socket_printers): Add them.
> * tests/msg_control.c (test_scm_timestamp, test_scm_timestampns,
>   test_scm_timestamping): New functions.
>   (test_sol_socket): Use them.
> 
> Signed-off-by: Miroslav Lichvar <mlichvar at redhat.com>
> ---
>  msghdr.c            |  38 +++++++++++++++++++-
>  print_timespec.c    |   5 +++
>  tests/msg_control.c | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>  xlat/scmvals.in     |   4 +++
>  4 files changed, 146 insertions(+), 1 deletion(-)
[...]
> @@ -191,7 +224,10 @@ static const struct {
>  } cmsg_socket_printers[] = {
>  	[SCM_RIGHTS] = { print_scm_rights, sizeof(int) },
>  	[SCM_CREDENTIALS] = { print_scm_creds, sizeof(struct ucred) },
> -	[SCM_SECURITY] = { print_scm_security, 1 }
> +	[SCM_SECURITY] = { print_scm_security, 1 },
> +	[SCM_TIMESTAMP] = { print_scm_timestamp, sizeof(struct timeval) },
> +	[SCM_TIMESTAMPNS] = { print_scm_timestampns, sizeof(struct timespec) },
> +	[SCM_TIMESTAMPING] = { print_scm_timestamping, 3 * sizeof(struct timespec) }

As these sizes vary between personalities, I'm afraid this is not correct.
In fact, your own test fails for x86 personality on x86_64, you can see
this if you build strace in a system with -m32 runtime support (configure
output should contain "checking for -m32 runtime support... yes").


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20170614/1c887bde/attachment.bin>


More information about the Strace-devel mailing list