sizeof(struct timeval)
Big and Blue
No_4 at dsl.pipex.com
Mon Mar 13 20:30:11 EST 2006
Tony Houghton wrote:
>
> How safe would I be assuming that
>
> sizeof(struct timeval) == 2 * sizeof(long)
>
> is always true on Linux on different architectures?
Based on what I was looking at today (well, yesterday now), you might
be wrong.
I do know that the size of a struct utmp differs between a Linux
Itanium system and a Linux x86_64 system, and I seem to recall it migh be
related to timeval. I could be wrong - I wasn't interested in the timeval
part - but this part of the bits/utmp.h include file indicates the issue:
/* The ut_session and ut_tv fields must be the same size when compiled
32- and 64-bit. This allows data files and shared memory to be
shared between 32- and 64-bit applications. */
#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32
int32_t ut_session; /* Session ID, used for windowing. */
struct
{
int32_t tv_sec; /* Seconds. */
int32_t tv_usec; /* Microseconds. */
} ut_tv; /* Time entry was made. */
#else
long int ut_session; /* Session ID, used for windowing. */
struct timeval ut_tv; /* Time entry was made. */
#endif
--
Just because I've written it doesn't mean that
either you or I have to believe it.
More information about the Python-list
mailing list