Kill tz_minuteswest and tz_dsttime.

Research Unix, 7th Edition introduced TIMEZONE and DSTFLAG
compile-time constants in sys/param.h to communicate these values for
the machine. 4.2BSD moved from the compile-time to run-time and
introduced these variables and used for localtime() to return the
right offset from UTC (sometimes referred to as GMT, for this purpose
is the same). 4.4BSD migrated to using the tzdata code/database and
these variables were basically unused.

FreeBSD removed the real need for these with adjkerntz in
1995. However, some RTC clocks continued to use these variables,
though they were largely unused otherwise.  Later, phk centeralized
most of the uses in utc_offset, but left it using both tz_minuteswest
and adjkerntz.

POSIX (IEEE Std 1003.1-2017) states in the gettimeofday specification
"If tzp is not a null pointer, the behavior is unspecified" so there's
no standards reason to retain it anymore. In fact, gettimeofday has
been marked as obsolecent, meaning it could be removed from a future
release of the standard. It is the only interface defined in POSIX
that references these two values. All other references come from the
tzdata database via tzset().

These were used to more faithfully implement early unix ABIs which
have been removed from FreeBSD.  NetBSD has completely eliminated
these variables years ago. Linux has migrated to tzdata as well,
though these variables technically still exist for compatibility
with unspecified older programs.

So, there's no real reason to have them these days. They are a
historical vestige that's no longer used in any meaningful way.

Reviewed By: jhb@, brooks@
Differential Revision: https://reviews.freebsd.org/D19550
This commit is contained in:
Warner Losh 2019-03-12 04:49:47 +00:00
parent 42a5a356a8
commit 329f0aa952
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=345049
5 changed files with 7 additions and 20 deletions

View File

@ -674,8 +674,8 @@ linux_gettimeofday(struct thread *td, struct linux_gettimeofday_args *uap)
error = copyout(&atv32, uap->tp, sizeof(atv32));
}
if (error == 0 && uap->tzp != NULL) {
rtz.tz_minuteswest = tz_minuteswest;
rtz.tz_dsttime = tz_dsttime;
rtz.tz_minuteswest = 0;
rtz.tz_dsttime = 0;
error = copyout(&rtz, uap->tzp, sizeof(rtz));
}
return (error);

View File

@ -834,8 +834,8 @@ freebsd32_gettimeofday(struct thread *td,
error = copyout(&atv32, uap->tp, sizeof (atv32));
}
if (error == 0 && uap->tzp != NULL) {
rtz.tz_minuteswest = tz_minuteswest;
rtz.tz_dsttime = tz_dsttime;
rtz.tz_minuteswest = 0;
rtz.tz_dsttime = 0;
error = copyout(&rtz, uap->tzp, sizeof (rtz));
}
return (error);

View File

@ -660,8 +660,8 @@ sys_gettimeofday(struct thread *td, struct gettimeofday_args *uap)
error = copyout(&atv, uap->tp, sizeof (atv));
}
if (error == 0 && uap->tzp != NULL) {
rtz.tz_minuteswest = tz_minuteswest;
rtz.tz_dsttime = tz_dsttime;
rtz.tz_minuteswest = 0;
rtz.tz_dsttime = 0;
error = copyout(&rtz, uap->tzp, sizeof (rtz));
}
return (error);
@ -713,10 +713,6 @@ kern_settimeofday(struct thread *td, struct timeval *tv, struct timezone *tzp)
return (EINVAL);
error = settime(td, tv);
}
if (tzp && error == 0) {
tz_minuteswest = tzp->tz_minuteswest;
tz_dsttime = tzp->tz_dsttime;
}
return (error);
}

View File

@ -52,9 +52,6 @@ __FBSDID("$FreeBSD$");
#include <sys/sysctl.h>
#include <sys/timetc.h>
int tz_minuteswest;
int tz_dsttime;
/*
* The adjkerntz and wall_cmos_clock sysctls are in the "machdep" sysctl
* namespace because they were misplaced there originally.
@ -386,5 +383,5 @@ int
utc_offset(void)
{
return (tz_minuteswest * 60 + (wall_cmos_clock ? adjkerntz : 0));
return (wall_cmos_clock ? adjkerntz : 0);
}

View File

@ -51,12 +51,6 @@
#ifdef _KERNEL /* No user serviceable parts */
/*
* Timezone info from settimeofday(2), usually not used
*/
extern int tz_minuteswest;
extern int tz_dsttime;
int utc_offset(void);
/*