aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2023-02-09 18:35:34 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2023-02-13 13:58:41 +0000
commiteab9ed3d48e0842f3114d8582a4c2868a354190b (patch)
tree035488546af6b48611dc3e4eea93358b0a69bedf
parent2f43f145825d0d8468f583b1686262b0f40c1fe5 (diff)
downloadsrc-eab9ed3d48e0842f3114d8582a4c2868a354190b.tar.gz
src-eab9ed3d48e0842f3114d8582a4c2868a354190b.zip
tzcode: Resurrect tzsetwall(3) with a deprecation warning.
This function has been around since 4.4BSD but was dropped upstream in 2020. This went unnoticed when tzcode was updated. Bring it back, but prepare for removing it before 14.0 is released. PR: 269445 MFC after: 3 days Reported by: val@packett.cool Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D38445 (cherry picked from commit 71e0c8906e1a4ff774f8ae810aeb94af039eedb7)
-rw-r--r--contrib/tzcode/localtime.c21
-rw-r--r--lib/libc/gen/tzset.314
2 files changed, 28 insertions, 7 deletions
diff --git a/contrib/tzcode/localtime.c b/contrib/tzcode/localtime.c
index 1b52e26a5faf..a8beaf47319a 100644
--- a/contrib/tzcode/localtime.c
+++ b/contrib/tzcode/localtime.c
@@ -1517,9 +1517,8 @@ zoneinit(struct state *sp, char const *name)
}
static void
-tzset_unlocked(void)
+tzset_unlocked_name(char const *name)
{
- char const *name = getenv("TZ");
struct state *sp = lclptr;
int lcl = name ? strlen(name) < sizeof lcl_TZname : -1;
if (lcl < 0
@@ -1541,6 +1540,12 @@ tzset_unlocked(void)
lcl_is_set = lcl;
}
+static void
+tzset_unlocked(void)
+{
+ tzset_unlocked_name(getenv("TZ"));
+}
+
void
tzset(void)
{
@@ -1550,6 +1555,18 @@ tzset(void)
unlock();
}
+void
+freebsd13_tzsetwall(void)
+{
+ if (lock() != 0)
+ return;
+ tzset_unlocked_name(NULL);
+ unlock();
+}
+__sym_compat(tzsetwall, freebsd13_tzsetwall, FBSD_1.0);
+__warn_references(tzsetwall,
+ "warning: tzsetwall() is deprecated, use tzset() instead.");
+
static void
gmtcheck(void)
{
diff --git a/lib/libc/gen/tzset.3 b/lib/libc/gen/tzset.3
index ddeb40585f33..788a6259b727 100644
--- a/lib/libc/gen/tzset.3
+++ b/lib/libc/gen/tzset.3
@@ -31,7 +31,7 @@
.\" @(#)tzset.3 8.2 (Berkeley) 11/17/93
.\" $FreeBSD$
.\"
-.Dd November 17, 1993
+.Dd February 8, 2023
.Dt TZSET 3
.Os
.Sh NAME
@@ -102,10 +102,14 @@ is used.
.Pp
The
.Fn tzsetwall
-function
-sets things up so that
-.Xr localtime 3
-returns the best available approximation of local wall clock time.
+function is equivalent to calling
+.Fn tzset
+with the
+.Ev TZ
+environment variable unset.
+It is deprecated and may not be available in
+.Fx 14.0
+and later.
.Sh SPECIFICATION FORMAT
When
.Ev TZ