utmps: add WTMPX_FILE to utmpx.h

From: Xavier Stonestreet <xstonestreet_at_gmail.com>
Date: Sat, 10 Apr 2021 20:28:38 +0200


Since UTMPX_FILE is already defined I figure its W counterpart might
as well be defined.

>From a logical standpoint, updwtmpx(3) and utmpxname(3) requires the
path to the wtmp file as an argument, but the location of wtmp is
non-standard and varies by platform. Some packages use WTMPX_FILE as
the "portable" definition of this path.

>From a practical standpoint, the OpenSSH package relies on the
presence of this #define to enable its wtmpx update code during its
build configuration phase, and its wtmpx update code passes WTMPX_FILE
as the first argument to updwtmpx(3).

Despite their appearance the (U|W)TMPX_FILE macros may not be
GNU-isms. It looks like they were added to glibc for compatibility
with some *nix flavors. I found some references in some unexpected
places, such as SCO Unix [1] which puts them in /etc, and SGI Irix [2]
which puts them in /var/adm.

Here's a patch for your consideration:

--- utmps- 2020-12-28
11:33:23.000000000 +0100
+++ utmps- 2021-04-10
07:50:25.454249526 +0200
_at_@ -67,8 +67,9 @@

-/* Unused, but some packages (ex: procps-ng) require this macro to be
present */
+/* Unused, but some packages (ex: procps-ng) require these macros to
be present */
 #define UTMPX_FILE "/run/utmps/utmp"
+#define WTMPX_FILE "/run/utmps/wtmp"

 /* More old GNU/crap compatibility */
 #define ut_name ut_user
Other than that OpenSSH builds and works fine (on Linux-musl) with
utmps without any code change on either side.
[1] <http://osr507doc.sco.com/en/man/html.F/utmpx.F.html>
[2] <https://nixdoc.net/man-pages/IRIX/man4/utmpx.4.html>
Received on Sat Apr 10 2021 - 18:28:38 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:38:49 UTC