struct timeval
Bill Fenner
fenner at research.att.com
Wed Jul 30 21:52:54 PDT 2003
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
More information about the freebsd-standards
mailing list