Back to the Future - 64-bit time_t on sparc64

Garance A Drosihn drosih at
Fri Feb 20 14:13:14 PST 2004

At 7:56 PM -0800 2/19/04, Marcel Moolenaar wrote:
>On Thu, Feb 19, 2004, Garance A Drosihn wrote:
>  >
>>  My basic plan is to commit these three files to /usr/src on
>  > March 1st.  ...   Then, at some later date, we'd commit the
>  > change to /usr/src/sys/sparc64/include/_types.h which makes
>  > the switch, and add an entry in /usr/src/UPDATING ...
>  >
>>  Does this seem reasonable?
>Is there a way we can avoid footshooting?
>For example: check if /usr/include/machine/_types.h is equal to
>the one in the source tree and disallow installworld without
>some special define if they're not. The scripts use the define
>to circumvent the anti-footshooting measure. Something along
>those lines...

I would really like to have something like this, but I doubt I
have the time to make it happen.  I am not quite sure how it
would be hooked up to the buildworld/installworld process, either.
Maybe Ruslan could help me out there.

In thinking about this, I think the simplest solution would be
some program which is compiled & run at buildworld time, and
which is also run at installworld time.  We would want it to
run it as early as possible in the processing of those targets.

I *think* what would work is something like:
In /etc/make.conf, users would define:


If neither is defined, than 32-bit is assumed.

You then have a program in buildworld which simply looks at the
length of time_t that it finds at compile-time, and prints out
a single-line which says '64bit' or '32bit'.

Then, in both buildworld and installworld (and maybe buildkernel
and installkernel), you add logic which says something vaguely

    if [ "${SPARCWORLD_TIMET}" !=  "`check_program`" ] then
       echo "You are building a $FOUND_TIMET system, but you seem"
       echo "to expect to build a $SPARCWORLD_TIMET system.  You"
       echo "must either modify /etc/make.conf to add:"
       echo "or edit /usr/src/sys/sparc64/include/_types.h to"
       echo "change the type of __time_t to be <right-value>"
       exit 1

If I've done this right, then people will be forced to add
SPARCWORLD_TIMET=64bit  to their /etc/make.conf when they
make the switch to 64-bit time_t's.  Once they do that, though,
they can be reasonably sure they will never mistakenly build or
install a 32-bit time_t system over an already-64-bit system.

I am certain that there are some details I have overlooked, but I
really don't have the time to think it through right now.

Garance Alistair Drosehn            =   gad at
Senior Systems Programmer           or  gad at
Rensselaer Polytechnic Institute    or  drosih at

More information about the freebsd-sparc64 mailing list