From 170aafe0986323f85962e9440e939722e2a72c9c Mon Sep 17 00:00:00 2001
From: Sascha Wildner <saw@online.de>
Date: Sun, 4 Aug 2019 14:39:27 +0200
Subject: [PATCH 15/18] Remove SUPPORT_UTMPX defines and checks.

---
 bin/date/Makefile                            |  1 -
 bin/date/date.c                              |  6 -----
 lib/libpam/modules/pam_lastlog/pam_lastlog.c | 16 ------------
 libexec/talkd/Makefile                       |  2 +-
 libexec/telnetd/Makefile                     |  3 +--
 libexec/telnetd/sys_term.c                   |  4 ---
 sbin/init/Makefile                           |  1 -
 sbin/init/init.c                             | 20 ---------------
 sbin/reboot/Makefile                         |  1 -
 sbin/reboot/reboot.c                         |  4 ---
 usr.bin/finger/Makefile                      |  2 +-
 usr.bin/last/Makefile                        |  2 +-
 usr.bin/last/last.c                          | 12 ---------
 usr.bin/systat/Makefile                      |  2 +-
 usr.bin/users/Makefile                       |  2 +-
 usr.bin/w/Makefile                           |  1 -
 usr.bin/w/w.c                                | 20 +--------------
 usr.bin/wall/Makefile                        |  2 +-
 usr.bin/who/Makefile                         |  3 ---
 usr.bin/who/utmpentry.c                      | 27 --------------------
 usr.bin/who/utmpentry.h                      | 10 +++-----
 usr.bin/who/who.c                            |  4 ---
 usr.bin/write/Makefile                       |  2 +-
 23 files changed, 13 insertions(+), 134 deletions(-)

diff --git a/bin/date/Makefile b/bin/date/Makefile
index 0278154b98..8f51898d23 100644
--- a/bin/date/Makefile
+++ b/bin/date/Makefile
@@ -3,7 +3,6 @@
 
 PROG=	date
 SRCS=	date.c vary.c
-CFLAGS+=-DSUPPORT_UTMPX
 
 DPADD=	${LIBUTIL}
 LDADD=	-lutil
diff --git a/bin/date/date.c b/bin/date/date.c
index fac762e6f4..5df335228f 100644
--- a/bin/date/date.c
+++ b/bin/date/date.c
@@ -43,9 +43,7 @@
 #include <unistd.h>
 #include <locale.h>
 #include <libutil.h>
-#ifdef SUPPORT_UTMPX
 #include <utmpx.h>
-#endif
 
 #include "vary.h"
 
@@ -255,16 +253,12 @@ setthetime(const char *fmt, const char *p, int jflag)
 		errx(1, "nonexistent time");
 
 	if (!jflag) {
-#ifdef SUPPORT_UTMPX
 		logwtmpx("|", "date", "", 0, OLD_TIME);
-#endif
 		tv.tv_sec = tval;
 		tv.tv_usec = 0;
 		if (settimeofday(&tv, NULL))
 			err(1, "settimeofday (timeval)");
-#ifdef SUPPORT_UTMPX
 		logwtmpx("{", "date", "", 0, NEW_TIME);
-#endif
 
 		if ((p = getlogin()) == NULL)
 			p = "???";
diff --git a/lib/libpam/modules/pam_lastlog/pam_lastlog.c b/lib/libpam/modules/pam_lastlog/pam_lastlog.c
index 617e45f98d..cd3561fa6b 100644
--- a/lib/libpam/modules/pam_lastlog/pam_lastlog.c
+++ b/lib/libpam/modules/pam_lastlog/pam_lastlog.c
@@ -64,21 +64,13 @@
 #include <security/pam_modules.h>
 #include <security/pam_mod_misc.h>
 
-#define SUPPORT_UTMPX 1
-
-#ifdef SUPPORT_UTMPX
 #include <utmpx.h>
 static void doutmpx(const char *, const char *, const char *,
     const struct sockaddr_storage *ss, const struct timeval *);
 static void dolastlogx(pam_handle_t *, int, const struct passwd *, const char *,
     const char *, const struct sockaddr_storage *ss, const struct timeval *);
-#endif
-
-#if defined(SUPPORT_UTMPX)
 static void domsg(pam_handle_t *, time_t, const char *, size_t, const char *,
     size_t);
-#endif
-
 static void logit(int, const char *, ...) __printflike(2, 3);
 
 static void
@@ -157,11 +149,9 @@ pam_sm_open_session(pam_handle_t *pamh, int flags,
 		quiet = 0;
 #endif
 	}
-#ifdef SUPPORT_UTMPX
 	dolastlogx(pamh, quiet, pwd, rhost, tty, NULL, &now);
 	doutmpx(user, rhost, tty, NULL, &now);
 	quiet = 1;
-#endif
 err:
 	if (openpam_get_option(pamh, "no_fail"))
 		return PAM_SUCCESS;
@@ -186,18 +176,15 @@ pam_sm_close_session(pam_handle_t *pamh __unused, int flags __unused,
 	if (*tty == '\0')
 		return PAM_SERVICE_ERR;
 
-#ifdef SUPPORT_UTMPX
 	if (logoutx(tty, 0, DEAD_PROCESS))
 		logwtmpx(tty, "", "", 0, DEAD_PROCESS);
 	else
 		logit(LOG_NOTICE, "%s(): no utmpx record for %s",
 		    __func__, tty);
-#endif
 
         return PAM_SUCCESS;
 }
 
-#if defined(SUPPORT_UTMPX)
 static void
 domsg(pam_handle_t *pamh, time_t t, const char *host, size_t hsize,
     const char *line, size_t lsize)
@@ -217,9 +204,7 @@ domsg(pam_handle_t *pamh, time_t t, const char *host, size_t hsize,
 	if (pam_err == PAM_SUCCESS && promptresp)
 		free(promptresp);
 }
-#endif
 
-#ifdef SUPPORT_UTMPX
 static void
 doutmpx(const char *username, const char *hostname, const char *tty,
     const struct sockaddr_storage *ss, const struct timeval *now)
@@ -284,6 +269,5 @@ dolastlogx(pam_handle_t *pamh, int quiet, const struct passwd *pwd,
 	PAM_LOG("Login recorded in %s", _PATH_LASTLOGX);
 #endif
 }
-#endif
 
 PAM_MODULE_ENTRY("pam_lastlog");
diff --git a/libexec/talkd/Makefile b/libexec/talkd/Makefile
index 96f478eb96..91b8a1ea79 100644
--- a/libexec/talkd/Makefile
+++ b/libexec/talkd/Makefile
@@ -11,6 +11,6 @@ DPADD=	${LIBUTIL}
 LDADD=	-lutil
 
 CFLAGS+=-I${.CURDIR}/../../usr.bin/wall
-CFLAGS+=-I${.CURDIR}/../../usr.bin/who -DSUPPORT_UTMPX
+CFLAGS+=-I${.CURDIR}/../../usr.bin/who
 
 .include <bsd.prog.mk>
diff --git a/libexec/telnetd/Makefile b/libexec/telnetd/Makefile
index 0451b667f9..5c1c0cdc99 100644
--- a/libexec/telnetd/Makefile
+++ b/libexec/telnetd/Makefile
@@ -11,8 +11,7 @@ SRCS=		authenc.c global.c slc.c state.c sys_term.c telnetd.c \
 
 WARNS?=		2
 
-CFLAGS+=	-DLINEMODE -DUSE_TERMIO -DDIAGNOSTICS
-CFLAGS+=	-DOLD_ENVIRON -DENV_HACK -DSUPPORT_UTMPX
+CFLAGS+=	-DLINEMODE -DUSE_TERMIO -DDIAGNOSTICS -DOLD_ENVIRON -DENV_HACK
 CFLAGS+=	-I${.CURDIR}/../../lib
 
 .if !defined(NO_INET6)
diff --git a/libexec/telnetd/sys_term.c b/libexec/telnetd/sys_term.c
index a11b0def31..ae20362402 100644
--- a/libexec/telnetd/sys_term.c
+++ b/libexec/telnetd/sys_term.c
@@ -34,9 +34,7 @@
 #include <sys/tty.h>
 #include <libutil.h>
 #include <stdlib.h>
-#ifdef SUPPORT_UTMPX
 #include <utmpx.h>
-#endif
 
 #include "telnetd.h"
 #include "pathnames.h"
@@ -1323,10 +1321,8 @@ cleanup(int sig __unused)
 	 */
 	sigfillset(&mask);
 	sigprocmask(SIG_SETMASK, &mask, NULL);
-#ifdef SUPPORT_UTMPX
 	if (logoutx(p, 0, DEAD_PROCESS))
 		logwtmpx(p, "", "", 0, DEAD_PROCESS);
-#endif
 	(void)chmod(line, 0666);
 	(void)chown(line, 0, 0);
 	*p = 'p';
diff --git a/sbin/init/Makefile b/sbin/init/Makefile
index 91c2d2f5ec..279397b4ed 100644
--- a/sbin/init/Makefile
+++ b/sbin/init/Makefile
@@ -10,7 +10,6 @@ INSTALLFLAGS= -b -B.bak
 INSTALLFLAGS+= -fschg
 .endif
 CFLAGS+=-DDEBUGSHELL -DSECURE -DLOGIN_CAP -DCOMPAT_SYSV_INIT
-CFLAGS+=-DSUPPORT_UTMPX
 DPADD=	${LIBUTIL} ${LIBCRYPT} ${LIBCRYPTO}
 LDADD=	-lutil -lcrypt -lprivate_crypto
 LDFLAGS+=	${PRIVATELIB_LDFLAGS}
diff --git a/sbin/init/init.c b/sbin/init/init.c
index 3cfac9f984..3130d38291 100644
--- a/sbin/init/init.c
+++ b/sbin/init/init.c
@@ -196,7 +196,6 @@ static void	add_session(session_t *);
 static void	del_session(session_t *);
 static session_t *find_session(pid_t);
 
-#ifdef SUPPORT_UTMPX
 static struct timeval boot_time;
 state_t current_state = death;
 static void session_utmpx(const session_t *, int);
@@ -204,7 +203,6 @@ static void make_utmpx(const char *, const char *, int, pid_t,
     const struct timeval *, int);
 static char get_runlevel(const state_t);
 static void utmpx_set_runlevel(char, char);
-#endif
 
 static int Reboot = FALSE;
 static int howto = RB_AUTOBOOT;
@@ -225,9 +223,7 @@ main(int argc, char *argv[])
 	sigset_t mask;
 	struct stat sts;
 
-#ifdef SUPPORT_UTMPX
 	(void)gettimeofday(&boot_time, NULL);
-#endif /* SUPPORT_UTMPX */
 
 	/* Dispose of random users. */
 	if (getuid() != 0)
@@ -595,11 +591,9 @@ static void
 transition(state_t s)
 {
 	for (;;) {
-#ifdef SUPPORT_UTMPX
 		utmpx_set_runlevel(get_runlevel(current_state),
 		    get_runlevel(s));
 		current_state = s;
-#endif
 		s = (*state_funcs[s])();
 	}
 }
@@ -612,10 +606,8 @@ clear_session_logs(session_t *sp)
 {
 	char *line = sp->se_device + sizeof(_PATH_DEV) - 1;
 
-#ifdef SUPPORT_UTMPX
 	if (logoutx(line, 0, DEAD_PROCESS))
 		 logwtmpx(line, "", "", 0, DEAD_PROCESS);
-#endif
 }
 
 /*
@@ -876,9 +868,7 @@ f_runcom(void)
 		return single_user;
 
 	runcom_mode = AUTOBOOT;		/* the default */
-#ifdef SUPPORT_UTMPX
 	logwtmpx("~", "reboot", "", 0, INIT_PROCESS);
-#endif
 	return read_ttys;
 }
 
@@ -916,9 +906,7 @@ add_session(session_t *sp)
 
 	if ((*session_db->put)(session_db, &key, &data, 0))
 		emergency("insert %d: %s", sp->se_process, strerror(errno));
-#ifdef SUPPORT_UTMPX
 	session_utmpx(sp, 1);
-#endif
 }
 
 /*
@@ -934,9 +922,7 @@ del_session(session_t *sp)
 
 	if ((*session_db->del)(session_db, &key, 0))
 		emergency("delete %d: %s", sp->se_process, strerror(errno));
-#ifdef SUPPORT_UTMPX
 	session_utmpx(sp, 0);
-#endif
 }
 
 /*
@@ -1138,7 +1124,6 @@ f_read_ttys(void)
 	session_t *sp, *snext;
 	struct ttyent *typ;
 
-#ifdef SUPPORT_UTMPX
 	if (sessions == NULL) {
 		struct stat st;
 
@@ -1156,7 +1141,6 @@ f_read_ttys(void)
 			make_utmpx("", DOWN_MSG, DOWN_TIME, 0, &down_time, 0);
 		}
 	}
-#endif
 	/*
 	 * Destroy any previous session state.
 	 * There shouldn't be any, but just in case...
@@ -1540,9 +1524,7 @@ f_death(void)
 	pid_t pid;
 	static const int death_sigs[2] = { SIGTERM, SIGKILL };
 
-#ifdef SUPPORT_UTMPX
 	logwtmpx("~", "shutdown", "", 0, INIT_PROCESS);
-#endif
 
 	for (sp = sessions; sp; sp = sp->se_next) {
 		sp->se_flags |= SE_SHUTDOWN;
@@ -1767,7 +1749,6 @@ setprocresources(const char *cname)
 }
 #endif
 
-#ifdef SUPPORT_UTMPX
 static void
 session_utmpx(const session_t *sp, int add)
 {
@@ -1848,4 +1829,3 @@ utmpx_set_runlevel(char old, char new)
 		warning("can't add utmpx record for `runlevel': %m");
 	endutxent();
 }
-#endif
diff --git a/sbin/reboot/Makefile b/sbin/reboot/Makefile
index 012f8660bd..0a996d2ee9 100644
--- a/sbin/reboot/Makefile
+++ b/sbin/reboot/Makefile
@@ -4,7 +4,6 @@
 PROG=	reboot
 DPADD=	${LIBUTIL}
 LDADD=	-lutil
-CFLAGS+=-DSUPPORT_UTMPX
 MAN=	reboot.8
 MLINKS=	reboot.8 halt.8 reboot.8 fastboot.8 reboot.8 fasthalt.8
 
diff --git a/sbin/reboot/reboot.c b/sbin/reboot/reboot.c
index f7da77695f..dafeb84cff 100644
--- a/sbin/reboot/reboot.c
+++ b/sbin/reboot/reboot.c
@@ -45,9 +45,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#ifdef SUPPORT_UTMPX
 #include <utmpx.h>
-#endif
 
 void usage(void) __dead2;
 u_int get_pageins(void);
@@ -134,9 +132,7 @@ main(int argc, char *argv[])
 			syslog(LOG_CRIT, "rebooted by %s", user);
 		}
 	}
-#ifdef SUPPORT_UTMPX
 	logwtmpx("~", "shutdown", "", INIT_PROCESS, 0);
-#endif
 
 	/*
 	 * Do a sync early on, so disks start transfers while we're off
diff --git a/usr.bin/finger/Makefile b/usr.bin/finger/Makefile
index 9652ac54a3..c1bd7c4da9 100644
--- a/usr.bin/finger/Makefile
+++ b/usr.bin/finger/Makefile
@@ -10,6 +10,6 @@ MAN=	finger.1 finger.conf.5
 DPADD+=	${LIBUTIL}
 LDADD+=	-lutil
 
-CFLAGS+= -I${.CURDIR}/../who -DSUPPORT_UTMPX
+CFLAGS+= -I${.CURDIR}/../who
 
 .include <bsd.prog.mk>
diff --git a/usr.bin/last/Makefile b/usr.bin/last/Makefile
index c1c86a6690..df0c972808 100644
--- a/usr.bin/last/Makefile
+++ b/usr.bin/last/Makefile
@@ -3,6 +3,6 @@
 
 PROG=	last
 
-CFLAGS+=-DSUPPORT_UTMPX -I${.CURDIR}/../../lib/libc/stdtime
+CFLAGS+=-I${.CURDIR}/../../lib/libc/stdtime
 
 .include <bsd.prog.mk>
diff --git a/usr.bin/last/last.c b/usr.bin/last/last.c
index ee73369566..9cc2e8952f 100644
--- a/usr.bin/last/last.c
+++ b/usr.bin/last/last.c
@@ -43,9 +43,7 @@
 #include <time.h>
 #include <tzfile.h>
 #include <unistd.h>
-#ifdef SUPPORT_UTMPX
 #include <utmpx.h>
-#endif
 
 #ifndef UT_NAMESIZE
 #define UT_NAMESIZE 8
@@ -99,9 +97,7 @@ static void	 addarg(int, char *);
 static TTY	*addtty(const char *);
 static void	 hostconv(char *);
 static char	*ttyconv(char *);
-#ifdef SUPPORT_UTMPX
 static void	 wtmpx(const char *, int, int, int);
-#endif
 static char	*fmttime(time_t, int);
 static void	 usage(void);
 
@@ -189,18 +185,12 @@ main(int argc, char *argv[])
 		}
 	}
 	if (file == NULL) {
-#ifdef SUPPORT_UTMPX
 		if (access(_PATH_WTMPX, R_OK) == 0)
 			file = _PATH_WTMPX;
-#endif
 		if (file == NULL)
-#if defined(SUPPORT_UTMPX)
 			errx(1, "Cannot access `%s'", _PATH_WTMPX);
-#endif
 	}
-#if defined(SUPPORT_UTMPX)
 	wtmpx(file, namesize, linesize, hostsize);
-#endif
 	exit(0);
 }
 
@@ -314,7 +304,6 @@ fmttime(time_t t, int flags)
 	return (tbuf);
 }
 
-#ifdef SUPPORT_UTMPX
 #define utmp utmpx
 #define want wantx
 #define wtmp wtmpx
@@ -327,4 +316,3 @@ fmttime(time_t t, int flags)
 #define ut_timefld ut_xtime
 #define FIRSTVALID 1
 #include "want.c"
-#endif
diff --git a/usr.bin/systat/Makefile b/usr.bin/systat/Makefile
index 88632666dd..28b9787714 100644
--- a/usr.bin/systat/Makefile
+++ b/usr.bin/systat/Makefile
@@ -21,6 +21,6 @@ LDADD+=	-lutil
 CFLAGS+=	-I${_SHLIBDIRPREFIX}/usr/include/priv/ncurses
 LDFLAGS+=	${PRIVATELIB_LDFLAGS}
 
-CFLAGS+= -I${.CURDIR}/../who -DSUPPORT_UTMPX
+CFLAGS+= -I${.CURDIR}/../who
 
 .include <bsd.prog.mk>
diff --git a/usr.bin/users/Makefile b/usr.bin/users/Makefile
index 7c917d4fb4..ba84671853 100644
--- a/usr.bin/users/Makefile
+++ b/usr.bin/users/Makefile
@@ -7,6 +7,6 @@ SRCS=	users.c utmpentry.c
 DPADD=	${LIBUTIL}
 LDADD=	-lutil
 
-CFLAGS+= -I${.CURDIR}/../who -DSUPPORT_UTMPX
+CFLAGS+= -I${.CURDIR}/../who
 
 .include <bsd.prog.mk>
diff --git a/usr.bin/w/Makefile b/usr.bin/w/Makefile
index 84112fa167..21b09fde95 100644
--- a/usr.bin/w/Makefile
+++ b/usr.bin/w/Makefile
@@ -12,7 +12,6 @@ LINKS=	${BINDIR}/w ${BINDIR}/uptime
 WARNS?=	3
 NO_STRICT_ALIASING=
 
-CFLAGS+=-DSUPPORT_UTMPX
 .PATH: ${.CURDIR}/../../bin/ps
 
 .include <bsd.prog.mk>
diff --git a/usr.bin/w/w.c b/usr.bin/w/w.c
index 437089048b..7cca80da78 100644
--- a/usr.bin/w/w.c
+++ b/usr.bin/w/w.c
@@ -65,9 +65,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#ifdef SUPPORT_UTMPX
 #include <utmpx.h>
-#endif
 #include <vis.h>
 
 #include <arpa/nameser.h>
@@ -114,10 +112,8 @@ struct	entry {
 #define debugproc(p) *((struct kinfo_proc **)&(p)->kp_spare[0])
 
 static void		 pr_header(time_t *, int);
-#if defined(SUPPORT_UTMPX)
 static struct stat	*ttystat(char *, int);
 static void	process(struct entry *);
-#endif
 static void		 usage(int);
 static int		 this_is_uptime(const char *s);
 
@@ -132,9 +128,7 @@ main(int argc, char **argv)
 	in_addr_t l;
 	int ch, i, nentries, nusers, wcmd, longidle, dropgid;
 	char *memf, *nlistf, *p, *x;
-#ifdef SUPPORT_UTMPX
 	struct utmpx *utx;
-#endif
 	char buf[MAXHOSTNAMELEN], errbuf[_POSIX2_LINE_MAX];
 
 	(void)setlocale(LC_ALL, "");
@@ -201,15 +195,12 @@ main(int argc, char **argv)
 		errx(1, "%s", errbuf);
 
 	(void)time(&now);
-#ifdef SUPPORT_UTMPX
 	setutxent();
-#endif
 
 	if (*argv)
 		sel_users = argv;
 
 	nusers = 0;
-#ifdef SUPPORT_UTMPX
 	while ((utx = getutxent()) != NULL) {
 		if (utx->ut_type != USER_PROCESS)
 			continue;
@@ -254,11 +245,7 @@ main(int argc, char **argv)
 		if (wcmd != 0)
 			process(ep);
 	}
-#endif
-
-#ifdef SUPPORT_UTMPX
 	endutxent();
-#endif
 	
 	if (header || wcmd == 0) {
 		pr_header(&now, nusers);
@@ -349,9 +336,7 @@ main(int argc, char **argv)
 			save->next = *nextp;
 			*nextp = save;
 		}
-	}
-#if defined(SUPPORT_UTMPX)
-	else if (ehead != NULL) {
+	} else if (ehead != NULL) {
 		struct entry *from = ehead, *save;
 
 		ehead = NULL;
@@ -366,7 +351,6 @@ main(int argc, char **argv)
 			*nextp = save;
 		}
 	}
-#endif
 
 	if (!nflag) {
 		if (gethostname(domain, sizeof(domain)) < 0 ||
@@ -550,7 +534,6 @@ this_is_uptime(const char *s)
 	return (-1);
 }
 
-#if defined(SUPPORT_UTMPX)
 static void
 process(struct entry *ep)
 {
@@ -596,4 +579,3 @@ process(struct entry *ep)
 	if ((ep->idle = now - touched) < 0)
 		ep->idle = 0;
 }
-#endif
diff --git a/usr.bin/wall/Makefile b/usr.bin/wall/Makefile
index 5b2618e6c4..5c8b456d24 100644
--- a/usr.bin/wall/Makefile
+++ b/usr.bin/wall/Makefile
@@ -10,6 +10,6 @@ BINMODE=2555
 DPADD+=	${LIBUTIL}
 LDADD+=	-lutil
 
-CFLAGS+= -I${.CURDIR}/../who -DSUPPORT_UTMPX
+CFLAGS+= -I${.CURDIR}/../who
 
 .include <bsd.prog.mk>
diff --git a/usr.bin/who/Makefile b/usr.bin/who/Makefile
index 80089e1131..df91528b2e 100644
--- a/usr.bin/who/Makefile
+++ b/usr.bin/who/Makefile
@@ -1,9 +1,6 @@
 #	@(#)Makefile	8.1 (Berkeley) 6/6/93
 
 PROG=	who
-
 SRCS+=	who.c utmpentry.c
 
-CFLAGS+=-DSUPPORT_UTMPX
-
 .include <bsd.prog.mk>
diff --git a/usr.bin/who/utmpentry.c b/usr.bin/who/utmpentry.c
index 139bd7f3f9..f44ffe8b10 100644
--- a/usr.bin/who/utmpentry.c
+++ b/usr.bin/who/utmpentry.c
@@ -37,10 +37,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
-
-#ifdef SUPPORT_UTMPX
 #include <utmpx.h>
-#endif
 
 #include "utmpentry.h"
 
@@ -77,21 +74,16 @@
 	((void)sizeof(struct { unsigned : ((x) ? 1 : -1); }))
 
 
-#ifdef SUPPORT_UTMPX
 static void getentryx(struct utmpentry *, struct utmpx *);
 static struct timespec utmpxtime = {0, 0};
-#endif
-#if defined(SUPPORT_UTMPX)
 static int setup(const char *);
 static void adjust_size(struct utmpentry *e);
-#endif
 
 int maxname = 8, maxline = 8, maxhost = 16;
 int etype = 1 << USER_PROCESS;
 static int numutmp = 0;
 static struct utmpentry *ehead;
 
-#if defined(SUPPORT_UTMPX)
 static void
 adjust_size(struct utmpentry *e)
 {
@@ -113,23 +105,18 @@ setup(const char *fname)
 	const char *sfname;
 
 	if (fname == NULL) {
-#ifdef SUPPORT_UTMPX
 		setutxent();
-#endif
 	} else {
 		size_t len = strlen(fname);
 		if (len == 0)
 			errx(1, "Filename cannot be 0 length.");
 		what = fname[len - 1] == 'x' ? 1 : 2;
 		if (what == 1) {
-#ifdef SUPPORT_UTMPX
 			if (utmpxname(fname) == 0)
 				warnx("Cannot set utmpx file to `%s'",
 				    fname);
-#endif
 		}
 	}
-#ifdef SUPPORT_UTMPX
 	if (what & 1) {
 		sfname = fname ? fname : _PATH_UTMPX;
 		if (stat(sfname, &st) == -1) {
@@ -142,19 +129,15 @@ setup(const char *fname)
 			    what &= ~1;
 		}
 	}
-#endif
 	return what;
 }
-#endif
 
 void
 endutentries(void)
 {
 	struct utmpentry *ep;
 
-#ifdef SUPPORT_UTMPX
 	timespecclear(&utmpxtime);
-#endif
 	ep = ehead;
 	while (ep) {
 		struct utmpentry *sep = ep;
@@ -168,10 +151,7 @@ endutentries(void)
 int
 getutentries(const char *fname, struct utmpentry **epp)
 {
-#ifdef SUPPORT_UTMPX
 	struct utmpx *utx;
-#endif
-#if defined(SUPPORT_UTMPX)
 	struct utmpentry *ep;
 	int what = setup(fname);
 	struct utmpentry **nextp = &ehead;
@@ -185,9 +165,7 @@ getutentries(const char *fname, struct utmpentry **epp)
 		ehead = NULL;
 		numutmp = 0;
 	}
-#endif
 
-#ifdef SUPPORT_UTMPX
 	while ((what & 1) && (utx = getutxent()) != NULL) {
 		if (fname == NULL && ((1 << utx->ut_type) & etype) == 0) {
 			continue;
@@ -200,10 +178,8 @@ getutentries(const char *fname, struct utmpentry **epp)
 		*nextp = ep;
 		nextp = &(ep->next);
 	}
-#endif
 
 	numutmp = 0;
-#if defined(SUPPORT_UTMPX)
 	if (ehead != NULL) {
 		struct utmpentry *from = ehead, *save;
 		
@@ -222,10 +198,8 @@ getutentries(const char *fname, struct utmpentry **epp)
 	}
 	*epp = ehead;
 	return numutmp;
-#endif
 }
 
-#ifdef SUPPORT_UTMPX
 static void
 getentryx(struct utmpentry *e, struct utmpx *up)
 {
@@ -258,4 +232,3 @@ getentryx(struct utmpentry *e, struct utmpx *up)
 	e->type = up->ut_type;
 	adjust_size(e);
 }
-#endif
diff --git a/usr.bin/who/utmpentry.h b/usr.bin/who/utmpentry.h
index 0a0f65f6d3..0bf93d0371 100644
--- a/usr.bin/who/utmpentry.h
+++ b/usr.bin/who/utmpentry.h
@@ -29,12 +29,10 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#if defined(SUPPORT_UTMPX)
-# include <utmpx.h>
-# define WHO_NAME_LEN		_UTX_USERSIZE
-# define WHO_LINE_LEN		_UTX_LINESIZE
-# define WHO_HOST_LEN		_UTX_HOSTSIZE
-#endif
+#include <utmpx.h>
+#define WHO_NAME_LEN		_UTX_USERSIZE
+#define WHO_LINE_LEN		_UTX_LINESIZE
+#define WHO_HOST_LEN		_UTX_HOSTSIZE
 
 
 struct utmpentry {
diff --git a/usr.bin/who/who.c b/usr.bin/who/who.c
index 82cff77e15..3d2bd24ca9 100644
--- a/usr.bin/who/who.c
+++ b/usr.bin/who/who.c
@@ -45,9 +45,7 @@
 #include <string.h>
 #include <time.h>
 #include <unistd.h>
-#ifdef SUPPORT_UTMPX
 #include <utmpx.h>
-#endif
 
 #include "utmpentry.h"
 
@@ -70,7 +68,6 @@ struct ut_type_names {
   int type;
   const char *name;
 } ut_type_names[] = {
-#ifdef SUPPORT_UTMPX
   { EMPTY, "empty" },
   { RUN_LVL, "run level" },
   { BOOT_TIME, "boot time" },
@@ -83,7 +80,6 @@ struct ut_type_names {
   { ACCOUNTING, "accounting" },
   { SIGNATURE, "signature" },
   { DOWN_TIME, "down time" },
-#endif /* SUPPORT_UTMPX */
   { -1, "unknown" }
 };
 
diff --git a/usr.bin/write/Makefile b/usr.bin/write/Makefile
index e502f2655c..8dc09e5eaf 100644
--- a/usr.bin/write/Makefile
+++ b/usr.bin/write/Makefile
@@ -10,6 +10,6 @@ BINGRP=	tty
 DPADD+=	${LIBUTIL}
 LDADD+=	-lutil
 
-CFLAGS+= -I${.CURDIR}/../who -DSUPPORT_UTMPX
+CFLAGS+= -I${.CURDIR}/../who
 
 .include <bsd.prog.mk>
-- 
2.22.0

