On Thu, Jun 15, 2017 at 10:06:47AM +0200, Miroslav Lichvar wrote: > 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)
If they were regular pure printers, nowadays they would be called - print_struct_timeval, - print_struct_timespec, - print_struct_timespec_array In fact, print_struct_timeval already exists and does exactly that. If you are going to add modifications of these functions that also accept data length along with data pointer, ideally this should be reflected in their name, e.g. print_struct_timeval_data_size. What do you think these functions should print in case the data size is smaller than necessary? A side note: new SCM_* constants are arch-specific. -- ldv
signature.asc
Description: PGP signature
------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________ Strace-devel mailing list Strace-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/strace-devel