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