[PATCH] msghdr: print SCM_TIMESTAMP* control messages

Miroslav Lichvar mlichvar at redhat.com
Thu Jun 15 08:06:47 UTC 2017


On Wed, Jun 14, 2017 at 07:05:07PM +0300, Dmitry V. Levin wrote:
> On Wed, Jun 14, 2017 at 04:23:31PM +0200, Miroslav Lichvar wrote:
> > @@ -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").

Ok. I guess I need to add new printing functions and check the length
there, but I'm not sure how to name them. Would the following work?

MPERS_PRINTER_DECL(void, print_timeval_data,
		   const void *arg, const size_t size)
MPERS_PRINTER_DECL(void, print_timespec_data,
		   const void *arg, const size_t size)
MPERS_PRINTER_DECL(void, print_timespec_array, const void *arg,
		   const unsigned int nmemb, const size_t size)

-- 
Miroslav Lichvar




More information about the Strace-devel mailing list