@itemize
@item
This header file is missing on some platforms:
-FreeBSD 13.0, mingw, MSVC 14.
+FreeBSD 13.2, mingw, MSVC 14.
@item
@code{<sys/types.h>} is a prerequisite of @code{<utmp.h>} on some platforms:
FreeBSD 8.0, OpenBSD 7.2.
Portability problems not fixed by Gnulib:
@itemize
@item
+While some platforms have the @code{struct utmp} field @code{ut_user},
+older platforms have the field @code{ut_name}.
+@item
+The @code{struct utmp} fields @code{ut_id}, @code{ut_pid}, @code{ut_type}
+do not exist on some platforms:
+macOS, old FreeBSD, NetBSD, OpenBSD, Minix.
+@item
+The @code{struct utmp} field @code{ut_host} does not exist on some platforms:
+IRIX, Solaris.
+@item
+The @code{struct utmp} field @code{ut_exit} does not exist on some platforms:
+macOS, old FreeBSD, NetBSD, OpenBSD, Minix, Cygwin.
+@item
+The @code{struct utmp} field @code{ut_session} does not exist on some platforms:
+macOS, old FreeBSD, NetBSD, OpenBSD, Minix, AIX, HP-UX, IRIX, Solaris, Cygwin.
+@item
+The @code{struct utmp} field @code{ut_addr} or @code{ut_addr_v6} does not exist
+on some platforms:
+macOS, old FreeBSD, NetBSD, OpenBSD, Minix, AIX, IRIX, Solaris.
+@item
On some platforms, this API does not support timestamps past the
year 2038:
glibc 2.38 on 32-bit platforms like x86 and ARM where @code{time_t}
# if HAVE_UTMPX_H
+/* <utmpx.h> defines 'struct utmpx' with the following fields:
+
+ Field Type Platforms
+ ---------- ------ ---------
+ ⎡ ut_user char[] glibc, musl, macOS, FreeBSD, AIX, HP-UX, IRIX, Solaris, Cygwin
+ ⎣ ut_name char[] NetBSD, Minix
+ ut_id char[] glibc, musl, macOS, FreeBSD, NetBSD, Minix, AIX, HP-UX, IRIX, Solaris, Cygwin
+ ut_line char[] glibc, musl, macOS, FreeBSD, NetBSD, Minix, AIX, HP-UX, IRIX, Solaris, Cygwin
+ ut_pid pid_t glibc, musl, macOS, FreeBSD, NetBSD, Minix, AIX, HP-UX, IRIX, Solaris, Cygwin
+ ut_type short glibc, musl, macOS, FreeBSD, NetBSD, Minix, AIX, HP-UX, IRIX, Solaris, Cygwin
+ ⎡ ut_tv struct glibc, musl, macOS, FreeBSD, NetBSD, Minix, AIX, HP-UX, IRIX, Solaris, Cygwin
+ ⎢ { tv_sec; tv_usec; }
+ ⎣ ut_time time_t Cygwin
+ ut_host char[] glibc, musl, macOS, FreeBSD, NetBSD, Minix, AIX, HP-UX, IRIX, Solaris, Cygwin
+ ut_exit struct glibc, musl, NetBSD, Minix, HP-UX, IRIX, Solaris
+ { e_termination; e_exit; }
+ ut_session [long] int glibc, musl, NetBSD, Minix, IRIX, Solaris
+ ⎡ ut_addr [long] int HP-UX, Cygwin
+ ⎢ ut_addr_v6 [u]int[4] glibc, musl
+ ⎣ ut_ss struct sockaddr_storage NetBSD, Minix
+ */
+
# if HAVE_UTMP_H
/* HPUX 10.20 needs utmp.h, for the definition of e.g., UTMP_FILE. */
# include <utmp.h>
# if HAVE_STRUCT_UTMPX_UT_EXIT_E_TERMINATION
# define UT_EXIT_E_TERMINATION(UT) ((UT)->ut_exit.e_termination)
# else
-# if HAVE_STRUCT_UTMPX_UT_EXIT_UT_TERMINATION
+# if HAVE_STRUCT_UTMPX_UT_EXIT_UT_TERMINATION /* OSF/1 */
# define UT_EXIT_E_TERMINATION(UT) ((UT)->ut_exit.ut_termination)
# else
# define UT_EXIT_E_TERMINATION(UT) 0
# if HAVE_STRUCT_UTMPX_UT_EXIT_E_EXIT
# define UT_EXIT_E_EXIT(UT) ((UT)->ut_exit.e_exit)
# else
-# if HAVE_STRUCT_UTMPX_UT_EXIT_UT_EXIT
+# if HAVE_STRUCT_UTMPX_UT_EXIT_UT_EXIT /* OSF/1 */
# define UT_EXIT_E_EXIT(UT) ((UT)->ut_exit.ut_exit)
# else
# define UT_EXIT_E_EXIT(UT) 0
# elif HAVE_UTMP_H
+/* <utmp.h> defines 'struct utmp' with the following fields:
+
+ Field Type Platforms
+ ---------- ------ ---------
+ ⎡ ut_user char[] glibc, musl, AIX, HP-UX, IRIX, Solaris, Cygwin, Android
+ ⎣ ut_name char[] macOS, old FreeBSD, NetBSD, OpenBSD, Minix
+ ut_id char[] glibc, musl, AIX, HP-UX, IRIX, Solaris, Cygwin, Android
+ ut_line char[] glibc, musl, macOS, old FreeBSD, NetBSD, OpenBSD, Minix, AIX, HP-UX, IRIX, Solaris, Cygwin, Android
+ ut_pid pid_t glibc, musl, AIX, HP-UX, IRIX, Solaris, Cygwin, Android
+ ut_type short glibc, musl, AIX, HP-UX, IRIX, Solaris, Cygwin, Android
+ ⎡ ut_tv struct glibc, musl, Android
+ ⎢ { tv_sec; tv_usec; }
+ ⎣ ut_time time_t macOS, old FreeBSD, NetBSD, OpenBSD, Minix, AIX, HP-UX, IRIX, Solaris, Cygwin
+ ut_host char[] glibc, musl, macOS, old FreeBSD, NetBSD, OpenBSD, Minix, AIX, HP-UX, Cygwin, Android
+ ut_exit struct glibc, musl, AIX, HP-UX, IRIX, Solaris, Android
+ { e_termination; e_exit; }
+ ut_session [long] int glibc, musl, Android
+ ⎡ ut_addr [long] int HP-UX, Cygwin
+ ⎣ ut_addr_v6 [u]int[4] glibc, musl, Android
+ */
+
# include <utmp.h>
# if !HAVE_DECL_GETUTENT
struct utmp *getutent (void);
# if HAVE_STRUCT_UTMP_UT_EXIT_E_TERMINATION
# define UT_EXIT_E_TERMINATION(UT) ((UT)->ut_exit.e_termination)
# else
-# if HAVE_STRUCT_UTMP_UT_EXIT_UT_TERMINATION
-# define UT_EXIT_E_TERMINATION(UT) ((UT)->ut_exit.ut_termination)
-# else
-# define UT_EXIT_E_TERMINATION(UT) 0
-# endif
+# define UT_EXIT_E_TERMINATION(UT) 0
# endif
# if HAVE_STRUCT_UTMP_UT_EXIT_E_EXIT
# define UT_EXIT_E_EXIT(UT) ((UT)->ut_exit.e_exit)
# else
-# if HAVE_STRUCT_UTMP_UT_EXIT_UT_EXIT
-# define UT_EXIT_E_EXIT(UT) ((UT)->ut_exit.ut_exit)
-# else
-# define UT_EXIT_E_EXIT(UT) 0
-# endif
+# define UT_EXIT_E_EXIT(UT) 0
# endif
# else
-# readutmp.m4 serial 20
+# readutmp.m4 serial 21
dnl Copyright (C) 2002-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_CHECK_MEMBERS([struct utmp.ut_exit],,,[$utmp_includes])
AC_CHECK_MEMBERS([struct utmpx.ut_exit.ut_exit],,,[$utmp_includes])
- AC_CHECK_MEMBERS([struct utmp.ut_exit.ut_exit],,,[$utmp_includes])
AC_CHECK_MEMBERS([struct utmpx.ut_exit.e_exit],,,[$utmp_includes])
AC_CHECK_MEMBERS([struct utmp.ut_exit.e_exit],,,[$utmp_includes])
AC_CHECK_MEMBERS([struct utmpx.ut_exit.ut_termination],,,[$utmp_includes])
- AC_CHECK_MEMBERS([struct utmp.ut_exit.ut_termination],,,[$utmp_includes])
AC_CHECK_MEMBERS([struct utmpx.ut_exit.e_termination],,,[$utmp_includes])
AC_CHECK_MEMBERS([struct utmp.ut_exit.e_termination],,,[$utmp_includes])
fi