Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Jul 2003 21:52:48 -0700
From:      Bill Fenner <fenner@research.att.com>
To:        kris@obsecurity.org
Cc:        standards@freebsd.org
Subject:   Re: struct timeval
Message-ID:  <200307310452.h6V4qn402047@windsor.research.att.com>
References:  <20030615053705.GA15421@rot13.obsecurity.org> <20030729000206.GA92727@rot13.obsecurity.org> <20030728234338.B94307@espresso.q9media.com> <20030729042506.GA61736@rot13.obsecurity.org>

next in thread | previous in thread | raw e-mail | index | archive | help

I think we can do this with old-binary-on-new-kernel compatability,
by putting in explicit padding that can be zeroed by the kernel.
new-binary-on-old-kernel should also work, since the explicit padding
in the struct can put the time_t in the right place.

My strawman is something like:

struct timeval {
#ifdef __sparc64__
	uint32_t	__pad;
#endif
	time_t		tv_sec;
#ifdef __alpha__
	uint32_t	__pad;
#endif
	suseconds_t	tv_usec;
}

and anything that returns a timeval has to

#if defined(__sparc64__) || defined(__alpha__)
	tv->__pad = 0;
#endif

POSIX 1003.1-2001 says:

sys/time.h - time types

#include <sys/time.h> 

The <sys/time.h> header shall define the timeval structure that includes
at least the following members:

time_t         tv_sec      Seconds.
suseconds_t    tv_usec     Microseconds. 

so the optional padding is OK and the type of tv_sec is correct.

  Bill



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200307310452.h6V4qn402047>