8a8cfb
commit a33b817f13170b5c24263b92e7e09880fe797d7e
8a8cfb
Author: Florian Weimer <fweimer@redhat.com>
8a8cfb
Date:   Tue Aug 13 12:09:32 2019 +0200
8a8cfb
8a8cfb
    login: Assume that _HAVE_UT_* constants are true
8a8cfb
    
8a8cfb
    Make the GNU version of bits/utmp.h the generic version because
8a8cfb
    all remaining ports use it (with a sysdeps override for
8a8cfb
    Linux s390/s390x).
8a8cfb
8a8cfb
Conflicts:
8a8cfb
	bits/utmp.h
8a8cfb
	sysdeps/gnu/bits/utmp.h
8a8cfb
	  (Upstream copyright year change.)
8a8cfb
8a8cfb
diff --git a/bits/utmp.h b/bits/utmp.h
8a8cfb
index 6e8695fbf072e5f1..3c02dd4f3fe4e99b 100644
8a8cfb
--- a/bits/utmp.h
8a8cfb
+++ b/bits/utmp.h
8a8cfb
@@ -1,5 +1,5 @@
8a8cfb
-/* The `struct utmp' type, describing entries in the utmp file.  Generic/BSDish
8a8cfb
-   Copyright (C) 1993-2018 Free Software Foundation, Inc.
8a8cfb
+/* The `struct utmp' type, describing entries in the utmp file.
8a8cfb
+   Copyright (C) 1993-2019 Free Software Foundation, Inc.
8a8cfb
    This file is part of the GNU C Library.
8a8cfb
 
8a8cfb
    The GNU C Library is free software; you can redistribute it and/or
8a8cfb
@@ -21,29 +21,106 @@
8a8cfb
 #endif
8a8cfb
 
8a8cfb
 #include <paths.h>
8a8cfb
-#include <time.h>
8a8cfb
+#include <sys/time.h>
8a8cfb
+#include <sys/types.h>
8a8cfb
+#include <bits/wordsize.h>
8a8cfb
 
8a8cfb
 
8a8cfb
-#define	UT_NAMESIZE	8
8a8cfb
-#define	UT_LINESIZE	8
8a8cfb
-#define	UT_HOSTSIZE	16
8a8cfb
+#define UT_LINESIZE	32
8a8cfb
+#define UT_NAMESIZE	32
8a8cfb
+#define UT_HOSTSIZE	256
8a8cfb
 
8a8cfb
 
8a8cfb
+/* The structure describing an entry in the database of
8a8cfb
+   previous logins.  */
8a8cfb
 struct lastlog
8a8cfb
   {
8a8cfb
-    time_t ll_time;
8a8cfb
+#if __WORDSIZE_TIME64_COMPAT32
8a8cfb
+    int32_t ll_time;
8a8cfb
+#else
8a8cfb
+    __time_t ll_time;
8a8cfb
+#endif
8a8cfb
     char ll_line[UT_LINESIZE];
8a8cfb
     char ll_host[UT_HOSTSIZE];
8a8cfb
   };
8a8cfb
 
8a8cfb
-struct utmp
8a8cfb
+
8a8cfb
+/* The structure describing the status of a terminated process.  This
8a8cfb
+   type is used in `struct utmp' below.  */
8a8cfb
+struct exit_status
8a8cfb
   {
8a8cfb
-    char ut_line[UT_LINESIZE];
8a8cfb
-    char ut_user[UT_NAMESIZE];
8a8cfb
-#define ut_name ut_user
8a8cfb
-    char ut_host[UT_HOSTSIZE];
8a8cfb
-    long int ut_time;
8a8cfb
+    short int e_termination;	/* Process termination status.  */
8a8cfb
+    short int e_exit;		/* Process exit status.  */
8a8cfb
   };
8a8cfb
 
8a8cfb
 
8a8cfb
-#define _HAVE_UT_HOST 1		/* We have the ut_host field.  */
8a8cfb
+/* The structure describing an entry in the user accounting database.  */
8a8cfb
+struct utmp
8a8cfb
+{
8a8cfb
+  short int ut_type;		/* Type of login.  */
8a8cfb
+  pid_t ut_pid;			/* Process ID of login process.  */
8a8cfb
+  char ut_line[UT_LINESIZE]
8a8cfb
+    __attribute_nonstring__;	/* Devicename.  */
8a8cfb
+  char ut_id[4];		/* Inittab ID.  */
8a8cfb
+  char ut_user[UT_NAMESIZE]
8a8cfb
+    __attribute_nonstring__;	/* Username.  */
8a8cfb
+  char ut_host[UT_HOSTSIZE]
8a8cfb
+    __attribute_nonstring__;	/* Hostname for remote login.  */
8a8cfb
+  struct exit_status ut_exit;	/* Exit status of a process marked
8a8cfb
+				   as DEAD_PROCESS.  */
8a8cfb
+/* The ut_session and ut_tv fields must be the same size when compiled
8a8cfb
+   32- and 64-bit.  This allows data files and shared memory to be
8a8cfb
+   shared between 32- and 64-bit applications.  */
8a8cfb
+#if __WORDSIZE_TIME64_COMPAT32
8a8cfb
+  int32_t ut_session;		/* Session ID, used for windowing.  */
8a8cfb
+  struct
8a8cfb
+  {
8a8cfb
+    int32_t tv_sec;		/* Seconds.  */
8a8cfb
+    int32_t tv_usec;		/* Microseconds.  */
8a8cfb
+  } ut_tv;			/* Time entry was made.  */
8a8cfb
+#else
8a8cfb
+  long int ut_session;		/* Session ID, used for windowing.  */
8a8cfb
+  struct timeval ut_tv;		/* Time entry was made.  */
8a8cfb
+#endif
8a8cfb
+
8a8cfb
+  int32_t ut_addr_v6[4];	/* Internet address of remote host.  */
8a8cfb
+  char __glibc_reserved[20];		/* Reserved for future use.  */
8a8cfb
+};
8a8cfb
+
8a8cfb
+/* Backwards compatibility hacks.  */
8a8cfb
+#define ut_name		ut_user
8a8cfb
+#ifndef _NO_UT_TIME
8a8cfb
+/* We have a problem here: `ut_time' is also used otherwise.  Define
8a8cfb
+   _NO_UT_TIME if the compiler complains.  */
8a8cfb
+# define ut_time	ut_tv.tv_sec
8a8cfb
+#endif
8a8cfb
+#define ut_xtime	ut_tv.tv_sec
8a8cfb
+#define ut_addr		ut_addr_v6[0]
8a8cfb
+
8a8cfb
+
8a8cfb
+/* Values for the `ut_type' field of a `struct utmp'.  */
8a8cfb
+#define EMPTY		0	/* No valid user accounting information.  */
8a8cfb
+
8a8cfb
+#define RUN_LVL		1	/* The system's runlevel.  */
8a8cfb
+#define BOOT_TIME	2	/* Time of system boot.  */
8a8cfb
+#define NEW_TIME	3	/* Time after system clock changed.  */
8a8cfb
+#define OLD_TIME	4	/* Time when system clock changed.  */
8a8cfb
+
8a8cfb
+#define INIT_PROCESS	5	/* Process spawned by the init process.  */
8a8cfb
+#define LOGIN_PROCESS	6	/* Session leader of a logged in user.  */
8a8cfb
+#define USER_PROCESS	7	/* Normal process.  */
8a8cfb
+#define DEAD_PROCESS	8	/* Terminated process.  */
8a8cfb
+
8a8cfb
+#define ACCOUNTING	9
8a8cfb
+
8a8cfb
+/* Old Linux name for the EMPTY type.  */
8a8cfb
+#define UT_UNKNOWN	EMPTY
8a8cfb
+
8a8cfb
+
8a8cfb
+/* Tell the user that we have a modern system with UT_HOST, UT_PID,
8a8cfb
+   UT_TYPE, UT_ID and UT_TV fields.  */
8a8cfb
+#define _HAVE_UT_TYPE	1
8a8cfb
+#define _HAVE_UT_PID	1
8a8cfb
+#define _HAVE_UT_ID	1
8a8cfb
+#define _HAVE_UT_TV	1
8a8cfb
+#define _HAVE_UT_HOST	1
8a8cfb
diff --git a/login/getutid_r.c b/login/getutid_r.c
8a8cfb
index 8cb6b16d735e8265..11b288e99be6ee50 100644
8a8cfb
--- a/login/getutid_r.c
8a8cfb
+++ b/login/getutid_r.c
8a8cfb
@@ -32,7 +32,6 @@ __libc_lock_define (extern, __libc_utmp_lock attribute_hidden)
8a8cfb
 int
8a8cfb
 __getutid_r (const struct utmp *id, struct utmp *buffer, struct utmp **result)
8a8cfb
 {
8a8cfb
-#if (_HAVE_UT_ID - 0) && (_HAVE_UT_TYPE - 0)
8a8cfb
   int retval;
8a8cfb
 
8a8cfb
   /* Test whether ID has any of the legal types.  */
8a8cfb
@@ -54,10 +53,6 @@ __getutid_r (const struct utmp *id, struct utmp *buffer, struct utmp **result)
8a8cfb
   __libc_lock_unlock (__libc_utmp_lock);
8a8cfb
 
8a8cfb
   return retval;
8a8cfb
-#else	/* !_HAVE_UT_ID && !_HAVE_UT_TYPE */
8a8cfb
-  __set_errno (ENOSYS);
8a8cfb
-  return -1;
8a8cfb
-#endif
8a8cfb
 }
8a8cfb
 libc_hidden_def (__getutid_r)
8a8cfb
 weak_alias (__getutid_r, getutid_r)
8a8cfb
diff --git a/login/getutmp.c b/login/getutmp.c
8a8cfb
index 481150d5ef5a0bf0..32468ecae699fbf7 100644
8a8cfb
--- a/login/getutmp.c
8a8cfb
+++ b/login/getutmp.c
8a8cfb
@@ -23,23 +23,11 @@
8a8cfb
 void
8a8cfb
 getutmp (const struct utmpx *utmpx, struct utmp *utmp)
8a8cfb
 {
8a8cfb
-#if _HAVE_UT_TYPE - 0
8a8cfb
   utmp->ut_type = utmpx->ut_type;
8a8cfb
-#endif
8a8cfb
-#if _HAVE_UT_PID - 0
8a8cfb
   utmp->ut_pid = utmpx->ut_pid;
8a8cfb
-#endif
8a8cfb
   memcpy (utmp->ut_line, utmpx->ut_line, sizeof (utmp->ut_line));
8a8cfb
   memcpy (utmp->ut_user, utmpx->ut_user, sizeof (utmp->ut_user));
8a8cfb
-#if _HAVE_UT_ID - 0
8a8cfb
   memcpy (utmp->ut_id, utmpx->ut_id, sizeof (utmp->ut_id));
8a8cfb
-#endif
8a8cfb
-#if _HAVE_UT_HOST - 0
8a8cfb
   memcpy (utmp->ut_host, utmpx->ut_host, sizeof (utmp->ut_host));
8a8cfb
-#endif
8a8cfb
-#if _HAVE_UT_TV - 0
8a8cfb
   utmp->ut_tv = utmpx->ut_tv;
8a8cfb
-#else
8a8cfb
-  utmp->ut_time = utmpx->ut_time;
8a8cfb
-#endif
8a8cfb
 }
8a8cfb
diff --git a/login/getutmpx.c b/login/getutmpx.c
8a8cfb
index 34145fe8db71faf0..92a182698e2be438 100644
8a8cfb
--- a/login/getutmpx.c
8a8cfb
+++ b/login/getutmpx.c
8a8cfb
@@ -24,24 +24,11 @@ void
8a8cfb
 getutmpx (const struct utmp *utmp, struct utmpx *utmpx)
8a8cfb
 {
8a8cfb
   memset (utmpx, 0, sizeof (struct utmpx));
8a8cfb
-
8a8cfb
-#if _HAVE_UT_TYPE - 0
8a8cfb
   utmpx->ut_type = utmp->ut_type;
8a8cfb
-#endif
8a8cfb
-#if _HAVE_UT_PID - 0
8a8cfb
   utmpx->ut_pid = utmp->ut_pid;
8a8cfb
-#endif
8a8cfb
   memcpy (utmpx->ut_line, utmp->ut_line, sizeof (utmp->ut_line));
8a8cfb
   memcpy (utmpx->ut_user, utmp->ut_user, sizeof (utmp->ut_user));
8a8cfb
-#if _HAVE_UT_ID - 0
8a8cfb
   memcpy (utmpx->ut_id, utmp->ut_id, sizeof (utmp->ut_id));
8a8cfb
-#endif
8a8cfb
-#if _HAVE_UT_HOST - 0
8a8cfb
   memcpy (utmpx->ut_host, utmp->ut_host, sizeof (utmp->ut_host));
8a8cfb
-#endif
8a8cfb
-#if _HAVE_UT_TV - 0
8a8cfb
   utmpx->ut_tv = utmp->ut_tv;
8a8cfb
-#else
8a8cfb
-  utmpx->ut_time = utmp->ut_time;
8a8cfb
-#endif
8a8cfb
 }
8a8cfb
diff --git a/login/login.c b/login/login.c
8a8cfb
index 5d48cd487f237ca0..1729fc070fcc1e4b 100644
8a8cfb
--- a/login/login.c
8a8cfb
+++ b/login/login.c
8a8cfb
@@ -91,12 +91,8 @@ login (const struct utmp *ut)
8a8cfb
   struct utmp copy = *ut;
8a8cfb
 
8a8cfb
   /* Fill in those fields we supply.  */
8a8cfb
-#if _HAVE_UT_TYPE - 0
8a8cfb
   copy.ut_type = USER_PROCESS;
8a8cfb
-#endif
8a8cfb
-#if _HAVE_UT_PID - 0
8a8cfb
   copy.ut_pid = getpid ();
8a8cfb
-#endif
8a8cfb
 
8a8cfb
   /* Seek tty.  */
8a8cfb
   found_tty = tty_name (STDIN_FILENO, &tty, sizeof (_tty));
8a8cfb
diff --git a/login/logout.c b/login/logout.c
8a8cfb
index d49bc4ecac9a8379..4d76ecf1b40d306a 100644
8a8cfb
--- a/login/logout.c
8a8cfb
+++ b/login/logout.c
8a8cfb
@@ -36,9 +36,7 @@ logout (const char *line)
8a8cfb
   setutent ();
8a8cfb
 
8a8cfb
   /* Fill in search information.  */
8a8cfb
-#if _HAVE_UT_TYPE - 0
8a8cfb
   tmp.ut_type = USER_PROCESS;
8a8cfb
-#endif
8a8cfb
   strncpy (tmp.ut_line, line, sizeof tmp.ut_line);
8a8cfb
 
8a8cfb
   /* Read the record.  */
8a8cfb
@@ -46,20 +44,12 @@ logout (const char *line)
8a8cfb
     {
8a8cfb
       /* Clear information about who & from where.  */
8a8cfb
       memset (ut->ut_name, '\0', sizeof ut->ut_name);
8a8cfb
-#if _HAVE_UT_HOST - 0
8a8cfb
       memset (ut->ut_host, '\0', sizeof ut->ut_host);
8a8cfb
-#endif
8a8cfb
-#if _HAVE_UT_TV - 0
8a8cfb
       struct timeval tv;
8a8cfb
       __gettimeofday (&tv, NULL);
8a8cfb
       ut->ut_tv.tv_sec = tv.tv_sec;
8a8cfb
       ut->ut_tv.tv_usec = tv.tv_usec;
8a8cfb
-#else
8a8cfb
-      ut->ut_time = time (NULL);
8a8cfb
-#endif
8a8cfb
-#if _HAVE_UT_TYPE - 0
8a8cfb
       ut->ut_type = DEAD_PROCESS;
8a8cfb
-#endif
8a8cfb
 
8a8cfb
       if (pututline (ut) != NULL)
8a8cfb
 	result = 1;
8a8cfb
diff --git a/login/logwtmp.c b/login/logwtmp.c
8a8cfb
index a19da4ab5ef7a624..e0b52b23e3603b7c 100644
8a8cfb
--- a/login/logwtmp.c
8a8cfb
+++ b/login/logwtmp.c
8a8cfb
@@ -30,26 +30,16 @@ logwtmp (const char *line, const char *name, const char *host)
8a8cfb
 
8a8cfb
   /* Set information in new entry.  */
8a8cfb
   memset (&ut, 0, sizeof (ut));
8a8cfb
-#if _HAVE_UT_PID - 0
8a8cfb
   ut.ut_pid = getpid ();
8a8cfb
-#endif
8a8cfb
-#if _HAVE_UT_TYPE - 0
8a8cfb
   ut.ut_type = name[0] ? USER_PROCESS : DEAD_PROCESS;
8a8cfb
-#endif
8a8cfb
   strncpy (ut.ut_line, line, sizeof ut.ut_line);
8a8cfb
   strncpy (ut.ut_name, name, sizeof ut.ut_name);
8a8cfb
-#if _HAVE_UT_HOST - 0
8a8cfb
   strncpy (ut.ut_host, host, sizeof ut.ut_host);
8a8cfb
-#endif
8a8cfb
 
8a8cfb
-#if _HAVE_UT_TV - 0
8a8cfb
   struct timeval tv;
8a8cfb
   __gettimeofday (&tv, NULL);
8a8cfb
   ut.ut_tv.tv_sec = tv.tv_sec;
8a8cfb
   ut.ut_tv.tv_usec = tv.tv_usec;
8a8cfb
-#else
8a8cfb
-  ut.ut_time = time (NULL);
8a8cfb
-#endif
8a8cfb
 
8a8cfb
   updwtmp (_PATH_WTMP, &ut);
8a8cfb
 }
8a8cfb
diff --git a/login/programs/utmpdump.c b/login/programs/utmpdump.c
8a8cfb
index dccdb669f5fb9c74..1763e55af2f03d8d 100644
8a8cfb
--- a/login/programs/utmpdump.c
8a8cfb
+++ b/login/programs/utmpdump.c
8a8cfb
@@ -37,47 +37,11 @@ print_entry (struct utmp *up)
8a8cfb
   temp_tv.tv_sec = up->ut_tv.tv_sec;
8a8cfb
   temp_tv.tv_usec = up->ut_tv.tv_usec;
8a8cfb
 
8a8cfb
-  (printf) (
8a8cfb
-	    /* The format string.  */
8a8cfb
-#if _HAVE_UT_TYPE
8a8cfb
-	    "[%d] "
8a8cfb
-#endif
8a8cfb
-#if _HAVE_UT_PID
8a8cfb
-	    "[%05d] "
8a8cfb
-#endif
8a8cfb
-#if _HAVE_UT_ID
8a8cfb
-	    "[%-4.4s] "
8a8cfb
-#endif
8a8cfb
-	    "[%-8.8s] [%-12.12s]"
8a8cfb
-#if _HAVE_UT_HOST
8a8cfb
-	    " [%-16.16s]"
8a8cfb
-#endif
8a8cfb
-	    " [%-15.15s]"
8a8cfb
-#if _HAVE_UT_TV
8a8cfb
-	    " [%ld]"
8a8cfb
-#endif
8a8cfb
-	    "\n"
8a8cfb
-	    /* The arguments.  */
8a8cfb
-#if _HAVE_UT_TYPE
8a8cfb
-	    , up->ut_type
8a8cfb
-#endif
8a8cfb
-#if _HAVE_UT_PID
8a8cfb
-	    , up->ut_pid
8a8cfb
-#endif
8a8cfb
-#if _HAVE_UT_ID
8a8cfb
-	    , up->ut_id
8a8cfb
-#endif
8a8cfb
-	    , up->ut_user, up->ut_line
8a8cfb
-#if _HAVE_UT_HOST
8a8cfb
-	    , up->ut_host
8a8cfb
-#endif
8a8cfb
-#if _HAVE_UT_TV
8a8cfb
-	    , 4 + ctime (&temp_tv.tv_sec)
8a8cfb
-	    , (long int) temp_tv.tv_usec
8a8cfb
-#else
8a8cfb
-	    , 4 + ctime (&up->ut_time)
8a8cfb
-#endif
8a8cfb
-	   );
8a8cfb
+  printf ("[%d] [%05d] [%-4.4s] [%-8.8s] [%-12.12s] [%-16.16s] [%-15.15s]"
8a8cfb
+	  " [%ld]\n",
8a8cfb
+	  up->ut_type, up->ut_pid, up->ut_id, up->ut_user, up->ut_line,
8a8cfb
+	  up->ut_host, 4 + ctime (&temp_tv.tv_sec),
8a8cfb
+	  (long int) temp_tv.tv_usec);
8a8cfb
 }
8a8cfb
 
8a8cfb
 int
8a8cfb
diff --git a/login/tst-utmp.c b/login/tst-utmp.c
8a8cfb
index 8cc7aafa89c0ea8c..49b0cbda2a719643 100644
8a8cfb
--- a/login/tst-utmp.c
8a8cfb
+++ b/login/tst-utmp.c
8a8cfb
@@ -39,8 +39,6 @@
8a8cfb
 #endif
8a8cfb
 
8a8cfb
 
8a8cfb
-#if defined UTMPX || _HAVE_UT_TYPE
8a8cfb
-
8a8cfb
 /* Prototype for our test function.  */
8a8cfb
 static int do_test (int argc, char *argv[]);
8a8cfb
 
8a8cfb
@@ -75,11 +73,7 @@ do_prepare (int argc, char *argv[])
8a8cfb
 
8a8cfb
 struct utmp entry[] =
8a8cfb
 {
8a8cfb
-#if defined UTMPX || _HAVE_UT_TV
8a8cfb
 #define UT(a)  .ut_tv = { .tv_sec = (a)}
8a8cfb
-#else
8a8cfb
-#define UT(a)  .ut_time = (a)
8a8cfb
-#endif
8a8cfb
 
8a8cfb
   { .ut_type = BOOT_TIME, .ut_pid = 1, UT(1000) },
8a8cfb
   { .ut_type = RUN_LVL, .ut_pid = 1, UT(2000) },
8a8cfb
@@ -167,11 +161,7 @@ simulate_login (const char *line, const char *user)
8a8cfb
 	    entry[n].ut_pid = (entry_pid += 27);
8a8cfb
 	  entry[n].ut_type = USER_PROCESS;
8a8cfb
 	  strncpy (entry[n].ut_user, user, sizeof (entry[n].ut_user));
8a8cfb
-#if defined UTMPX || _HAVE_UT_TV - 0
8a8cfb
 	  entry[n].ut_tv.tv_sec = (entry_time += 1000);
8a8cfb
-#else
8a8cfb
-          entry[n].ut_time = (entry_time += 1000);
8a8cfb
-#endif
8a8cfb
 	  setutent ();
8a8cfb
 
8a8cfb
 	  if (pututline (&entry[n]) == NULL)
8a8cfb
@@ -201,11 +191,7 @@ simulate_logout (const char *line)
8a8cfb
 	{
8a8cfb
 	  entry[n].ut_type = DEAD_PROCESS;
8a8cfb
 	  strncpy (entry[n].ut_user, "", sizeof (entry[n].ut_user));
8a8cfb
-#if defined UTMPX || _HAVE_UT_TV - 0
8a8cfb
           entry[n].ut_tv.tv_sec = (entry_time += 1000);
8a8cfb
-#else
8a8cfb
-          entry[n].ut_time = (entry_time += 1000);
8a8cfb
-#endif
8a8cfb
 	  setutent ();
8a8cfb
 
8a8cfb
 	  if (pututline (&entry[n]) == NULL)
8a8cfb
@@ -390,14 +376,3 @@ do_test (int argc, char *argv[])
8a8cfb
 
8a8cfb
   return result;
8a8cfb
 }
8a8cfb
-
8a8cfb
-#else
8a8cfb
-
8a8cfb
-/* No field 'ut_type' in struct utmp.  */
8a8cfb
-int
8a8cfb
-main (void)
8a8cfb
-{
8a8cfb
-  return 0;
8a8cfb
-}
8a8cfb
-
8a8cfb
-#endif
8a8cfb
diff --git a/login/utmp_file.c b/login/utmp_file.c
8a8cfb
index 069e6d0452e333ad..da1baa6948d0eb39 100644
8a8cfb
--- a/login/utmp_file.c
8a8cfb
+++ b/login/utmp_file.c
8a8cfb
@@ -129,14 +129,7 @@ __libc_setutent (void)
8a8cfb
   file_offset = 0;
8a8cfb
 
8a8cfb
   /* Make sure the entry won't match.  */
8a8cfb
-#if _HAVE_UT_TYPE - 0
8a8cfb
   last_entry.ut_type = -1;
8a8cfb
-#else
8a8cfb
-  last_entry.ut_line[0] = '\177';
8a8cfb
-# if _HAVE_UT_ID - 0
8a8cfb
-  last_entry.ut_id[0] = '\0';
8a8cfb
-# endif
8a8cfb
-#endif
8a8cfb
 
8a8cfb
   return 1;
8a8cfb
 }
8a8cfb
@@ -201,7 +194,6 @@ internal_getut_r (const struct utmp *id, struct utmp *buffer,
8a8cfb
       LOCKING_FAILED ();
8a8cfb
     }
8a8cfb
 
8a8cfb
-#if _HAVE_UT_TYPE - 0
8a8cfb
   if (id->ut_type == RUN_LVL || id->ut_type == BOOT_TIME
8a8cfb
       || id->ut_type == OLD_TIME || id->ut_type == NEW_TIME)
8a8cfb
     {
8a8cfb
@@ -225,7 +217,6 @@ internal_getut_r (const struct utmp *id, struct utmp *buffer,
8a8cfb
 	}
8a8cfb
     }
8a8cfb
   else
8a8cfb
-#endif /* _HAVE_UT_TYPE */
8a8cfb
     {
8a8cfb
       /* Search for the next entry with the specified ID and with type
8a8cfb
 	 INIT_PROCESS, LOGIN_PROCESS, USER_PROCESS, or DEAD_PROCESS.  */
8a8cfb
@@ -316,13 +307,10 @@ __libc_getutline_r (const struct utmp *line, struct utmp *buffer,
8a8cfb
       file_offset += sizeof (struct utmp);
8a8cfb
 
8a8cfb
       /* Stop if we found a user or login entry.  */
8a8cfb
-      if (
8a8cfb
-#if _HAVE_UT_TYPE - 0
8a8cfb
-	  (last_entry.ut_type == USER_PROCESS
8a8cfb
+      if ((last_entry.ut_type == USER_PROCESS
8a8cfb
 	   || last_entry.ut_type == LOGIN_PROCESS)
8a8cfb
-	  &&
8a8cfb
-#endif
8a8cfb
-	  !strncmp (line->ut_line, last_entry.ut_line, sizeof line->ut_line))
8a8cfb
+	  && (strncmp (line->ut_line, last_entry.ut_line, sizeof line->ut_line)
8a8cfb
+	      == 0))
8a8cfb
 	break;
8a8cfb
     }
8a8cfb
 
8a8cfb
@@ -368,16 +356,12 @@ __libc_pututline (const struct utmp *data)
8a8cfb
 
8a8cfb
   /* Find the correct place to insert the data.  */
8a8cfb
   if (file_offset > 0
8a8cfb
-      && (
8a8cfb
-#if _HAVE_UT_TYPE - 0
8a8cfb
-	  (last_entry.ut_type == data->ut_type
8a8cfb
+      && ((last_entry.ut_type == data->ut_type
8a8cfb
 	   && (last_entry.ut_type == RUN_LVL
8a8cfb
 	       || last_entry.ut_type == BOOT_TIME
8a8cfb
 	       || last_entry.ut_type == OLD_TIME
8a8cfb
 	       || last_entry.ut_type == NEW_TIME))
8a8cfb
-	  ||
8a8cfb
-#endif
8a8cfb
-	  __utmp_equal (&last_entry, data)))
8a8cfb
+	  || __utmp_equal (&last_entry, data)))
8a8cfb
     found = 1;
8a8cfb
   else
8a8cfb
     {
8a8cfb
diff --git a/sysdeps/generic/utmp-equal.h b/sysdeps/generic/utmp-equal.h
8a8cfb
index 8b5c2e2cd2c4cf95..39993af192ab66ce 100644
8a8cfb
--- a/sysdeps/generic/utmp-equal.h
8a8cfb
+++ b/sysdeps/generic/utmp-equal.h
8a8cfb
@@ -27,26 +27,16 @@
8a8cfb
 static int
8a8cfb
 __utmp_equal (const struct utmp *entry, const struct utmp *match)
8a8cfb
 {
8a8cfb
-  return
8a8cfb
-    (
8a8cfb
-#if _HAVE_UT_TYPE - 0
8a8cfb
-     (entry->ut_type == INIT_PROCESS
8a8cfb
-      || entry->ut_type == LOGIN_PROCESS
8a8cfb
-      || entry->ut_type == USER_PROCESS
8a8cfb
-      || entry->ut_type == DEAD_PROCESS)
8a8cfb
-     &&
8a8cfb
-     (match->ut_type == INIT_PROCESS
8a8cfb
-      || match->ut_type == LOGIN_PROCESS
8a8cfb
-      || match->ut_type == USER_PROCESS
8a8cfb
-      || match->ut_type == DEAD_PROCESS)
8a8cfb
-     &&
8a8cfb
-#endif
8a8cfb
-#if _HAVE_UT_ID - 0
8a8cfb
-     (entry->ut_id[0] && match->ut_id[0]
8a8cfb
-      ? strncmp (entry->ut_id, match->ut_id, sizeof match->ut_id) == 0
8a8cfb
-      : strncmp (entry->ut_line, match->ut_line, sizeof match->ut_line) == 0)
8a8cfb
-#else
8a8cfb
-     strncmp (entry->ut_line, match->ut_line, sizeof match->ut_line) == 0
8a8cfb
-#endif
8a8cfb
-     );
8a8cfb
+  return (entry->ut_type == INIT_PROCESS
8a8cfb
+          || entry->ut_type == LOGIN_PROCESS
8a8cfb
+          || entry->ut_type == USER_PROCESS
8a8cfb
+          || entry->ut_type == DEAD_PROCESS)
8a8cfb
+    && (match->ut_type == INIT_PROCESS
8a8cfb
+        || match->ut_type == LOGIN_PROCESS
8a8cfb
+        || match->ut_type == USER_PROCESS
8a8cfb
+        || match->ut_type == DEAD_PROCESS)
8a8cfb
+    && (entry->ut_id[0] && match->ut_id[0]
8a8cfb
+        ? strncmp (entry->ut_id, match->ut_id, sizeof match->ut_id) == 0
8a8cfb
+        : (strncmp (entry->ut_line, match->ut_line, sizeof match->ut_line)
8a8cfb
+           == 0));
8a8cfb
 }
8a8cfb
diff --git a/sysdeps/gnu/bits/utmp.h b/sysdeps/gnu/bits/utmp.h
8a8cfb
deleted file mode 100644
8a8cfb
index 47a6082eacc56b4d..0000000000000000
8a8cfb
--- a/sysdeps/gnu/bits/utmp.h
8a8cfb
+++ /dev/null
8a8cfb
@@ -1,126 +0,0 @@
8a8cfb
-/* The `struct utmp' type, describing entries in the utmp file.  GNU version.
8a8cfb
-   Copyright (C) 1993-2018 Free Software Foundation, Inc.
8a8cfb
-   This file is part of the GNU C Library.
8a8cfb
-
8a8cfb
-   The GNU C Library is free software; you can redistribute it and/or
8a8cfb
-   modify it under the terms of the GNU Lesser General Public
8a8cfb
-   License as published by the Free Software Foundation; either
8a8cfb
-   version 2.1 of the License, or (at your option) any later version.
8a8cfb
-
8a8cfb
-   The GNU C Library is distributed in the hope that it will be useful,
8a8cfb
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
8a8cfb
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
8a8cfb
-   Lesser General Public License for more details.
8a8cfb
-
8a8cfb
-   You should have received a copy of the GNU Lesser General Public
8a8cfb
-   License along with the GNU C Library; if not, see
8a8cfb
-   <http://www.gnu.org/licenses/>.  */
8a8cfb
-
8a8cfb
-#ifndef _UTMP_H
8a8cfb
-# error "Never include <bits/utmp.h> directly; use <utmp.h> instead."
8a8cfb
-#endif
8a8cfb
-
8a8cfb
-#include <paths.h>
8a8cfb
-#include <sys/time.h>
8a8cfb
-#include <sys/types.h>
8a8cfb
-#include <bits/wordsize.h>
8a8cfb
-
8a8cfb
-
8a8cfb
-#define UT_LINESIZE	32
8a8cfb
-#define UT_NAMESIZE	32
8a8cfb
-#define UT_HOSTSIZE	256
8a8cfb
-
8a8cfb
-
8a8cfb
-/* The structure describing an entry in the database of
8a8cfb
-   previous logins.  */
8a8cfb
-struct lastlog
8a8cfb
-  {
8a8cfb
-#if __WORDSIZE_TIME64_COMPAT32
8a8cfb
-    int32_t ll_time;
8a8cfb
-#else
8a8cfb
-    __time_t ll_time;
8a8cfb
-#endif
8a8cfb
-    char ll_line[UT_LINESIZE];
8a8cfb
-    char ll_host[UT_HOSTSIZE];
8a8cfb
-  };
8a8cfb
-
8a8cfb
-
8a8cfb
-/* The structure describing the status of a terminated process.  This
8a8cfb
-   type is used in `struct utmp' below.  */
8a8cfb
-struct exit_status
8a8cfb
-  {
8a8cfb
-    short int e_termination;	/* Process termination status.  */
8a8cfb
-    short int e_exit;		/* Process exit status.  */
8a8cfb
-  };
8a8cfb
-
8a8cfb
-
8a8cfb
-/* The structure describing an entry in the user accounting database.  */
8a8cfb
-struct utmp
8a8cfb
-{
8a8cfb
-  short int ut_type;		/* Type of login.  */
8a8cfb
-  pid_t ut_pid;			/* Process ID of login process.  */
8a8cfb
-  char ut_line[UT_LINESIZE]
8a8cfb
-    __attribute_nonstring__;	/* Devicename.  */
8a8cfb
-  char ut_id[4];		/* Inittab ID.  */
8a8cfb
-  char ut_user[UT_NAMESIZE]
8a8cfb
-    __attribute_nonstring__;	/* Username.  */
8a8cfb
-  char ut_host[UT_HOSTSIZE]
8a8cfb
-    __attribute_nonstring__;	/* Hostname for remote login.  */
8a8cfb
-  struct exit_status ut_exit;	/* Exit status of a process marked
8a8cfb
-				   as DEAD_PROCESS.  */
8a8cfb
-/* The ut_session and ut_tv fields must be the same size when compiled
8a8cfb
-   32- and 64-bit.  This allows data files and shared memory to be
8a8cfb
-   shared between 32- and 64-bit applications.  */
8a8cfb
-#if __WORDSIZE_TIME64_COMPAT32
8a8cfb
-  int32_t ut_session;		/* Session ID, used for windowing.  */
8a8cfb
-  struct
8a8cfb
-  {
8a8cfb
-    int32_t tv_sec;		/* Seconds.  */
8a8cfb
-    int32_t tv_usec;		/* Microseconds.  */
8a8cfb
-  } ut_tv;			/* Time entry was made.  */
8a8cfb
-#else
8a8cfb
-  long int ut_session;		/* Session ID, used for windowing.  */
8a8cfb
-  struct timeval ut_tv;		/* Time entry was made.  */
8a8cfb
-#endif
8a8cfb
-
8a8cfb
-  int32_t ut_addr_v6[4];	/* Internet address of remote host.  */
8a8cfb
-  char __glibc_reserved[20];		/* Reserved for future use.  */
8a8cfb
-};
8a8cfb
-
8a8cfb
-/* Backwards compatibility hacks.  */
8a8cfb
-#define ut_name		ut_user
8a8cfb
-#ifndef _NO_UT_TIME
8a8cfb
-/* We have a problem here: `ut_time' is also used otherwise.  Define
8a8cfb
-   _NO_UT_TIME if the compiler complains.  */
8a8cfb
-# define ut_time	ut_tv.tv_sec
8a8cfb
-#endif
8a8cfb
-#define ut_xtime	ut_tv.tv_sec
8a8cfb
-#define ut_addr		ut_addr_v6[0]
8a8cfb
-
8a8cfb
-
8a8cfb
-/* Values for the `ut_type' field of a `struct utmp'.  */
8a8cfb
-#define EMPTY		0	/* No valid user accounting information.  */
8a8cfb
-
8a8cfb
-#define RUN_LVL		1	/* The system's runlevel.  */
8a8cfb
-#define BOOT_TIME	2	/* Time of system boot.  */
8a8cfb
-#define NEW_TIME	3	/* Time after system clock changed.  */
8a8cfb
-#define OLD_TIME	4	/* Time when system clock changed.  */
8a8cfb
-
8a8cfb
-#define INIT_PROCESS	5	/* Process spawned by the init process.  */
8a8cfb
-#define LOGIN_PROCESS	6	/* Session leader of a logged in user.  */
8a8cfb
-#define USER_PROCESS	7	/* Normal process.  */
8a8cfb
-#define DEAD_PROCESS	8	/* Terminated process.  */
8a8cfb
-
8a8cfb
-#define ACCOUNTING	9
8a8cfb
-
8a8cfb
-/* Old Linux name for the EMPTY type.  */
8a8cfb
-#define UT_UNKNOWN	EMPTY
8a8cfb
-
8a8cfb
-
8a8cfb
-/* Tell the user that we have a modern system with UT_HOST, UT_PID,
8a8cfb
-   UT_TYPE, UT_ID and UT_TV fields.  */
8a8cfb
-#define _HAVE_UT_TYPE	1
8a8cfb
-#define _HAVE_UT_PID	1
8a8cfb
-#define _HAVE_UT_ID	1
8a8cfb
-#define _HAVE_UT_TV	1
8a8cfb
-#define _HAVE_UT_HOST	1