[PATCH 3/3] login: Make user accounting database no-op
Thorsten Kukuk
kukuk@suse.com
Wed Aug 7 09:20:22 GMT 2024
Hi,
I want to come back to this patch. I haven't seen any feedback or
actions anymore after Josephs comment, that the link to my blog should
be added to the news section.
At SUSE/openSUSE all new products don't have /run/utmp nor
/var/log/wtmp anymore. But applications checking return code of the
utmp/wtmp functions report an error, if this files don't exist. So it
would be really nice if we could make this functions a NOP at compile
time.
Thanks,
Thorsten
On Thu, Nov 09, Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:
>
> The user accounting database functions are now deprecated and do not
> access or update the database files. The interface was not updated to
> support 64 bit time_t on all architectures, on legacy 32 bit time_t
> architectures the database is also incompatible when 64 bit time_t is
> used, and the implementation has some design flaws that is not easy
> fixable without a complete rewrite (BZ #24492).
>
> Recent system are moving away from utmp interface [1] and using
> alternatives instead. Even for non systemd system, alternative exists
> that are better than current status.
>
> It affects the obsolete functions login, logout, logwtmp, updwtmp, utmpname,
> getutent, setutent, endutent, getutid, getutline, pututline, getutent_r,
> getutid_r, and getutline_r along with POSIX defined setutxent, endutxent,
> getutxent, getutxid, getutxline, pututxline, and GNU extension utmpxname,
> updwtmpx, getutmp, and getutmpx.
>
> The function now are no-op and always returns an error or invalid result
> and set errno accordingly (when applicable). No compatibility support
> is provided, newer system deployments are moving to use different user
> accounting API where the old file are not guaranteed to exist.
>
> [1] https://www.thkukuk.de/blog/Y2038_glibc_utmp_64bit/
> ---
> NEWS | 18 +
> include/set-freeres.h | 3 -
> include/utmp.h | 29 -
> login/Makefile | 9 +-
> login/endutxent.c | 25 -
> login/getutent.c | 28 +-
> login/getutent_r.c | 45 +-
> login/getutid.c | 25 +-
> login/getutid_r.c | 34 +-
> login/getutline.c | 27 +-
> login/getutline_r.c | 21 +-
> login/getutmp.c | 12 +-
> login/getutmpx.c | 34 --
> login/getutxent.c | 25 -
> login/getutxid.c | 25 -
> login/getutxline.c | 25 -
> login/login.c | 118 +---
> login/logout.c | 44 +-
> login/logwtmp.c | 22 +-
> login/programs/utmpdump.c | 62 ---
> login/pututxline.c | 25 -
> login/setutxent.c | 25 -
> login/tst-pututxline-cache.c | 193 -------
> login/tst-pututxline-lockfail.c | 176 ------
> login/tst-updwtmpx.c | 112 ----
> login/tst-utmp.c | 377 -------------
> login/tst-utmpx.c | 2 -
> login/updwtmp.c | 13 +-
> login/updwtmpx.c | 25 -
> login/utmp-private.h | 44 --
> login/utmp_file.c | 506 ------------------
> login/utmpname.c | 57 +-
> login/utmpxname.c | 25 -
> malloc/set-freeres.c | 6 -
> manual/users.texi | 446 ++-------------
> sysdeps/generic/paths.h | 6 +-
> sysdeps/gnu/Makefile | 13 -
> sysdeps/gnu/getutmp.c | 34 --
> sysdeps/gnu/getutmpx.c | 1 -
> sysdeps/gnu/updwtmp.c | 30 --
> sysdeps/gnu/utmp_file.c | 30 --
> sysdeps/unix/sysv/linux/paths.h | 4 +-
> sysdeps/unix/sysv/linux/s390/s390-32/Makefile | 4 -
> .../unix/sysv/linux/s390/s390-32/getutent.c | 19 +-
> .../unix/sysv/linux/s390/s390-32/getutent_r.c | 11 +-
> .../unix/sysv/linux/s390/s390-32/getutid.c | 4 +-
> .../unix/sysv/linux/s390/s390-32/getutid_r.c | 2 +-
> .../unix/sysv/linux/s390/s390-32/getutline.c | 4 +-
> .../sysv/linux/s390/s390-32/getutline_r.c | 2 +-
> .../unix/sysv/linux/s390/s390-32/getutmp.c | 20 +-
> .../unix/sysv/linux/s390/s390-32/getutxent.c | 29 -
> .../unix/sysv/linux/s390/s390-32/getutxid.c | 29 -
> .../unix/sysv/linux/s390/s390-32/getutxline.c | 29 -
> sysdeps/unix/sysv/linux/s390/s390-32/login.c | 1 +
> .../unix/sysv/linux/s390/s390-32/login32.c | 37 --
> .../unix/sysv/linux/s390/s390-32/pututxline.c | 29 -
> .../unix/sysv/linux/s390/s390-32/updwtmp.c | 6 +-
> .../unix/sysv/linux/s390/s390-32/updwtmpx.c | 29 -
> .../sysv/linux/s390/s390-32/utmp-convert.h | 85 ---
> sysdeps/unix/sysv/linux/s390/s390-32/utmp32.c | 183 -------
> sysdeps/unix/sysv/linux/s390/s390-32/utmp32.h | 51 --
> .../sysv/linux/s390/s390-32/utmpx-convert.h | 84 ---
> .../unix/sysv/linux/s390/s390-32/utmpx32.c | 138 -----
> .../unix/sysv/linux/s390/s390-32/utmpx32.h | 59 --
> sysdeps/unix/sysv/linux/utmp_file.c | 36 --
> 65 files changed, 166 insertions(+), 3506 deletions(-)
> delete mode 100644 login/endutxent.c
> delete mode 100644 login/getutmpx.c
> delete mode 100644 login/getutxent.c
> delete mode 100644 login/getutxid.c
> delete mode 100644 login/getutxline.c
> delete mode 100644 login/programs/utmpdump.c
> delete mode 100644 login/pututxline.c
> delete mode 100644 login/setutxent.c
> delete mode 100644 login/tst-pututxline-cache.c
> delete mode 100644 login/tst-pututxline-lockfail.c
> delete mode 100644 login/tst-updwtmpx.c
> delete mode 100644 login/tst-utmp.c
> delete mode 100644 login/tst-utmpx.c
> delete mode 100644 login/updwtmpx.c
> delete mode 100644 login/utmp-private.h
> delete mode 100644 login/utmp_file.c
> delete mode 100644 login/utmpxname.c
> delete mode 100644 sysdeps/gnu/getutmp.c
> delete mode 100644 sysdeps/gnu/getutmpx.c
> delete mode 100644 sysdeps/gnu/updwtmp.c
> delete mode 100644 sysdeps/gnu/utmp_file.c
> delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/getutxent.c
> delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/getutxid.c
> delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/getutxline.c
> delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/login32.c
> delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/pututxline.c
> delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/updwtmpx.c
> delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/utmp-convert.h
> delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/utmp32.c
> delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/utmp32.h
> delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/utmpx-convert.h
> delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/utmpx32.c
> delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/utmpx32.h
> delete mode 100644 sysdeps/unix/sysv/linux/utmp_file.c
>
> diff --git a/NEWS b/NEWS
> index 139cfef1b0..833e8fd532 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -65,6 +65,24 @@ Deprecated and removed features, and other changes affecting compatibility:
> of GNU libc are advised to check whether their build processes can be
> simplified.
>
> +* The user accounting database functions are now deprecated and do not
> + access or update the database files. The interface was not updated to
> + support 64 bit time_t on all architectures, on legacy 32 bit time_t
> + architectures the database is also incompatible when 64 bit time_t is
> + used, and the implementation has some design flaws that is not easy
> + fixable without a complete rewrite (BZ #24492).
> +
> + It affects the obsolete functions login, logout, logwtmp, updwtmp, utmpname,
> + getutent, setutent, endutent, getutid, getutline, pututline, getutent_r,
> + getutid_r, and getutline_r along with POSIX defined setutxent, endutxent,
> + getutxent, getutxid, getutxline, pututxline, and GNU extension utmpxname,
> + updwtmpx, getutmp, and getutmpx.
> +
> + The function now are no-op and always returns an error or invalid result
> + and set errno accordingly (when applicable). No compatibility support
> + is provided, newer system deployments are moving to use different user
> + accounting API where the old file are not guaranteed to exist.
> +
> Changes to build and runtime requirements:
>
> * Building on LoongArch requires at a minimum binutils 2.41 for vector
> diff --git a/include/set-freeres.h b/include/set-freeres.h
> index 866d0e3717..d3b8f79457 100644
> --- a/include/set-freeres.h
> +++ b/include/set-freeres.h
> @@ -100,9 +100,6 @@ extern struct netaddr * __libc_resolv_res_hconf_freemem_ptr attribute_hidden;
> extern char * __libc_fgetspent_freemem_ptr attribute_hidden;
> extern __time64_t * __libc_tzfile_freemem_ptr attribute_hidden;
> extern char * __libc_getnameinfo_freemem_ptr attribute_hidden;
> -extern struct utmp * __libc_getutent_freemem_ptr attribute_hidden;
> -extern struct utmp * __libc_getutid_freemem_ptr attribute_hidden;
> -extern struct utmp * __libc_getutline_freemem_ptr attribute_hidden;
> extern printf_arginfo_size_function ** __libc_reg_printf_freemem_ptr
> attribute_hidden;
> extern printf_va_arg_function ** __libc_reg_type_freemem_ptr
> diff --git a/include/utmp.h b/include/utmp.h
> index b7921e5fb8..b16c856357 100644
> --- a/include/utmp.h
> +++ b/include/utmp.h
> @@ -3,36 +3,7 @@
>
> # ifndef _ISOMAC
>
> -/* Now define the internal interfaces. */
> -extern void __updwtmp (const char *__wtmp_file, const struct utmp *__utmp);
> -libc_hidden_proto (__updwtmp)
> -extern int __utmpname (const char *__file);
> -libc_hidden_proto (__utmpname)
> -extern struct utmp *__getutent (void);
> -libc_hidden_proto (__getutent)
> -extern void __setutent (void);
> -libc_hidden_proto (__setutent)
> -extern void __endutent (void);
> -libc_hidden_proto (__endutent)
> -extern struct utmp *__getutid (const struct utmp *__id);
> -libc_hidden_proto (__getutid)
> -extern struct utmp *__getutline (const struct utmp *__line);
> -libc_hidden_proto (__getutline)
> -extern struct utmp *__pututline (const struct utmp *__utmp_ptr);
> -libc_hidden_proto (__pututline)
> -extern int __getutent_r (struct utmp *__buffer, struct utmp **__result);
> -libc_hidden_proto (__getutent_r)
> -extern int __getutid_r (const struct utmp *__id, struct utmp *__buffer,
> - struct utmp **__result);
> -libc_hidden_proto (__getutid_r)
> -extern int __getutline_r (const struct utmp *__line,
> - struct utmp *__buffer, struct utmp **__result);
> -libc_hidden_proto (__getutline_r)
> -
> -libc_hidden_proto (login)
> libc_hidden_proto (login_tty)
> -libc_hidden_proto (logout)
> -libc_hidden_proto (logwtmp)
>
> # endif /* !_ISOMAC */
> #endif
> diff --git a/login/Makefile b/login/Makefile
> index 4d8098fa23..3d21ab2868 100644
> --- a/login/Makefile
> +++ b/login/Makefile
> @@ -42,6 +42,7 @@ routines := \
> getutid_r \
> getutline \
> getutline_r \
> + getutmp \
> grantpt \
> login \
> login_tty \
> @@ -53,14 +54,11 @@ routines := \
> setlogin \
> unlockpt \
> updwtmp \
> - utmp_file \
> utmpname \
> # routines
>
> CFLAGS-grantpt.c += -DLIBEXECDIR='"$(libexecdir)"'
>
> -others = utmpdump
> -
> ifeq (yes,$(build-pt-chown))
> others += \
> pt_chown \
> @@ -78,11 +76,6 @@ tests := \
> tst-getlogin \
> tst-grantpt \
> tst-ptsname \
> - tst-pututxline-cache \
> - tst-pututxline-lockfail \
> - tst-updwtmpx \
> - tst-utmp \
> - tst-utmpx \
> # tests
>
> # Empty compatibility library for old binaries.
> diff --git a/login/endutxent.c b/login/endutxent.c
> deleted file mode 100644
> index e9181dabb0..0000000000
> --- a/login/endutxent.c
> +++ /dev/null
> @@ -1,25 +0,0 @@
> -/* Copyright (C) 1998-2023 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public
> - License as published by the Free Software Foundation; either
> - version 2.1 of the License, or (at your option) any later version.
> -
> - The GNU C Library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; if not, see
> - <https://www.gnu.org/licenses/>. */
> -
> -#include <utmp.h>
> -#include <utmpx.h>
> -
> -void
> -endutxent (void)
> -{
> - __endutent ();
> -}
> diff --git a/login/getutent.c b/login/getutent.c
> index ed8b162b8a..11aa721a44 100644
> --- a/login/getutent.c
> +++ b/login/getutent.c
> @@ -15,33 +15,15 @@
> License along with the GNU C Library; if not, see
> <https://www.gnu.org/licenses/>. */
>
> -#include <stdlib.h>
> +#include <stddef.h>
> #include <utmp.h>
> -#include <set-freeres.h>
> -
> -
> -/* Local buffer to store the result. */
> -static struct utmp *buffer;
> -
>
> struct utmp *
> __getutent (void)
> {
> - struct utmp *result;
> -
> - if (buffer == NULL)
> - {
> - buffer = (struct utmp *) malloc (sizeof (struct utmp));
> - if (buffer == NULL)
> - return NULL;
> - }
> -
> - if (__getutent_r (buffer, &result) < 0)
> - return NULL;
> -
> - return result;
> + return NULL;
> }
> -libc_hidden_def (__getutent)
> weak_alias (__getutent, getutent)
> -
> -weak_alias (buffer, __libc_getutent_freemem_ptr)
> +weak_alias (__getutent, getutxent)
> +stub_warning (getutent)
> +stub_warning (getutxent)
> diff --git a/login/getutent_r.c b/login/getutent_r.c
> index 2812232a79..9ced590818 100644
> --- a/login/getutent_r.c
> +++ b/login/getutent_r.c
> @@ -19,7 +19,6 @@
> #include <stdlib.h>
> #include <utmp.h>
>
> -#include "utmp-private.h"
>
> /* We need to protect the opening of the file. */
> __libc_lock_define_initialized (, __libc_utmp_lock attribute_hidden)
> @@ -28,58 +27,38 @@ __libc_lock_define_initialized (, __libc_utmp_lock attribute_hidden)
> void
> __setutent (void)
> {
> - __libc_lock_lock (__libc_utmp_lock);
> -
> - __libc_setutent ();
> -
> - __libc_lock_unlock (__libc_utmp_lock);
> }
> -libc_hidden_def (__setutent)
> weak_alias (__setutent, setutent)
> +weak_alias (__setutent, setutxent)
> +stub_warning (setutent)
> +stub_warning (setutxent)
>
>
> int
> __getutent_r (struct utmp *buffer, struct utmp **result)
> {
> - int retval;
> -
> - __libc_lock_lock (__libc_utmp_lock);
> -
> - retval = __libc_getutent_r (buffer, result);
> -
> - __libc_lock_unlock (__libc_utmp_lock);
> -
> - return retval;
> + errno = ENOTSUP;
> + return -1;
> }
> -libc_hidden_def (__getutent_r)
> weak_alias (__getutent_r, getutent_r)
> +stub_warning (getutent_r)
>
>
> struct utmp *
> __pututline (const struct utmp *data)
> {
> - struct utmp *buffer;
> -
> - __libc_lock_lock (__libc_utmp_lock);
> -
> - buffer = __libc_pututline (data);
> -
> - __libc_lock_unlock (__libc_utmp_lock);
> -
> - return buffer;
> + return NULL;
> }
> -libc_hidden_def (__pututline)
> weak_alias (__pututline, pututline)
> +weak_alias (__pututline, pututxline)
> +stub_warning (pututline)
> +stub_warning (pututxline)
>
>
> void
> __endutent (void)
> {
> - __libc_lock_lock (__libc_utmp_lock);
> -
> - __libc_endutent ();
> -
> - __libc_lock_unlock (__libc_utmp_lock);
> }
> -libc_hidden_def (__endutent)
> weak_alias (__endutent, endutent)
> +weak_alias (__endutent, endutxent)
> +stub_warning (endutent)
> diff --git a/login/getutid.c b/login/getutid.c
> index 658fdc08ca..d36aa6a2fd 100644
> --- a/login/getutid.c
> +++ b/login/getutid.c
> @@ -15,30 +15,15 @@
> License along with the GNU C Library; if not, see
> <https://www.gnu.org/licenses/>. */
>
> -#include <stdlib.h>
> +#include <stddef.h>
> #include <utmp.h>
> -#include <set-freeres.h>
> -
> -/* Local buffer to store the result. */
> -static struct utmp *buffer;
>
> struct utmp *
> __getutid (const struct utmp *id)
> {
> - struct utmp *result;
> -
> - if (buffer == NULL)
> - {
> - buffer = (struct utmp *) malloc (sizeof (struct utmp));
> - if (buffer == NULL)
> - return NULL;
> - }
> - if (__getutid_r (id, buffer, &result) < 0)
> - return NULL;
> -
> - return result;
> + return NULL;
> }
> -libc_hidden_def (__getutid)
> weak_alias (__getutid, getutid)
> -
> -weak_alias (buffer, __libc_getutid_freemem_ptr)
> +weak_alias (__getutid, getutxid)
> +stub_warning (getutid)
> +stub_warning (getutxid)
> diff --git a/login/getutid_r.c b/login/getutid_r.c
> index 8beef31364..12f1011301 100644
> --- a/login/getutid_r.c
> +++ b/login/getutid_r.c
> @@ -15,42 +15,14 @@
> License along with the GNU C Library; if not, see
> <https://www.gnu.org/licenses/>. */
>
> -#include <libc-lock.h>
> #include <errno.h>
> -#include <stdlib.h>
> #include <utmp.h>
>
> -#include "utmp-private.h"
> -
> -
> -/* We have to use the lock in getutent_r.c. */
> -__libc_lock_define (extern, __libc_utmp_lock attribute_hidden)
> -
> -
> int
> __getutid_r (const struct utmp *id, struct utmp *buffer, struct utmp **result)
> {
> - int retval;
> -
> - /* Test whether ID has any of the legal types. */
> - if (id->ut_type != RUN_LVL && id->ut_type != BOOT_TIME
> - && id->ut_type != OLD_TIME && id->ut_type != NEW_TIME
> - && id->ut_type != INIT_PROCESS && id->ut_type != LOGIN_PROCESS
> - && id->ut_type != USER_PROCESS && id->ut_type != DEAD_PROCESS)
> - /* No, using '<' and '>' for the test is not possible. */
> - {
> - __set_errno (EINVAL);
> - *result = NULL;
> - return -1;
> - }
> -
> - __libc_lock_lock (__libc_utmp_lock);
> -
> - retval = __libc_getutid_r (id, buffer, result);
> -
> - __libc_lock_unlock (__libc_utmp_lock);
> -
> - return retval;
> + errno = ENOTSUP;
> + return -1;
> }
> -libc_hidden_def (__getutid_r)
> weak_alias (__getutid_r, getutid_r)
> +stub_warning (getutid_r)
> diff --git a/login/getutline.c b/login/getutline.c
> index a10c256c42..2092c56c9c 100644
> --- a/login/getutline.c
> +++ b/login/getutline.c
> @@ -15,32 +15,15 @@
> License along with the GNU C Library; if not, see
> <https://www.gnu.org/licenses/>. */
>
> -#include <stdlib.h>
> +#include <stddef.h>
> #include <utmp.h>
> -#include <set-freeres.h>
> -
> -
> -/* Local buffer to store the result. */
> -static struct utmp *buffer;
> -
>
> struct utmp *
> __getutline (const struct utmp *line)
> {
> - struct utmp *result;
> -
> - if (buffer == NULL)
> - {
> - buffer = (struct utmp *) malloc (sizeof (struct utmp));
> - if (buffer == NULL)
> - return NULL;
> - }
> - if (__getutline_r (line, buffer, &result) < 0)
> - return NULL;
> -
> - return result;
> + return NULL;
> }
> -libc_hidden_def (__getutline)
> weak_alias (__getutline, getutline)
> -
> -weak_alias (buffer, __libc_getutline_freemem_ptr)
> +weak_alias (__getutline, getutxline)
> +stub_warning (getutline)
> +stub_warning (getutxline)
> diff --git a/login/getutline_r.c b/login/getutline_r.c
> index 3b667c7677..05f116024c 100644
> --- a/login/getutline_r.c
> +++ b/login/getutline_r.c
> @@ -16,29 +16,14 @@
> <https://www.gnu.org/licenses/>. */
>
> #include <errno.h>
> -#include <libc-lock.h>
> #include <utmp.h>
>
> -#include "utmp-private.h"
> -
> -
> -/* We have to use the lock in getutent_r.c. */
> -__libc_lock_define (extern, __libc_utmp_lock attribute_hidden)
> -
> -
> int
> __getutline_r (const struct utmp *line, struct utmp *buffer,
> struct utmp **result)
> {
> - int retval;
> -
> - __libc_lock_lock (__libc_utmp_lock);
> -
> - retval = __libc_getutline_r (line, buffer, result);
> -
> - __libc_lock_unlock (__libc_utmp_lock);
> -
> - return retval;
> + errno = ENOTSUP;
> + return -1;
> }
> -libc_hidden_def (__getutline_r)
> weak_alias (__getutline_r, getutline_r)
> +stub_warning (getutline_r)
> diff --git a/login/getutmp.c b/login/getutmp.c
> index 8686fd4440..19314ac508 100644
> --- a/login/getutmp.c
> +++ b/login/getutmp.c
> @@ -17,17 +17,15 @@
>
> #include <string.h>
> #include <utmp.h>
> +#define getutmpx __redirect_getutmpx
> #include <utmpx.h>
> +#undef getutmpx
>
> /* Copy the information in UTMPX to UTMP. */
> void
> getutmp (const struct utmpx *utmpx, struct utmp *utmp)
> {
> - utmp->ut_type = utmpx->ut_type;
> - utmp->ut_pid = utmpx->ut_pid;
> - memcpy (utmp->ut_line, utmpx->ut_line, sizeof (utmp->ut_line));
> - memcpy (utmp->ut_user, utmpx->ut_user, sizeof (utmp->ut_user));
> - memcpy (utmp->ut_id, utmpx->ut_id, sizeof (utmp->ut_id));
> - memcpy (utmp->ut_host, utmpx->ut_host, sizeof (utmp->ut_host));
> - utmp->ut_tv = utmpx->ut_tv;
> }
> +weak_alias (getutmp, getutmpx)
> +stub_warning (getutmp)
> +stub_warning (getutmpx)
> diff --git a/login/getutmpx.c b/login/getutmpx.c
> deleted file mode 100644
> index 5ec4baeaf5..0000000000
> --- a/login/getutmpx.c
> +++ /dev/null
> @@ -1,34 +0,0 @@
> -/* Copyright (C) 1999-2023 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public
> - License as published by the Free Software Foundation; either
> - version 2.1 of the License, or (at your option) any later version.
> -
> - The GNU C Library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; if not, see
> - <https://www.gnu.org/licenses/>. */
> -
> -#include <string.h>
> -#include <utmp.h>
> -#include <utmpx.h>
> -
> -/* Copy the information in UTMP to UTMPX. */
> -void
> -getutmpx (const struct utmp *utmp, struct utmpx *utmpx)
> -{
> - memset (utmpx, 0, sizeof (struct utmpx));
> - utmpx->ut_type = utmp->ut_type;
> - utmpx->ut_pid = utmp->ut_pid;
> - memcpy (utmpx->ut_line, utmp->ut_line, sizeof (utmp->ut_line));
> - memcpy (utmpx->ut_user, utmp->ut_user, sizeof (utmp->ut_user));
> - memcpy (utmpx->ut_id, utmp->ut_id, sizeof (utmp->ut_id));
> - memcpy (utmpx->ut_host, utmp->ut_host, sizeof (utmp->ut_host));
> - utmpx->ut_tv = utmp->ut_tv;
> -}
> diff --git a/login/getutxent.c b/login/getutxent.c
> deleted file mode 100644
> index b4298b5e28..0000000000
> --- a/login/getutxent.c
> +++ /dev/null
> @@ -1,25 +0,0 @@
> -/* Copyright (C) 1998-2023 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public
> - License as published by the Free Software Foundation; either
> - version 2.1 of the License, or (at your option) any later version.
> -
> - The GNU C Library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; if not, see
> - <https://www.gnu.org/licenses/>. */
> -
> -#include <utmp.h>
> -#include <utmpx.h>
> -
> -struct utmpx *
> -getutxent (void)
> -{
> - return (struct utmpx *) __getutent ();
> -}
> diff --git a/login/getutxid.c b/login/getutxid.c
> deleted file mode 100644
> index 1efcb0e08d..0000000000
> --- a/login/getutxid.c
> +++ /dev/null
> @@ -1,25 +0,0 @@
> -/* Copyright (C) 1998-2023 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public
> - License as published by the Free Software Foundation; either
> - version 2.1 of the License, or (at your option) any later version.
> -
> - The GNU C Library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; if not, see
> - <https://www.gnu.org/licenses/>. */
> -
> -#include <utmp.h>
> -#include <utmpx.h>
> -
> -struct utmpx *
> -getutxid (const struct utmpx *id)
> -{
> - return (struct utmpx *) __getutid ((const struct utmp *) id);
> -}
> diff --git a/login/getutxline.c b/login/getutxline.c
> deleted file mode 100644
> index c6af810691..0000000000
> --- a/login/getutxline.c
> +++ /dev/null
> @@ -1,25 +0,0 @@
> -/* Copyright (C) 1998-2023 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public
> - License as published by the Free Software Foundation; either
> - version 2.1 of the License, or (at your option) any later version.
> -
> - The GNU C Library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; if not, see
> - <https://www.gnu.org/licenses/>. */
> -
> -#include <utmp.h>
> -#include <utmpx.h>
> -
> -struct utmpx *
> -getutxline (const struct utmpx *line)
> -{
> - return (struct utmpx *) __getutline ((const struct utmp *) line);
> -}
> diff --git a/login/login.c b/login/login.c
> index fde50744c6..a02c9f9e29 100644
> --- a/login/login.c
> +++ b/login/login.c
> @@ -15,129 +15,15 @@
> License along with the GNU C Library; if not, see
> <https://www.gnu.org/licenses/>. */
>
> -#include <assert.h>
> -#include <errno.h>
> -#include <limits.h>
> -#include <string.h>
> -#include <unistd.h>
> -#include <stdlib.h>
> -#include <utmp.h>
> #include <shlib-compat.h>
> +#include <utmp.h>
>
> -/* Return the result of ttyname in the buffer pointed to by TTY, which should
> - be of length BUF_LEN. If it is too long to fit in this buffer, a
> - sufficiently long buffer is allocated using malloc, and returned in TTY.
> - 0 is returned upon success, -1 otherwise. */
> -static int
> -tty_name (int fd, char **tty, size_t buf_len)
> -{
> - int rv; /* Return value. 0 = success. */
> - char *buf = *tty; /* Buffer for ttyname, initially the user's. */
> -
> - for (;;)
> - {
> - char *new_buf;
> -
> - if (buf_len)
> - {
> - rv = __ttyname_r (fd, buf, buf_len);
> -
> - if (rv != 0 || memchr (buf, '\0', buf_len))
> - /* We either got an error, or we succeeded and the
> - returned name fit in the buffer. */
> - break;
> -
> - /* Try again with a longer buffer. */
> - buf_len += buf_len; /* Double it */
> - }
> - else
> - /* No initial buffer; start out by mallocing one. */
> - buf_len = 128; /* First time guess. */
> -
> - if (buf != *tty)
> - /* We've already malloced another buffer at least once. */
> - new_buf = realloc (buf, buf_len);
> - else
> - new_buf = malloc (buf_len);
> - if (! new_buf)
> - {
> - rv = -1;
> - __set_errno (ENOMEM);
> - break;
> - }
> - buf = new_buf;
> - }
> -
> - if (rv == 0)
> - *tty = buf; /* Return buffer to the user. */
> - else if (buf != *tty)
> - free (buf); /* Free what we malloced when returning an error. */
> -
> - return rv;
> -}
> -
> void
> __login (const struct utmp *ut)
> {
> -#ifdef PATH_MAX
> - char _tty[PATH_MAX + UT_LINESIZE];
> -#else
> - char _tty[512 + UT_LINESIZE];
> -#endif
> - char *tty = _tty;
> - int found_tty;
> - const char *ttyp;
> - struct utmp copy = *ut;
> -
> - /* Fill in those fields we supply. */
> - copy.ut_type = USER_PROCESS;
> - copy.ut_pid = getpid ();
> -
> - /* Seek tty. */
> - found_tty = tty_name (STDIN_FILENO, &tty, sizeof (_tty));
> - if (found_tty < 0)
> - found_tty = tty_name (STDOUT_FILENO, &tty, sizeof (_tty));
> - if (found_tty < 0)
> - found_tty = tty_name (STDERR_FILENO, &tty, sizeof (_tty));
> -
> - if (found_tty >= 0)
> - {
> - /* We only want to insert the name of the tty without path.
> - But take care of name like /dev/pts/3. */
> - if (strncmp (tty, "/dev/", 5) == 0)
> - ttyp = tty + 5; /* Skip the "/dev/". */
> - else
> - ttyp = basename (tty);
> -
> - /* Position to record for this tty. */
> - strncpy (copy.ut_line, ttyp, UT_LINESIZE);
> -
> - /* Tell that we want to use the UTMP file. */
> - if (__utmpname (_PATH_UTMP) == 0)
> - {
> - /* Open UTMP file. */
> - __setutent ();
> -
> - /* Write the entry. */
> - __pututline (©);
> -
> - /* Close UTMP file. */
> - __endutent ();
> - }
> -
> - if (tty != _tty)
> - free (tty); /* Free buffer malloced by tty_name. */
> - }
> - else
> - /* We provide a default value so that the output does not contain
> - an random bytes in this field. */
> - strncpy (copy.ut_line, "???", UT_LINESIZE);
> -
> - /* Update the WTMP file. Here we have to add a new entry. */
> - __updwtmp (_PATH_WTMP, ©);
> }
> versioned_symbol (libc, __login, login, GLIBC_2_34);
> -libc_hidden_ver (__login, login)
> +stub_warning (login)
>
> #if OTHER_SHLIB_COMPAT (libutil, GLIBC_2_0, GLIBC_2_34)
> compat_symbol (libutil, __login, login, GLIBC_2_0);
> diff --git a/login/logout.c b/login/logout.c
> index d2930278b1..147ed7875f 100644
> --- a/login/logout.c
> +++ b/login/logout.c
> @@ -16,53 +16,17 @@
> <https://www.gnu.org/licenses/>. */
>
> #include <errno.h>
> -#include <string.h>
> -#include <utmp.h>
> -#include <time.h>
> -#include <sys/time.h>
> #include <shlib-compat.h>
> +#include <utmp.h>
>
> int
> __logout (const char *line)
> {
> - struct utmp tmp, utbuf;
> - struct utmp *ut;
> - int result = 0;
> -
> - /* Tell that we want to use the UTMP file. */
> - if (__utmpname (_PATH_UTMP) == -1)
> - return 0;
> -
> - /* Open UTMP file. */
> - __setutent ();
> -
> - /* Fill in search information. */
> - tmp.ut_type = USER_PROCESS;
> - strncpy (tmp.ut_line, line, sizeof tmp.ut_line);
> -
> - /* Read the record. */
> - if (__getutline_r (&tmp, &utbuf, &ut) >= 0)
> - {
> - /* Clear information about who & from where. */
> - memset (ut->ut_name, '\0', sizeof ut->ut_name);
> - memset (ut->ut_host, '\0', sizeof ut->ut_host);
> -
> - struct __timespec64 ts;
> - __clock_gettime64 (CLOCK_REALTIME, &ts);
> - TIMESPEC_TO_TIMEVAL (&ut->ut_tv, &ts);
> - ut->ut_type = DEAD_PROCESS;
> -
> - if (__pututline (ut) != NULL)
> - result = 1;
> - }
> -
> - /* Close UTMP file. */
> - __endutent ();
> -
> - return result;
> + errno = ENOTSUP;
> + return -1;
> }
> versioned_symbol (libc, __logout, logout, GLIBC_2_34);
> -libc_hidden_ver (__logout, logout)
> +stub_warning (logout)
>
> #if OTHER_SHLIB_COMPAT (libutil, GLIBC_2_0, GLIBC_2_34)
> compat_symbol (libutil, __logout, logout, GLIBC_2_0);
> diff --git a/login/logwtmp.c b/login/logwtmp.c
> index e7be29d769..51ba651dd9 100644
> --- a/login/logwtmp.c
> +++ b/login/logwtmp.c
> @@ -15,35 +15,15 @@
> License along with the GNU C Library; if not, see
> <https://www.gnu.org/licenses/>. */
>
> -#include <string.h>
> -#include <sys/time.h>
> -#include <time.h>
> -#include <unistd.h>
> #include <utmp.h>
> -#include <struct___timespec64.h>
> #include <shlib-compat.h>
>
> void
> __logwtmp (const char *line, const char *name, const char *host)
> {
> - struct utmp ut;
> -
> - /* Set information in new entry. */
> - memset (&ut, 0, sizeof (ut));
> - ut.ut_pid = getpid ();
> - ut.ut_type = name[0] ? USER_PROCESS : DEAD_PROCESS;
> - strncpy (ut.ut_line, line, sizeof ut.ut_line);
> - strncpy (ut.ut_name, name, sizeof ut.ut_name);
> - strncpy (ut.ut_host, host, sizeof ut.ut_host);
> -
> - struct __timespec64 ts;
> - __clock_gettime64 (CLOCK_REALTIME, &ts);
> - TIMESPEC_TO_TIMEVAL (&ut.ut_tv, &ts);
> -
> - __updwtmp (_PATH_WTMP, &ut);
> }
> versioned_symbol (libc, __logwtmp, logwtmp, GLIBC_2_34);
> -libc_hidden_ver (__logwtmp, logwtmp)
> +stub_warning (logwtmp)
>
> #if OTHER_SHLIB_COMPAT (libutil, GLIBC_2_0, GLIBC_2_34)
> compat_symbol (libutil, __logwtmp, logwtmp, GLIBC_2_0);
> diff --git a/login/programs/utmpdump.c b/login/programs/utmpdump.c
> deleted file mode 100644
> index f85654b9d1..0000000000
> --- a/login/programs/utmpdump.c
> +++ /dev/null
> @@ -1,62 +0,0 @@
> -/* utmpdump - dump utmp-like files.
> - Copyright (C) 1997-2023 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public
> - License as published by the Free Software Foundation; either
> - version 2.1 of the License, or (at your option) any later version.
> -
> - The GNU C Library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; if not, see
> - <https://www.gnu.org/licenses/>. */
> -
> -#include <stdio.h>
> -#include <stdlib.h>
> -#include <time.h>
> -#include <unistd.h>
> -#include <utmp.h>
> -
> -static void
> -print_entry (struct utmp *up)
> -{
> - /* Mixed 32-/64-bit systems may have timeval structs of different sixe
> - but need struct utmp to be the same size. So in 64-bit up->ut_tv may
> - not be a timeval but a struct of __int32_t's. This would cause a compile
> - time warning and a formatting error when 32-bit int is passed where
> - a 64-bit long is expected. So copy up->up_tv to a temporary timeval.
> - This is 32-/64-bit agnostic and expands the timeval fields to the
> - expected size as needed. */
> - struct timeval temp_tv;
> - temp_tv.tv_sec = up->ut_tv.tv_sec;
> - temp_tv.tv_usec = up->ut_tv.tv_usec;
> -
> - printf ("[%d] [%05d] [%-4.4s] [%-8.8s] [%-12.12s] [%-16.16s] [%-15.15s]"
> - " [%ld]\n",
> - up->ut_type, up->ut_pid, up->ut_id, up->ut_user, up->ut_line,
> - up->ut_host, 4 + ctime (&temp_tv.tv_sec),
> - (long int) temp_tv.tv_usec);
> -}
> -
> -int
> -main (int argc, char *argv[])
> -{
> - struct utmp *up;
> -
> - if (argc > 1)
> - utmpname (argv[1]);
> -
> - setutent ();
> -
> - while ((up = getutent ()))
> - print_entry (up);
> -
> - endutent ();
> -
> - return EXIT_SUCCESS;
> -}
> diff --git a/login/pututxline.c b/login/pututxline.c
> deleted file mode 100644
> index 7165262242..0000000000
> --- a/login/pututxline.c
> +++ /dev/null
> @@ -1,25 +0,0 @@
> -/* Copyright (C) 1998-2023 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public
> - License as published by the Free Software Foundation; either
> - version 2.1 of the License, or (at your option) any later version.
> -
> - The GNU C Library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; if not, see
> - <https://www.gnu.org/licenses/>. */
> -
> -#include <utmp.h>
> -#include <utmpx.h>
> -
> -struct utmpx *
> -pututxline (const struct utmpx *utmpx)
> -{
> - return (struct utmpx *) __pututline ((const struct utmp *) utmpx);
> -}
> diff --git a/login/setutxent.c b/login/setutxent.c
> deleted file mode 100644
> index 4b7593f78f..0000000000
> --- a/login/setutxent.c
> +++ /dev/null
> @@ -1,25 +0,0 @@
> -/* Copyright (C) 1998-2023 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public
> - License as published by the Free Software Foundation; either
> - version 2.1 of the License, or (at your option) any later version.
> -
> - The GNU C Library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; if not, see
> - <https://www.gnu.org/licenses/>. */
> -
> -#include <utmp.h>
> -#include <utmpx.h>
> -
> -void
> -setutxent (void)
> -{
> - return __setutent ();
> -}
> diff --git a/login/tst-pututxline-cache.c b/login/tst-pututxline-cache.c
> deleted file mode 100644
> index da85c0c8fa..0000000000
> --- a/login/tst-pututxline-cache.c
> +++ /dev/null
> @@ -1,193 +0,0 @@
> -/* Test case for cache invalidation after concurrent write (bug 24882).
> - Copyright (C) 2019-2023 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public License as
> - published by the Free Software Foundation; either version 2.1 of the
> - License, or (at your option) any later version.
> -
> - The GNU C Library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; see the file COPYING.LIB. If
> - not, see <http://www.gnu.org/licenses/>. */
> -
> -/* This test writes an entry to the utmpx file, reads it (so that it
> - is cached) in process1, and overwrites the same entry in process2
> - with something that does not match the search criteria. At this
> - point, the cache of the first process is stale, and when process1
> - attempts to write a new record which would have gone to the same
> - place (as indicated by the cache), it needs to realize that it has
> - to pick a different slot because the old slot is now used for
> - something else. */
> -
> -#include <errno.h>
> -#include <stdlib.h>
> -#include <string.h>
> -#include <support/check.h>
> -#include <support/namespace.h>
> -#include <support/support.h>
> -#include <support/temp_file.h>
> -#include <support/xthread.h>
> -#include <support/xunistd.h>
> -#include <utmp.h>
> -#include <utmpx.h>
> -
> -/* Set to the path of the utmp file. */
> -static char *utmp_file;
> -
> -/* Used to synchronize the subprocesses. The barrier itself is
> - allocated in shared memory. */
> -static pthread_barrier_t *barrier;
> -
> -/* setutxent with error checking. */
> -static void
> -xsetutxent (void)
> -{
> - errno = 0;
> - setutxent ();
> - TEST_COMPARE (errno, 0);
> -}
> -
> -/* getutxent with error checking. */
> -static struct utmpx *
> -xgetutxent (void)
> -{
> - errno = 0;
> - struct utmpx *result = getutxent ();
> - if (result == NULL)
> - FAIL_EXIT1 ("getutxent: %m");
> - return result;
> -}
> -
> -static void
> -put_entry (const char *id, pid_t pid, const char *user, const char *line)
> -{
> - struct utmpx ut =
> - {
> - .ut_type = LOGIN_PROCESS,
> - .ut_pid = pid,
> - .ut_host = "localhost",
> - };
> - strcpy (ut.ut_id, id);
> - strncpy (ut.ut_user, user, sizeof (ut.ut_user));
> - strncpy (ut.ut_line, line, sizeof (ut.ut_line));
> - TEST_VERIFY (pututxline (&ut) != NULL);
> -}
> -
> -/* Use two cooperating subprocesses to avoid issues related to
> - unlock-on-close semantics of POSIX advisory locks. */
> -
> -static __attribute__ ((noreturn)) void
> -process1 (void)
> -{
> - TEST_COMPARE (utmpname (utmp_file), 0);
> -
> - /* Create an entry. */
> - xsetutxent ();
> - put_entry ("1", 101, "root", "process1");
> -
> - /* Retrieve the entry. This will fill the internal cache. */
> - {
> - errno = 0;
> - setutxent ();
> - TEST_COMPARE (errno, 0);
> - struct utmpx ut =
> - {
> - .ut_type = LOGIN_PROCESS,
> - .ut_line = "process1",
> - };
> - struct utmpx *result = getutxline (&ut);
> - if (result == NULL)
> - FAIL_EXIT1 ("getutxline (\"process1\"): %m");
> - TEST_COMPARE (result->ut_pid, 101);
> - }
> -
> - /* Signal the other process to overwrite the entry. */
> - xpthread_barrier_wait (barrier);
> -
> - /* Wait for the other process to complete the write operation. */
> - xpthread_barrier_wait (barrier);
> -
> - /* Add another entry. Note: This time, there is no setutxent call. */
> - put_entry ("1", 103, "root", "process1");
> -
> - _exit (0);
> -}
> -
> -static void
> -process2 (void *closure)
> -{
> - /* Wait for the first process to write its entry. */
> - xpthread_barrier_wait (barrier);
> -
> - /* Truncate the file. The glibc interface does not support
> - re-purposing records, but an external expiration mechanism may
> - trigger this. */
> - TEST_COMPARE (truncate64 (utmp_file, 0), 0);
> -
> - /* Write the replacement entry. */
> - TEST_COMPARE (utmpname (utmp_file), 0);
> - xsetutxent ();
> - put_entry ("2", 102, "user", "process2");
> -
> - /* Signal the other process that the entry has been replaced. */
> - xpthread_barrier_wait (barrier);
> -}
> -
> -static int
> -do_test (void)
> -{
> - xclose (create_temp_file ("tst-tumpx-cache-write-", &utmp_file));
> - {
> - pthread_barrierattr_t attr;
> - xpthread_barrierattr_init (&attr);
> - xpthread_barrierattr_setpshared (&attr, PTHREAD_SCOPE_PROCESS);
> - barrier = support_shared_allocate (sizeof (*barrier));
> - xpthread_barrier_init (barrier, &attr, 2);
> - }
> -
> - /* Run both subprocesses in parallel. */
> - {
> - pid_t pid1 = xfork ();
> - if (pid1 == 0)
> - process1 ();
> - support_isolate_in_subprocess (process2, NULL);
> - int status;
> - xwaitpid (pid1, &status, 0);
> - TEST_COMPARE (status, 0);
> - }
> -
> - /* Check that the utmpx database contains the expected records. */
> - {
> - TEST_COMPARE (utmpname (utmp_file), 0);
> - xsetutxent ();
> -
> - struct utmpx *ut = xgetutxent ();
> - TEST_COMPARE_STRING (ut->ut_id, "2");
> - TEST_COMPARE (ut->ut_pid, 102);
> - TEST_COMPARE_STRING (ut->ut_user, "user");
> - TEST_COMPARE_STRING (ut->ut_line, "process2");
> -
> - ut = xgetutxent ();
> - TEST_COMPARE_STRING (ut->ut_id, "1");
> - TEST_COMPARE (ut->ut_pid, 103);
> - TEST_COMPARE_STRING (ut->ut_user, "root");
> - TEST_COMPARE_STRING (ut->ut_line, "process1");
> -
> - if (getutxent () != NULL)
> - FAIL_EXIT1 ("additional utmpx entry");
> - }
> -
> - xpthread_barrier_destroy (barrier);
> - support_shared_free (barrier);
> - free (utmp_file);
> -
> - return 0;
> -}
> -
> -#include <support/test-driver.c>
> diff --git a/login/tst-pututxline-lockfail.c b/login/tst-pututxline-lockfail.c
> deleted file mode 100644
> index 214d110619..0000000000
> --- a/login/tst-pututxline-lockfail.c
> +++ /dev/null
> @@ -1,176 +0,0 @@
> -/* Test the lock upgrade path in tst-pututxline.
> - Copyright (C) 2019-2023 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public License as
> - published by the Free Software Foundation; either version 2.1 of the
> - License, or (at your option) any later version.
> -
> - The GNU C Library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; see the file COPYING.LIB. If
> - not, see <https://www.gnu.org/licenses/>. */
> -
> -/* pututxline upgrades the read lock on the file to a write lock.
> - This test verifies that if the lock upgrade fails, the utmp
> - subsystem remains in a consistent state, so that pututxline can be
> - called again. */
> -
> -#include <errno.h>
> -#include <fcntl.h>
> -#include <stdlib.h>
> -#include <support/check.h>
> -#include <support/namespace.h>
> -#include <support/support.h>
> -#include <support/temp_file.h>
> -#include <support/xthread.h>
> -#include <support/xunistd.h>
> -#include <unistd.h>
> -#include <utmp.h>
> -#include <utmpx.h>
> -
> -/* Path to the temporary utmp file. */
> -static char *path;
> -
> -/* Used to synchronize the subprocesses. The barrier itself is
> - allocated in shared memory. */
> -static pthread_barrier_t *barrier;
> -
> -/* Use pututxline to write an entry for PID. */
> -static struct utmpx *
> -write_entry (pid_t pid)
> -{
> - struct utmpx ut =
> - {
> - .ut_type = LOGIN_PROCESS,
> - .ut_id = "1",
> - .ut_user = "root",
> - .ut_pid = pid,
> - .ut_line = "entry",
> - .ut_host = "localhost",
> - };
> - return pututxline (&ut);
> -}
> -
> -/* Create the initial entry in a subprocess, so that the utmp
> - subsystem in the original process is not disturbed. */
> -static void
> -subprocess_create_entry (void *closure)
> -{
> - TEST_COMPARE (utmpname (path), 0);
> - TEST_VERIFY (write_entry (101) != NULL);
> -}
> -
> -/* Acquire an advisory read lock on PATH. */
> -__attribute__ ((noreturn)) static void
> -subprocess_lock_file (void)
> -{
> - int fd = xopen (path, O_RDONLY, 0);
> -
> - struct flock64 fl =
> - {
> - .l_type = F_RDLCK,
> - fl.l_whence = SEEK_SET,
> - };
> - TEST_COMPARE (fcntl64 (fd, F_SETLKW, &fl), 0);
> -
> - /* Signal to the main process that the lock has been acquired. */
> - xpthread_barrier_wait (barrier);
> -
> - /* Wait for the unlock request from the main process. */
> - xpthread_barrier_wait (barrier);
> -
> - /* Implicitly unlock the file. */
> - xclose (fd);
> -
> - /* Overwrite the existing entry. */
> - TEST_COMPARE (utmpname (path), 0);
> - errno = 0;
> - setutxent ();
> - TEST_COMPARE (errno, 0);
> - TEST_VERIFY (write_entry (102) != NULL);
> - errno = 0;
> - endutxent ();
> - TEST_COMPARE (errno, 0);
> -
> - _exit (0);
> -}
> -
> -static int
> -do_test (void)
> -{
> - xclose (create_temp_file ("tst-pututxline-lockfail-", &path));
> -
> - {
> - pthread_barrierattr_t attr;
> - xpthread_barrierattr_init (&attr);
> - xpthread_barrierattr_setpshared (&attr, PTHREAD_SCOPE_PROCESS);
> - barrier = support_shared_allocate (sizeof (*barrier));
> - xpthread_barrier_init (barrier, &attr, 2);
> - xpthread_barrierattr_destroy (&attr);
> - }
> -
> - /* Write the initial entry. */
> - support_isolate_in_subprocess (subprocess_create_entry, NULL);
> -
> - pid_t locker_pid = xfork ();
> - if (locker_pid == 0)
> - subprocess_lock_file ();
> -
> - /* Wait for the file locking to complete. */
> - xpthread_barrier_wait (barrier);
> -
> - /* Try to add another entry. This attempt will fail, with EINTR or
> - EAGAIN. */
> - TEST_COMPARE (utmpname (path), 0);
> - TEST_VERIFY (write_entry (102) == NULL);
> - if (errno != EINTR)
> - TEST_COMPARE (errno, EAGAIN);
> -
> - /* Signal the subprocess to overwrite the entry. */
> - xpthread_barrier_wait (barrier);
> -
> - /* Wait for write and unlock to complete. */
> - {
> - int status;
> - xwaitpid (locker_pid, &status, 0);
> - TEST_COMPARE (status, 0);
> - }
> -
> - /* The file is no longer locked, so this operation will succeed. */
> - TEST_VERIFY (write_entry (103) != NULL);
> - errno = 0;
> - endutxent ();
> - TEST_COMPARE (errno, 0);
> -
> - /* Check that there is just one entry with the expected contents.
> - If pututxline becomes desynchronized internally, the entry is not
> - overwritten (bug 24902). */
> - errno = 0;
> - setutxent ();
> - TEST_COMPARE (errno, 0);
> - struct utmpx *ut = getutxent ();
> - TEST_VERIFY_EXIT (ut != NULL);
> - TEST_COMPARE (ut->ut_type, LOGIN_PROCESS);
> - TEST_COMPARE_STRING (ut->ut_id, "1");
> - TEST_COMPARE_STRING (ut->ut_user, "root");
> - TEST_COMPARE (ut->ut_pid, 103);
> - TEST_COMPARE_STRING (ut->ut_line, "entry");
> - TEST_COMPARE_STRING (ut->ut_host, "localhost");
> - TEST_VERIFY (getutxent () == NULL);
> - errno = 0;
> - endutxent ();
> - TEST_COMPARE (errno, 0);
> -
> - xpthread_barrier_destroy (barrier);
> - support_shared_free (barrier);
> - free (path);
> - return 0;
> -}
> -
> -#include <support/test-driver.c>
> diff --git a/login/tst-updwtmpx.c b/login/tst-updwtmpx.c
> deleted file mode 100644
> index dee278c472..0000000000
> --- a/login/tst-updwtmpx.c
> +++ /dev/null
> @@ -1,112 +0,0 @@
> -/* Basic test coverage for updwtmpx.
> - Copyright (C) 2019-2023 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public License as
> - published by the Free Software Foundation; either version 2.1 of the
> - License, or (at your option) any later version.
> -
> - The GNU C Library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; see the file COPYING.LIB. If
> - not, see <https://www.gnu.org/licenses/>. */
> -
> -/* This program runs a series of tests. Each one calls updwtmpx
> - twice, to write two records, optionally with misalignment in the
> - file, and reads back the results. */
> -
> -#include <errno.h>
> -#include <stdlib.h>
> -#include <support/check.h>
> -#include <support/descriptors.h>
> -#include <support/support.h>
> -#include <support/temp_file.h>
> -#include <support/test-driver.h>
> -#include <support/xunistd.h>
> -#include <unistd.h>
> -#include <utmpx.h>
> -
> -static int
> -do_test (void)
> -{
> - /* Two entries filled with an arbitrary bit pattern. */
> - struct utmpx entries[2];
> - unsigned char pad;
> - {
> - unsigned char *p = (unsigned char *) &entries[0];
> - for (size_t i = 0; i < sizeof (entries); ++i)
> - {
> - p[i] = i;
> - }
> - /* Make sure that the first and second entry and the padding are
> - different. */
> - p[sizeof (struct utmpx)] = p[0] + 1;
> - pad = p[0] + 2;
> - }
> -
> - char *path;
> - int fd = create_temp_file ("tst-updwtmpx-", &path);
> -
> - /* Used to check that updwtmpx does not leave an open file
> - descriptor around. */
> - struct support_descriptors *descriptors = support_descriptors_list ();
> -
> - /* updwtmpx is expected to remove misalignment. Optionally insert
> - one byte of misalignment at the start and in the middle (after
> - the first entry). */
> - for (int misaligned_start = 0; misaligned_start < 2; ++misaligned_start)
> - for (int misaligned_middle = 0; misaligned_middle < 2; ++misaligned_middle)
> - {
> - if (test_verbose > 0)
> - printf ("info: misaligned_start=%d misaligned_middle=%d\n",
> - misaligned_start, misaligned_middle);
> -
> - xftruncate (fd, 0);
> - TEST_COMPARE (pwrite64 (fd, &pad, misaligned_start, 0),
> - misaligned_start);
> -
> - /* Write first entry and check it. */
> - errno = 0;
> - updwtmpx (path, &entries[0]);
> - TEST_COMPARE (errno, 0);
> - support_descriptors_check (descriptors);
> - TEST_COMPARE (xlseek (fd, 0, SEEK_END), sizeof (struct utmpx));
> - struct utmpx buffer;
> - TEST_COMPARE (pread64 (fd, &buffer, sizeof (buffer), 0),
> - sizeof (buffer));
> - TEST_COMPARE_BLOB (&entries[0], sizeof (entries[0]),
> - &buffer, sizeof (buffer));
> -
> - /* Middle mis-alignmet. */
> - TEST_COMPARE (pwrite64 (fd, &pad, misaligned_middle,
> - sizeof (struct utmpx)), misaligned_middle);
> -
> - /* Write second entry and check both entries. */
> - errno = 0;
> - updwtmpx (path, &entries[1]);
> - TEST_COMPARE (errno, 0);
> - support_descriptors_check (descriptors);
> - TEST_COMPARE (xlseek (fd, 0, SEEK_END), 2 * sizeof (struct utmpx));
> - TEST_COMPARE (pread64 (fd, &buffer, sizeof (buffer), 0),
> - sizeof (buffer));
> - TEST_COMPARE_BLOB (&entries[0], sizeof (entries[0]),
> - &buffer, sizeof (buffer));
> - TEST_COMPARE (pread64 (fd, &buffer, sizeof (buffer), sizeof (buffer)),
> - sizeof (buffer));
> - TEST_COMPARE_BLOB (&entries[1], sizeof (entries[1]),
> - &buffer, sizeof (buffer));
> - }
> -
> - support_descriptors_free (descriptors);
> - free (path);
> - xclose (fd);
> -
> - return 0;
> -}
> -
> -#include <support/test-driver.c>
> diff --git a/login/tst-utmp.c b/login/tst-utmp.c
> deleted file mode 100644
> index 901b25c89c..0000000000
> --- a/login/tst-utmp.c
> +++ /dev/null
> @@ -1,377 +0,0 @@
> -/* Tests for UTMP functions.
> - Copyright (C) 1998-2023 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public
> - License as published by the Free Software Foundation; either
> - version 2.1 of the License, or (at your option) any later version.
> -
> - The GNU C Library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; if not, see
> - <https://www.gnu.org/licenses/>. */
> -
> -#include <errno.h>
> -#include <error.h>
> -#include <stdlib.h>
> -#include <string.h>
> -#include <sys/types.h>
> -#include <time.h>
> -
> -#ifdef UTMPX
> -# include <utmpx.h>
> -# define utmp utmpx
> -# define utmpname utmpxname
> -# define setutent setutxent
> -# define getutent getutxent
> -# define endutent endutxent
> -# define getutline getutxline
> -# define getutid getutxid
> -# define pututline pututxline
> -#else
> -# include <utmp.h>
> -#endif
> -
> -
> -/* Prototype for our test function. */
> -static int do_test (int argc, char *argv[]);
> -
> -/* We have a preparation function. */
> -static void do_prepare (int argc, char *argv[]);
> -#define PREPARE do_prepare
> -
> -/* This defines the `main' function and some more. */
> -#include <test-skeleton.c>
> -
> -
> -/* These are for the temporary file we generate. */
> -char *name;
> -int fd;
> -
> -static void
> -do_prepare (int argc, char *argv[])
> -{
> - size_t name_len;
> -
> - name_len = strlen (test_dir);
> - name = xmalloc (name_len + sizeof ("/utmpXXXXXX"));
> - mempcpy (mempcpy (name, test_dir, name_len),
> - "/utmpXXXXXX", sizeof ("/utmpXXXXXX"));
> -
> - /* Open our test file. */
> - fd = mkstemp (name);
> - if (fd == -1)
> - error (EXIT_FAILURE, errno, "cannot open test file `%s'", name);
> - add_temp_file (name);
> -}
> -
> -struct utmp entry[] =
> -{
> -#define UT(a) .ut_tv = { .tv_sec = (a)}
> -
> - { .ut_type = BOOT_TIME, .ut_pid = 1, UT(1000) },
> - { .ut_type = RUN_LVL, .ut_pid = 1, UT(2000) },
> - { .ut_type = INIT_PROCESS, .ut_pid = 5, .ut_id = "si", UT(3000) },
> - { .ut_type = LOGIN_PROCESS, .ut_pid = 23, .ut_line = "tty1", .ut_id = "1",
> - .ut_user = "LOGIN", UT(4000) },
> - { .ut_type = USER_PROCESS, .ut_pid = 24, .ut_line = "tty2", .ut_id = "2",
> - .ut_user = "albert", UT(8000) },
> - { .ut_type = USER_PROCESS, .ut_pid = 196, .ut_line = "ttyp0", .ut_id = "p0",
> - .ut_user = "niels", UT(10000) },
> - { .ut_type = DEAD_PROCESS, .ut_line = "ttyp1", .ut_id = "p1", UT(16000) },
> - { .ut_type = EMPTY },
> - { .ut_type = EMPTY }
> -};
> -int num_entries = sizeof entry / sizeof (struct utmp);
> -
> -time_t entry_time = 20000;
> -pid_t entry_pid = 234;
> -
> -static int
> -do_init (void)
> -{
> - int n;
> -
> - setutent ();
> -
> - for (n = 0; n < num_entries; n++)
> - {
> - if (pututline (&entry[n]) == NULL)
> - {
> - error (0, errno, "cannot write UTMP entry");
> - return 1;
> - }
> - }
> -
> - endutent ();
> -
> - return 0;
> -}
> -
> -
> -static int
> -do_check (void)
> -{
> - struct utmp *ut;
> - int n;
> -
> - setutent ();
> -
> - n = 0;
> - while ((ut = getutent ()))
> - {
> - if (n < num_entries
> - && memcmp (ut, &entry[n], sizeof (struct utmp)))
> - {
> - error (0, 0, "UTMP entry does not match");
> - return 1;
> - }
> -
> - n++;
> - }
> -
> - if (n != num_entries)
> - {
> - error (0, 0, "number of UTMP entries is incorrect");
> - return 1;
> - }
> -
> - endutent ();
> -
> - return 0;
> -}
> -
> -static int
> -simulate_login (const char *line, const char *user)
> -{
> - int n;
> -
> - for (n = 0; n < num_entries; n++)
> - {
> - if (strcmp (line, entry[n].ut_line) == 0
> - || entry[n].ut_type == DEAD_PROCESS)
> - {
> - if (entry[n].ut_pid == DEAD_PROCESS)
> - entry[n].ut_pid = (entry_pid += 27);
> - entry[n].ut_type = USER_PROCESS;
> - strncpy (entry[n].ut_user, user, sizeof (entry[n].ut_user));
> - entry[n].ut_tv.tv_sec = (entry_time += 1000);
> - setutent ();
> -
> - if (pututline (&entry[n]) == NULL)
> - {
> - error (0, errno, "cannot write UTMP entry");
> - return 1;
> - }
> -
> - endutent ();
> -
> - return 0;
> - }
> - }
> -
> - error (0, 0, "no entries available");
> - return 1;
> -}
> -
> -static int
> -simulate_logout (const char *line)
> -{
> - int n;
> -
> - for (n = 0; n < num_entries; n++)
> - {
> - if (strcmp (line, entry[n].ut_line) == 0)
> - {
> - entry[n].ut_type = DEAD_PROCESS;
> - strncpy (entry[n].ut_user, "", sizeof (entry[n].ut_user));
> - entry[n].ut_tv.tv_sec = (entry_time += 1000);
> - setutent ();
> -
> - if (pututline (&entry[n]) == NULL)
> - {
> - error (0, errno, "cannot write UTMP entry");
> - return 1;
> - }
> -
> - endutent ();
> -
> - return 0;
> - }
> - }
> -
> - error (0, 0, "no entry found for `%s'", line);
> - return 1;
> -}
> -
> -static int
> -check_login (const char *line)
> -{
> - struct utmp *up;
> - struct utmp ut;
> - int n;
> -
> - setutent ();
> -
> - strcpy (ut.ut_line, line);
> - up = getutline (&ut);
> - if (up == NULL)
> - {
> - error (0, errno, "cannot get entry for line `%s'", line);
> - return 1;
> - }
> -
> - endutent ();
> -
> - for (n = 0; n < num_entries; n++)
> - {
> - if (strcmp (line, entry[n].ut_line) == 0)
> - {
> - if (memcmp (up, &entry[n], sizeof (struct utmp)))
> - {
> - error (0, 0, "UTMP entry does not match");
> - return 1;
> - }
> -
> - return 0;
> - }
> - }
> -
> - error (0, 0, "bogus entry for line `%s'", line);
> - return 1;
> -}
> -
> -static int
> -check_logout (const char *line)
> -{
> - struct utmp ut;
> -
> - setutent ();
> -
> - strcpy (ut.ut_line, line);
> - if (getutline (&ut) != NULL)
> - {
> - error (0, 0, "bogus login entry for `%s'", line);
> - return 1;
> - }
> -
> - endutent ();
> -
> - return 0;
> -}
> -
> -static int
> -check_id (const char *id)
> -{
> - struct utmp *up;
> - struct utmp ut;
> - int n;
> -
> - setutent ();
> -
> - ut.ut_type = USER_PROCESS;
> - strcpy (ut.ut_id, id);
> - up = getutid (&ut);
> - if (up == NULL)
> - {
> - error (0, errno, "cannot get entry for ID `%s'", id);
> - return 1;
> - }
> -
> - endutent ();
> -
> - for (n = 0; n < num_entries; n++)
> - {
> - if (strcmp (id, entry[n].ut_id) == 0)
> - {
> - if (memcmp (up, &entry[n], sizeof (struct utmp)))
> - {
> - error (0, 0, "UTMP entry does not match");
> - return 1;
> - }
> -
> - return 0;
> - }
> - }
> -
> - error (0, 0, "bogus entry for ID `%s'", id);
> - return 1;
> -}
> -
> -static int
> -check_type (int type)
> -{
> - struct utmp *up;
> - struct utmp ut;
> - int n;
> -
> - setutent ();
> -
> - ut.ut_type = type;
> - up = getutid (&ut);
> - if (up == NULL)
> - {
> - error (0, errno, "cannot get entry for type `%d'", type);
> - return 1;
> - }
> -
> - endutent ();
> -
> - for (n = 0; n < num_entries; n++)
> - {
> - if (type == entry[n].ut_type)
> - {
> - if (memcmp (up, &entry[n], sizeof (struct utmp)))
> - {
> - error (0, 0, "UTMP entry does not match");
> - return 1;
> - }
> -
> - return 0;
> - }
> - }
> -
> - error (0, 0, "bogus entry for type `%d'", type);
> - return 1;
> -}
> -
> -static int
> -do_test (int argc, char *argv[])
> -{
> - int result = 0;
> -
> - utmpname (name);
> -
> - result |= do_init ();
> - result |= do_check ();
> -
> - result |= simulate_login ("tty1", "erwin");
> - result |= do_check ();
> -
> - result |= simulate_login ("ttyp1", "paul");
> - result |= do_check ();
> -
> - result |= simulate_logout ("tty2");
> - result |= do_check ();
> -
> - result |= simulate_logout ("ttyp0");
> - result |= do_check ();
> -
> - result |= simulate_login ("ttyp2", "richard");
> - result |= do_check ();
> -
> - result |= check_login ("tty1");
> - result |= check_logout ("ttyp0");
> - result |= check_id ("p1");
> - result |= check_id ("2");
> - result |= check_id ("si");
> - result |= check_type (BOOT_TIME);
> - result |= check_type (RUN_LVL);
> -
> - return result;
> -}
> diff --git a/login/tst-utmpx.c b/login/tst-utmpx.c
> deleted file mode 100644
> index edb5551d71..0000000000
> --- a/login/tst-utmpx.c
> +++ /dev/null
> @@ -1,2 +0,0 @@
> -#define UTMPX
> -#include "tst-utmp.c"
> diff --git a/login/updwtmp.c b/login/updwtmp.c
> index 940dcc1b8b..0aaf5d127d 100644
> --- a/login/updwtmp.c
> +++ b/login/updwtmp.c
> @@ -17,18 +17,11 @@
>
> #include <utmp.h>
>
> -#include "utmp-private.h"
> -
> -#ifndef TRANSFORM_UTMP_FILE_NAME
> -# define TRANSFORM_UTMP_FILE_NAME(file_name) (file_name)
> -#endif
> -
> void
> __updwtmp (const char *wtmp_file, const struct utmp *utmp)
> {
> - const char *file_name = TRANSFORM_UTMP_FILE_NAME (wtmp_file);
> -
> - __libc_updwtmp (file_name, utmp);
> }
> -libc_hidden_def (__updwtmp)
> weak_alias (__updwtmp, updwtmp)
> +weak_alias (__updwtmp, updwtmpx)
> +stub_warning (updwtmp)
> +stub_warning (updwtmpx)
> diff --git a/login/updwtmpx.c b/login/updwtmpx.c
> deleted file mode 100644
> index 8ca792964e..0000000000
> --- a/login/updwtmpx.c
> +++ /dev/null
> @@ -1,25 +0,0 @@
> -/* Copyright (C) 1998-2023 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public
> - License as published by the Free Software Foundation; either
> - version 2.1 of the License, or (at your option) any later version.
> -
> - The GNU C Library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; if not, see
> - <https://www.gnu.org/licenses/>. */
> -
> -#include <utmp.h>
> -#include <utmpx.h>
> -
> -void
> -updwtmpx (const char *wtmpx_file, const struct utmpx *utmpx)
> -{
> - __updwtmp (wtmpx_file, (const struct utmp *) utmpx);
> -}
> diff --git a/login/utmp-private.h b/login/utmp-private.h
> deleted file mode 100644
> index 0893cf62e3..0000000000
> --- a/login/utmp-private.h
> +++ /dev/null
> @@ -1,44 +0,0 @@
> -/* Internal definitions and declarations for UTMP functions.
> - Copyright (C) 1996-2023 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public
> - License as published by the Free Software Foundation; either
> - version 2.1 of the License, or (at your option) any later version.
> -
> - The GNU C Library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; if not, see
> - <https://www.gnu.org/licenses/>. */
> -
> -#ifndef _UTMP_PRIVATE_H
> -#define _UTMP_PRIVATE_H 1
> -
> -#include <utmp.h>
> -#include <libc-lock.h>
> -
> -/* These functions check for initialization, but not perform any
> - locking. */
> -int __libc_setutent (void) attribute_hidden;
> -int __libc_getutent_r (struct utmp *, struct utmp **) attribute_hidden;
> -int __libc_getutid_r (const struct utmp *, struct utmp *, struct utmp **)
> - attribute_hidden;
> -int __libc_getutline_r (const struct utmp *, struct utmp *, struct utmp **)
> - attribute_hidden;
> -struct utmp *__libc_pututline (const struct utmp *) attribute_hidden;
> -void __libc_endutent (void) attribute_hidden;
> -int __libc_updwtmp (const char *, const struct utmp *) attribute_hidden;
> -
> -/* Current file name. */
> -extern const char *__libc_utmp_file_name attribute_hidden;
> -
> -/* Locks access to the global data. */
> -__libc_lock_define (extern, __libc_utmp_lock attribute_hidden)
> -
> -
> -#endif /* utmp-private.h */
> diff --git a/login/utmp_file.c b/login/utmp_file.c
> deleted file mode 100644
> index 7055041d5f..0000000000
> --- a/login/utmp_file.c
> +++ /dev/null
> @@ -1,506 +0,0 @@
> -/* Copyright (C) 1996-2023 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public
> - License as published by the Free Software Foundation; either
> - version 2.1 of the License, or (at your option) any later version.
> -
> - The GNU C Library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; if not, see
> - <https://www.gnu.org/licenses/>. */
> -
> -#include <assert.h>
> -#include <errno.h>
> -#include <fcntl.h>
> -#include <signal.h>
> -#include <stdbool.h>
> -#include <stdio.h>
> -#include <string.h>
> -#include <unistd.h>
> -#include <utmp.h>
> -#include <not-cancel.h>
> -#include <kernel-features.h>
> -#include <sigsetops.h>
> -#include <not-cancel.h>
> -
> -#include "utmp-private.h"
> -#include "utmp-equal.h"
> -
> -
> -/* Descriptor for the file and position. */
> -static int file_fd = -1;
> -static bool file_writable;
> -static off64_t file_offset;
> -
> -/* Cache for the last read entry. */
> -static struct utmp last_entry;
> -
> -/* Returns true if *ENTRY matches last_entry, based on
> - data->ut_type. */
> -static bool
> -matches_last_entry (const struct utmp *data)
> -{
> - if (file_offset <= 0)
> - /* Nothing has been read. last_entry is stale and cannot match. */
> - return false;
> -
> - if (data->ut_type == RUN_LVL
> - || data->ut_type == BOOT_TIME
> - || data->ut_type == OLD_TIME
> - || data->ut_type == NEW_TIME)
> - /* For some entry types, only a type match is required. */
> - return data->ut_type == last_entry.ut_type;
> - else
> - /* For the process-related entries, a full match is needed. */
> - return __utmp_equal (&last_entry, data);
> -}
> -
> -/* Locking timeout. */
> -#ifndef TIMEOUT
> -# define TIMEOUT 10
> -#endif
> -
> -/* Do-nothing handler for locking timeout. */
> -static void timeout_handler (int signum) {};
> -
> -
> -/* try_file_lock (LOCKING, FD, TYPE) returns true if the locking
> - operation failed and recovery needs to be performed.
> -
> - file_unlock (FD) removes the lock (which must have been
> - successfully acquired). */
> -
> -static bool
> -try_file_lock (int fd, int type)
> -{
> - /* Cancel any existing alarm. */
> - int old_timeout = alarm (0);
> -
> - /* Establish signal handler. */
> - struct sigaction old_action;
> - struct sigaction action;
> - action.sa_handler = timeout_handler;
> - __sigemptyset (&action.sa_mask);
> - action.sa_flags = 0;
> - __sigaction (SIGALRM, &action, &old_action);
> -
> - alarm (TIMEOUT);
> -
> - /* Try to get the lock. */
> - struct flock64 fl =
> - {
> - .l_type = type,
> - .l_whence = SEEK_SET,
> - };
> -
> - bool status = __fcntl64_nocancel (fd, F_SETLKW, &fl) < 0;
> - int saved_errno = errno;
> -
> - /* Reset the signal handler and alarm. We must reset the alarm
> - before resetting the handler so our alarm does not generate a
> - spurious SIGALRM seen by the user. However, we cannot just set
> - the user's old alarm before restoring the handler, because then
> - it's possible our handler could catch the user alarm's SIGARLM and
> - then the user would never see the signal he expected. */
> - alarm (0);
> - __sigaction (SIGALRM, &old_action, NULL);
> - if (old_timeout != 0)
> - alarm (old_timeout);
> -
> - __set_errno (saved_errno);
> - return status;
> -}
> -
> -static void
> -file_unlock (int fd)
> -{
> - struct flock64 fl =
> - {
> - .l_type = F_UNLCK,
> - };
> - __fcntl64_nocancel (fd, F_SETLKW, &fl);
> -}
> -
> -#ifndef TRANSFORM_UTMP_FILE_NAME
> -# define TRANSFORM_UTMP_FILE_NAME(file_name) (file_name)
> -#endif
> -
> -int
> -__libc_setutent (void)
> -{
> - if (file_fd < 0)
> - {
> - const char *file_name;
> -
> - file_name = TRANSFORM_UTMP_FILE_NAME (__libc_utmp_file_name);
> -
> - file_writable = false;
> - file_fd = __open_nocancel
> - (file_name, O_RDONLY | O_LARGEFILE | O_CLOEXEC);
> - if (file_fd == -1)
> - return 0;
> - }
> -
> - __lseek64 (file_fd, 0, SEEK_SET);
> - file_offset = 0;
> -
> - return 1;
> -}
> -
> -/* Perform initialization if necessary. */
> -static bool
> -maybe_setutent (void)
> -{
> - return file_fd >= 0 || __libc_setutent ();
> -}
> -
> -/* Reads the entry at file_offset, storing it in last_entry and
> - updating file_offset on success. Returns -1 for a read error, 0
> - for EOF, and 1 for a successful read. last_entry and file_offset
> - are only updated on a successful and complete read. */
> -static ssize_t
> -read_last_entry (void)
> -{
> - struct utmp buffer;
> - ssize_t nbytes = __pread64_nocancel (file_fd, &buffer, sizeof (buffer),
> - file_offset);
> - if (nbytes < 0)
> - return -1;
> - else if (nbytes != sizeof (buffer))
> - /* Assume EOF. */
> - return 0;
> - else
> - {
> - last_entry = buffer;
> - file_offset += sizeof (buffer);
> - return 1;
> - }
> -}
> -
> -int
> -__libc_getutent_r (struct utmp *buffer, struct utmp **result)
> -{
> - int saved_errno = errno;
> -
> - if (!maybe_setutent ())
> - {
> - /* Not available. */
> - *result = NULL;
> - return -1;
> - }
> -
> - if (try_file_lock (file_fd, F_RDLCK))
> - return -1;
> -
> - ssize_t nbytes = read_last_entry ();
> - file_unlock (file_fd);
> -
> - if (nbytes <= 0) /* Read error or EOF. */
> - {
> - if (nbytes == 0)
> - /* errno should be unchanged to indicate success. A premature
> - EOF is treated like an EOF (missing complete record at the
> - end). */
> - __set_errno (saved_errno);
> - *result = NULL;
> - return -1;
> - }
> -
> - memcpy (buffer, &last_entry, sizeof (struct utmp));
> - *result = buffer;
> -
> - return 0;
> -}
> -
> -
> -/* Search for *ID, updating last_entry and file_offset. Return 0 on
> - success and -1 on failure. Does not perform locking; for that see
> - internal_getut_r below. */
> -static int
> -internal_getut_nolock (const struct utmp *id)
> -{
> - while (1)
> - {
> - ssize_t nbytes = read_last_entry ();
> - if (nbytes < 0)
> - return -1;
> - if (nbytes == 0)
> - {
> - /* End of file reached. */
> - __set_errno (ESRCH);
> - return -1;
> - }
> -
> - if (matches_last_entry (id))
> - break;
> - }
> -
> - return 0;
> -}
> -
> -/* Search for *ID, updating last_entry and file_offset. Return 0 on
> - success and -1 on failure. If the locking operation failed, write
> - true to *LOCK_FAILED. */
> -static int
> -internal_getut_r (const struct utmp *id, bool *lock_failed)
> -{
> - if (try_file_lock (file_fd, F_RDLCK))
> - {
> - *lock_failed = true;
> - return -1;
> - }
> -
> - int result = internal_getut_nolock (id);
> - file_unlock (file_fd);
> - return result;
> -}
> -
> -/* For implementing this function we don't use the getutent_r function
> - because we can avoid the reposition on every new entry this way. */
> -int
> -__libc_getutid_r (const struct utmp *id, struct utmp *buffer,
> - struct utmp **result)
> -{
> - if (!maybe_setutent ())
> - {
> - *result = NULL;
> - return -1;
> - }
> -
> - /* We don't have to distinguish whether we can lock the file or
> - whether there is no entry. */
> - bool lock_failed = false;
> - if (internal_getut_r (id, &lock_failed) < 0)
> - {
> - *result = NULL;
> - return -1;
> - }
> -
> - memcpy (buffer, &last_entry, sizeof (struct utmp));
> - *result = buffer;
> -
> - return 0;
> -}
> -
> -/* For implementing this function we don't use the getutent_r function
> - because we can avoid the reposition on every new entry this way. */
> -int
> -__libc_getutline_r (const struct utmp *line, struct utmp *buffer,
> - struct utmp **result)
> -{
> - if (!maybe_setutent ())
> - {
> - *result = NULL;
> - return -1;
> - }
> -
> - if (try_file_lock (file_fd, F_RDLCK))
> - {
> - *result = NULL;
> - return -1;
> - }
> -
> - while (1)
> - {
> - ssize_t nbytes = read_last_entry ();
> - if (nbytes < 0)
> - {
> - file_unlock (file_fd);
> - *result = NULL;
> - return -1;
> - }
> - if (nbytes == 0)
> - {
> - /* End of file reached. */
> - file_unlock (file_fd);
> - __set_errno (ESRCH);
> - *result = NULL;
> - return -1;
> - }
> -
> - /* Stop if we found a user or login entry. */
> - if ((last_entry.ut_type == USER_PROCESS
> - || last_entry.ut_type == LOGIN_PROCESS)
> - && (strncmp (line->ut_line, last_entry.ut_line, sizeof line->ut_line)
> - == 0))
> - break;
> - }
> -
> - file_unlock (file_fd);
> - memcpy (buffer, &last_entry, sizeof (struct utmp));
> - *result = buffer;
> -
> - return 0;
> -}
> -
> -
> -struct utmp *
> -__libc_pututline (const struct utmp *data)
> -{
> - if (!maybe_setutent ())
> - return NULL;
> -
> - struct utmp *pbuf;
> -
> - if (! file_writable)
> - {
> - /* We must make the file descriptor writable before going on. */
> - const char *file_name = TRANSFORM_UTMP_FILE_NAME (__libc_utmp_file_name);
> -
> - int new_fd = __open_nocancel
> - (file_name, O_RDWR | O_LARGEFILE | O_CLOEXEC);
> - if (new_fd == -1)
> - return NULL;
> -
> - if (__dup2 (new_fd, file_fd) < 0)
> - {
> - __close_nocancel_nostatus (new_fd);
> - return NULL;
> - }
> - __close_nocancel_nostatus (new_fd);
> - file_writable = true;
> - }
> -
> - /* Exclude other writers before validating the cache. */
> - if (try_file_lock (file_fd, F_WRLCK))
> - return NULL;
> -
> - /* Find the correct place to insert the data. */
> - bool found = false;
> - if (matches_last_entry (data))
> - {
> - /* Read back the entry under the write lock. */
> - file_offset -= sizeof (last_entry);
> - ssize_t nbytes = read_last_entry ();
> - if (nbytes < 0)
> - {
> - file_unlock (file_fd);
> - return NULL;
> - }
> -
> - if (nbytes == 0)
> - /* End of file reached. */
> - found = false;
> - else
> - found = matches_last_entry (data);
> - }
> -
> - if (!found)
> - /* Search forward for the entry. */
> - found = internal_getut_nolock (data) >= 0;
> -
> - off64_t write_offset;
> - if (!found)
> - {
> - /* We append the next entry. */
> - write_offset = __lseek64 (file_fd, 0, SEEK_END);
> -
> - /* Round down to the next multiple of the entry size. This
> - ensures any partially-written record is overwritten by the
> - new record. */
> - write_offset = (write_offset / sizeof (struct utmp)
> - * sizeof (struct utmp));
> - }
> - else
> - /* Overwrite last_entry. */
> - write_offset = file_offset - sizeof (struct utmp);
> -
> - /* Write the new data. */
> - ssize_t nbytes;
> - if (__lseek64 (file_fd, write_offset, SEEK_SET) < 0
> - || (nbytes = __write_nocancel (file_fd, data, sizeof (struct utmp))) < 0)
> - {
> - /* There is no need to recover the file position because all
> - reads use pread64, and any future write is preceded by
> - another seek. */
> - file_unlock (file_fd);
> - return NULL;
> - }
> -
> - if (nbytes != sizeof (struct utmp))
> - {
> - /* If we appended a new record this is only partially written.
> - Remove it. */
> - if (!found)
> - (void) __ftruncate64 (file_fd, write_offset);
> - file_unlock (file_fd);
> - /* Assume that the write failure was due to missing disk
> - space. */
> - __set_errno (ENOSPC);
> - return NULL;
> - }
> -
> - file_unlock (file_fd);
> - file_offset = write_offset + sizeof (struct utmp);
> - pbuf = (struct utmp *) data;
> -
> - return pbuf;
> -}
> -
> -
> -void
> -__libc_endutent (void)
> -{
> - if (file_fd >= 0)
> - {
> - __close_nocancel_nostatus (file_fd);
> - file_fd = -1;
> - }
> -}
> -
> -
> -int
> -__libc_updwtmp (const char *file, const struct utmp *utmp)
> -{
> - int result = -1;
> - off64_t offset;
> - int fd;
> -
> - /* Open WTMP file. */
> - fd = __open_nocancel (file, O_WRONLY | O_LARGEFILE | O_CLOEXEC);
> - if (fd < 0)
> - return -1;
> -
> - if (try_file_lock (fd, F_WRLCK))
> - {
> - __close_nocancel_nostatus (fd);
> - return -1;
> - }
> -
> - /* Remember original size of log file. */
> - offset = __lseek64 (fd, 0, SEEK_END);
> - if (offset % sizeof (struct utmp) != 0)
> - {
> - offset -= offset % sizeof (struct utmp);
> - __ftruncate64 (fd, offset);
> -
> - if (__lseek64 (fd, 0, SEEK_END) < 0)
> - goto unlock_return;
> - }
> -
> - /* Write the entry. If we can't write all the bytes, reset the file
> - size back to the original size. That way, no partial entries
> - will remain. */
> - if (__write_nocancel (fd, utmp, sizeof (struct utmp))
> - != sizeof (struct utmp))
> - {
> - __ftruncate64 (fd, offset);
> - goto unlock_return;
> - }
> -
> - result = 0;
> -
> -unlock_return:
> - file_unlock (fd);
> -
> - /* Close WTMP file. */
> - __close_nocancel_nostatus (fd);
> -
> - return result;
> -}
> diff --git a/login/utmpname.c b/login/utmpname.c
> index 99484b8f92..4c384d883e 100644
> --- a/login/utmpname.c
> +++ b/login/utmpname.c
> @@ -15,61 +15,16 @@
> License along with the GNU C Library; if not, see
> <https://www.gnu.org/licenses/>. */
>
> -#include <libc-lock.h>
> -#include <stdlib.h>
> -#include <string.h>
> +#include <errno.h>
> #include <utmp.h>
>
> -#include "utmp-private.h"
> -
> -
> -/* This is the default name. */
> -static const char default_file_name[] = _PATH_UTMP;
> -
> -/* Current file name. */
> -const char *__libc_utmp_file_name = (const char *) default_file_name;
> -
> -/* We have to use the lock in getutent_r.c. */
> -__libc_lock_define (extern, __libc_utmp_lock attribute_hidden)
> -
> -
> int
> __utmpname (const char *file)
> {
> - int result = -1;
> -
> - __libc_lock_lock (__libc_utmp_lock);
> -
> - /* Close the old file. */
> - __libc_endutent ();
> -
> - if (strcmp (file, __libc_utmp_file_name) != 0)
> - {
> - if (strcmp (file, default_file_name) == 0)
> - {
> - free ((char *) __libc_utmp_file_name);
> -
> - __libc_utmp_file_name = default_file_name;
> - }
> - else
> - {
> - char *file_name = __strdup (file);
> - if (file_name == NULL)
> - /* Out of memory. */
> - goto done;
> -
> - if (__libc_utmp_file_name != default_file_name)
> - free ((char *) __libc_utmp_file_name);
> -
> - __libc_utmp_file_name = file_name;
> - }
> - }
> -
> - result = 0;
> -
> -done:
> - __libc_lock_unlock (__libc_utmp_lock);
> - return result;
> + errno = ENOTSUP;
> + return -1;
> }
> -libc_hidden_def (__utmpname)
> weak_alias (__utmpname, utmpname)
> +weak_alias (__utmpname, utmpxname)
> +stub_warning (utmpname)
> +stub_warning (utmpxname)
> diff --git a/login/utmpxname.c b/login/utmpxname.c
> deleted file mode 100644
> index 500862a23b..0000000000
> --- a/login/utmpxname.c
> +++ /dev/null
> @@ -1,25 +0,0 @@
> -/* Copyright (C) 1998-2023 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public
> - License as published by the Free Software Foundation; either
> - version 2.1 of the License, or (at your option) any later version.
> -
> - The GNU C Library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; if not, see
> - <https://www.gnu.org/licenses/>. */
> -
> -#include <utmp.h>
> -#include <utmpx.h>
> -
> -int
> -utmpxname (const char *file)
> -{
> - return __utmpname (file);
> -}
> diff --git a/malloc/set-freeres.c b/malloc/set-freeres.c
> index 41ef9c2dd6..7307cb3afe 100644
> --- a/malloc/set-freeres.c
> +++ b/malloc/set-freeres.c
> @@ -75,9 +75,6 @@
> # pragma weak __libc_fgetspent_freemem_ptr
> # pragma weak __libc_tzfile_freemem_ptr
> # pragma weak __libc_getnameinfo_freemem_ptr
> -# pragma weak __libc_getutent_freemem_ptr
> -# pragma weak __libc_getutid_freemem_ptr
> -# pragma weak __libc_getutline_freemem_ptr
> # pragma weak __libc_reg_printf_freemem_ptr
> # pragma weak __libc_reg_type_freemem_ptr
> # pragma weak __libc_getgrgid_freemem_ptr
> @@ -201,9 +198,6 @@ __libc_freeres (void)
> call_free_static_weak (__libc_fgetspent_freemem_ptr);
> call_free_static_weak (__libc_tzfile_freemem_ptr);
> call_free_static_weak (__libc_getnameinfo_freemem_ptr);
> - call_free_static_weak (__libc_getutent_freemem_ptr);
> - call_free_static_weak (__libc_getutid_freemem_ptr);
> - call_free_static_weak (__libc_getutline_freemem_ptr);
> call_free_static_weak (__libc_reg_printf_freemem_ptr);
> call_free_static_weak (__libc_reg_type_freemem_ptr);
>
> diff --git a/manual/users.texi b/manual/users.texi
> index 4c83f12c42..b7874d8dba 100644
> --- a/manual/users.texi
> +++ b/manual/users.texi
> @@ -867,17 +867,6 @@ The @code{getlogin} function is declared in @file{unistd.h}, while
> @standards{POSIX.1, unistd.h}
> @safety{@prelim{}@mtunsafe{@mtasurace{:getlogin} @mtasurace{:utent} @mtascusig{:ALRM} @mtascutimer{} @mtslocale{}}@asunsafe{@ascudlopen{} @ascuplugin{} @ascuheap{} @asulock{}}@acunsafe{@acucorrupt{} @aculock{} @acsfd{} @acsmem{}}}
> @c getlogin (linux) @mtasurace:getlogin @mtasurace:utent @mtascusig:ALRM @mtascutimer @mtslocale @ascudlopen @ascuplugin @ascuheap @asulock @acucorrupt @aculock @acsfd @acsmem
> -@c getlogin_r_loginuid dup @mtslocale @ascudlopen @ascuplugin @ascuheap @asulock @acucorrupt @aculock @acsfd @acsmem
> -@c getlogin_fd0 (unix) @mtasurace:getlogin @mtasurace:utent @mtascusig:ALRM @mtascutimer @ascuheap @asulock @aculock @acsfd @acsmem
> -@c uses static buffer name => @mtasurace:getlogin
> -@c ttyname_r dup @ascuheap @acsmem @acsfd
> -@c strncpy dup ok
> -@c setutent dup @mtasurace:utent @asulock @aculock @acsfd
> -@c getutline_r dup @mtasurace:utent @mtascusig:ALRM @mtascutimer @asulock @aculock @acsfd
> -@c endutent dup @mtasurace:utent @asulock @aculock
> -@c libc_lock_unlock dup ok
> -@c strlen dup ok
> -@c memcpy dup ok
> @c
> @c getlogin_r (linux) @mtasurace:utent @mtascusig:ALRM @mtascutimer @mtslocale @ascudlopen @ascuplugin @ascuheap @asulock @acucorrupt @aculock @acsfd @acsmem
> @c getlogin_r_loginuid @mtslocale @ascudlopen @ascuplugin @ascuheap @asulock @acucorrupt @aculock @acsfd @acsmem
> @@ -956,11 +945,9 @@ ID of the user's login shell, etc., etc., but also stores information
> about the run level of the system, the time of the last system reboot,
> and possibly more.
>
> -The user accounting database typically lives in @file{/etc/utmp},
> -@file{/var/adm/utmp} or @file{/var/run/utmp}. However, these files
> -should @strong{never} be accessed directly. For reading information
> -from and writing information to the user accounting database, the
> -functions described in this section should be used.
> +The user accounting database functions provided by @theglibc{} are
> +meant only for XPG2 compliance, all of them either are no-op operation
> +or return an invalid return along @code{ENOTSUP}.
>
>
> @menu
> @@ -1103,356 +1090,70 @@ compatibility only, @file{utmp.h} defines @code{ut_time} as an alias for
>
> @deftypefun void setutent (void)
> @standards{SVID, utmp.h}
> -@safety{@prelim{}@mtunsafe{@mtasurace{:utent}}@asunsafe{@asulock{}}@acunsafe{@aculock{} @acsfd{}}}
> -@c Besides the static variables in utmp_file.c, there's the jump_table.
> -@c They're both modified while holding a lock, but other threads may
> -@c cause the variables to be modified between calling this function and
> -@c others that rely on the internal state it sets up.
> -
> -@c setutent @mtasurace:utent @asulock @aculock @acsfd
> -@c libc_lock_lock dup @asulock @aculock
> -@c __libc_setutent @mtasurace:utent @acsfd
> -@c setutent_unknown @mtasurace:utent @acsfd
> -@c *libc_utmp_file_functions.setutent = setutent_file @mtasurace:utent @acsfd
> -@c open_not_cancel_2 dup @acsfd
> -@c fcntl_not_cancel dup ok
> -@c close_not_cancel_no_status dup @acsfd
> -@c lseek64 dup ok
> -@c libc_lock_unlock dup ok
> -This function opens the user accounting database to begin scanning it.
> -You can then call @code{getutent}, @code{getutid} or @code{getutline} to
> -read entries and @code{pututline} to write entries.
> -
> -If the database is already open, it resets the input to the beginning of
> -the database.
> +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
> +This function is no-op.
> @end deftypefun
>
> @deftypefun {struct utmp *} getutent (void)
> @standards{SVID, utmp.h}
> -@safety{@prelim{}@mtunsafe{@mtuinit{} @mtasurace{:utent} @mtasurace{:utentbuf} @mtascusig{:ALRM} @mtascutimer{}}@asunsafe{@ascuheap{} @asulock{}}@acunsafe{@aculock{} @acsfd{} @acsmem{}}}
> -@c The static buffer that holds results is allocated with malloc at
> -@c the first call; the test is not thread-safe, so multiple concurrent
> -@c calls could malloc multiple buffers.
> -
> -@c getutent @mtuinit @mtasurace:utent @mtasurace:utentbuf @mtascusig:ALRM @mtascutimer @ascuheap @asulock @aculock @acsfd @acsmem
> -@c malloc @asulock @aculock @acsfd @acsmem
> -@c getutent_r dup @mtasurace:utent @mtascusig:ALRM @mtascutimer @asulock @aculock @acsfd
> -The @code{getutent} function reads the next entry from the user
> -accounting database. It returns a pointer to the entry, which is
> -statically allocated and may be overwritten by subsequent calls to
> -@code{getutent}. You must copy the contents of the structure if you
> -wish to save the information or you can use the @code{getutent_r}
> -function which stores the data in a user-provided buffer.
> -
> -A null pointer is returned in case no further entry is available.
> +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
> +This function is no-op, it always return a null pointer.
> @end deftypefun
>
> @deftypefun void endutent (void)
> @standards{SVID, utmp.h}
> -@safety{@prelim{}@mtunsafe{@mtasurace{:utent}}@asunsafe{@asulock{}}@acunsafe{@aculock{} @acsfd{}}}
> -@c endutent @mtasurace:utent @asulock @aculock @acsfd
> -@c libc_lock_lock dup @asulock @aculock
> -@c __libc_endutent @mtasurace:utent @acsfd
> -@c endutent_unknown ok
> -@c endutent_file @mtasurace:utent @acsfd
> -@c close_not_cancel_no_status dup @acsfd
> -@c libc_lock_unlock dup ok
> -This function closes the user accounting database.
> +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
> +This function is no-op.
> @end deftypefun
>
> @deftypefun {struct utmp *} getutid (const struct utmp *@var{id})
> @standards{SVID, utmp.h}
> -@safety{@prelim{}@mtunsafe{@mtuinit{} @mtasurace{:utent} @mtascusig{:ALRM} @mtascutimer{}}@asunsafe{@asulock{} @ascuheap{}}@acunsafe{@aculock{} @acsmem{} @acsfd{}}}
> -@c Same caveats as getutline.
> -@c
> -@c getutid @mtuinit @mtasurace:utent @mtascusig:ALRM @mtascutimer @ascuheap @asulock @aculock @acsmem @acsfd
> -@c uses a static buffer malloced on the first call
> -@c malloc dup @ascuheap @acsmem
> -@c getutid_r dup @mtasurace:utent @mtascusig:ALRM @mtascutimer @asulock @aculock @acsfd
> -This function searches forward from the current point in the database
> -for an entry that matches @var{id}. If the @code{ut_type} member of the
> -@var{id} structure is one of @code{RUN_LVL}, @code{BOOT_TIME},
> -@code{OLD_TIME} or @code{NEW_TIME} the entries match if the
> -@code{ut_type} members are identical. If the @code{ut_type} member of
> -the @var{id} structure is @code{INIT_PROCESS}, @code{LOGIN_PROCESS},
> -@code{USER_PROCESS} or @code{DEAD_PROCESS}, the entries match if the
> -@code{ut_type} member of the entry read from the database is one of
> -these four, and the @code{ut_id} members match. However if the
> -@code{ut_id} member of either the @var{id} structure or the entry read
> -from the database is empty it checks if the @code{ut_line} members match
> -instead. If a matching entry is found, @code{getutid} returns a pointer
> -to the entry, which is statically allocated, and may be overwritten by a
> -subsequent call to @code{getutent}, @code{getutid} or @code{getutline}.
> -You must copy the contents of the structure if you wish to save the
> -information.
> -
> -A null pointer is returned in case the end of the database is reached
> -without a match.
> -
> -The @code{getutid} function may cache the last read entry. Therefore,
> -if you are using @code{getutid} to search for multiple occurrences, it
> -is necessary to zero out the static data after each call. Otherwise
> -@code{getutid} could just return a pointer to the same entry over and
> -over again.
> +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
> +This function is no-op, it always return a null pointer.
> @end deftypefun
>
> @deftypefun {struct utmp *} getutline (const struct utmp *@var{line})
> @standards{SVID, utmp.h}
> -@safety{@prelim{}@mtunsafe{@mtuinit{} @mtasurace{:utent} @mtascusig{:ALRM} @mtascutimer{}}@asunsafe{@ascuheap{} @asulock{}}@acunsafe{@aculock{} @acsfd{} @acsmem{}}}
> -@c The static buffer that holds results is allocated with malloc at
> -@c the first call; the test is not thread-safe, so multiple concurrent
> -@c calls could malloc multiple buffers.
> -
> -@c getutline @mtuinit @mtasurace:utent @mtascusig:ALRM @mtascutimer @ascuheap @asulock @aculock @acsfd @acsmem
> -@c malloc @asulock @aculock @acsfd @acsmem
> -@c getutline_r dup @mtasurace:utent @mtascusig:ALRM @mtascutimer @asulock @aculock @acsfd
> -This function searches forward from the current point in the database
> -until it finds an entry whose @code{ut_type} value is
> -@code{LOGIN_PROCESS} or @code{USER_PROCESS}, and whose @code{ut_line}
> -member matches the @code{ut_line} member of the @var{line} structure.
> -If it finds such an entry, it returns a pointer to the entry which is
> -statically allocated, and may be overwritten by a subsequent call to
> -@code{getutent}, @code{getutid} or @code{getutline}. You must copy the
> -contents of the structure if you wish to save the information.
> -
> -A null pointer is returned in case the end of the database is reached
> -without a match.
> -
> -The @code{getutline} function may cache the last read entry. Therefore
> -if you are using @code{getutline} to search for multiple occurrences, it
> -is necessary to zero out the static data after each call. Otherwise
> -@code{getutline} could just return a pointer to the same entry over and
> -over again.
> +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
> +This function is no-op, it always return a null pointer.
> @end deftypefun
>
> @deftypefun {struct utmp *} pututline (const struct utmp *@var{utmp})
> @standards{SVID, utmp.h}
> -@safety{@prelim{}@mtunsafe{@mtasurace{:utent} @mtascusig{:ALRM} @mtascutimer{}}@asunsafe{@asulock{}}@acunsafe{@aculock{} @acsfd{}}}
> -@c pututline @mtasurace:utent @mtascusig:ALRM @mtascutimer @asulock @aculock @acsfd
> -@c libc_lock_lock dup @asulock @aculock
> -@c __libc_pututline @mtasurace:utent @mtascusig:ALRM @mtascutimer @acsfd
> -@c pututline_unknown @mtasurace:utent @acsfd
> -@c setutent_unknown dup @mtasurace:utent @acsfd
> -@c pututline_file @mtascusig:ALRM @mtascutimer @acsfd
> -@c TRANSFORM_UTMP_FILE_NAME ok
> -@c strcmp dup ok
> -@c acesss dup ok
> -@c open_not_cancel_2 dup @acsfd
> -@c fcntl_not_cancel dup ok
> -@c close_not_cancel_no_status dup @acsfd
> -@c llseek dup ok
> -@c dup2 dup ok
> -@c utmp_equal dup ok
> -@c internal_getut_r dup @mtascusig:ALRM @mtascutimer
> -@c LOCK_FILE dup @mtascusig:ALRM @mtasctimer
> -@c LOCKING_FAILED dup ok
> -@c ftruncate64 dup ok
> -@c write_not_cancel dup ok
> -@c UNLOCK_FILE dup @mtasctimer
> -@c libc_lock_unlock dup @aculock
> -The @code{pututline} function inserts the entry @code{*@var{utmp}} at
> -the appropriate place in the user accounting database. If it finds that
> -it is not already at the correct place in the database, it uses
> -@code{getutid} to search for the position to insert the entry, however
> -this will not modify the static structure returned by @code{getutent},
> -@code{getutid} and @code{getutline}. If this search fails, the entry
> -is appended to the database.
> -
> -The @code{pututline} function returns a pointer to a copy of the entry
> -inserted in the user accounting database, or a null pointer if the entry
> -could not be added. The following @code{errno} error conditions are
> -defined for this function:
> -
> -@table @code
> -@item EPERM
> -The process does not have the appropriate privileges; you cannot modify
> -the user accounting database.
> -@end table
> +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
> +This function is no-op, it always return a null pointer.
> @end deftypefun
>
> -All the @code{get*} functions mentioned before store the information
> -they return in a static buffer. This can be a problem in multi-threaded
> -programs since the data returned for the request is overwritten by the
> -return value data in another thread. Therefore @theglibc{}
> -provides as extensions three more functions which return the data in a
> -user-provided buffer.
> -
> @deftypefun int getutent_r (struct utmp *@var{buffer}, struct utmp **@var{result})
> @standards{GNU, utmp.h}
> -@safety{@prelim{}@mtunsafe{@mtasurace{:utent} @mtascusig{:ALRM} @mtascutimer{}}@asunsafe{@asulock{}}@acunsafe{@aculock{} @acsfd{}}}
> -@c getutent_r @mtasurace:utent @mtascusig:ALRM @mtascutimer @asulock @aculock @acsfd
> -@c libc_lock_lock dup @asulock @aculock
> -@c __libc_getutent_r @mtasurace:utent @mtascusig:ALRM @mtascutimer @acsfd
> -@c getutent_r_unknown @mtasurace:utent @acsfd
> -@c setutent_unknown dup @mtasurace:utent @acsfd
> -@c getutent_r_file @mtasurace:utent @mtascusig:ALRM @mtascutimer
> -@c LOCK_FILE @mtascusig:ALRM @mtascutimer
> -@c alarm dup @mtascutimer
> -@c sigemptyset dup ok
> -@c sigaction dup ok
> -@c memset dup ok
> -@c fcntl_not_cancel dup ok
> -@c LOCKING_FAILED ok
> -@c read_not_cancel dup ok
> -@c UNLOCK_FILE @mtascutimer
> -@c fcntl_not_cancel dup ok
> -@c alarm dup @mtascutimer
> -@c sigaction dup ok
> -@c memcpy dup ok
> -@c libc_lock_unlock dup ok
> -The @code{getutent_r} is equivalent to the @code{getutent} function. It
> -returns the next entry from the database. But instead of storing the
> -information in a static buffer it stores it in the buffer pointed to by
> -the parameter @var{buffer}.
> -
> -If the call was successful, the function returns @code{0} and the
> -pointer variable pointed to by the parameter @var{result} contains a
> -pointer to the buffer which contains the result (this is most probably
> -the same value as @var{buffer}). If something went wrong during the
> -execution of @code{getutent_r} the function returns @code{-1}.
> -
> -This function is a GNU extension.
> +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
> +This function is no-op, it always return @code{-1} with @code{errno} set to @code{ENOTSUP}.
> @end deftypefun
>
> @deftypefun int getutid_r (const struct utmp *@var{id}, struct utmp *@var{buffer}, struct utmp **@var{result})
> @standards{GNU, utmp.h}
> -@safety{@prelim{}@mtunsafe{@mtasurace{:utent} @mtascusig{:ALRM} @mtascutimer{}}@asunsafe{@asulock{}}@acunsafe{@aculock{} @acsfd{}}}
> -@c getutid_r @mtasurace:utent @mtascusig:ALRM @mtascutimer @asulock @aculock @acsfd
> -@c libc_lock_lock dup @asulock @aculock
> -@c __libc_getutid_r @mtasurace:utent @mtascusig:ALRM @mtascutimer @acsfd
> -@c getutid_r_unknown @mtasurace:utent @acsfd
> -@c setutent_unknown dup @mtasurace:utent @acsfd
> -@c getutid_r_file @mtascusig:ALRM @mtascutimer
> -@c internal_getut_r @mtascusig:ALRM @mtascutimer
> -@c LOCK_FILE dup @mtascusig:ALRM @mtascutimer
> -@c LOCKING_FAILED dup ok
> -@c read_not_cancel dup ok
> -@c utmp_equal ok
> -@c strncmp dup ok
> -@c UNLOCK_FILE dup @mtascutimer
> -@c memcpy dup ok
> -@c libc_lock_unlock dup @aculock
> -This function retrieves just like @code{getutid} the next entry matching
> -the information stored in @var{id}. But the result is stored in the
> -buffer pointed to by the parameter @var{buffer}.
> -
> -If successful the function returns @code{0} and the pointer variable
> -pointed to by the parameter @var{result} contains a pointer to the
> -buffer with the result (probably the same as @var{result}. If not
> -successful the function return @code{-1}.
> -
> -This function is a GNU extension.
> +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
> +This function is no-op, it always return @code{-1} with @code{errno} set to @code{ENOTSUP}.
> @end deftypefun
>
> @deftypefun int getutline_r (const struct utmp *@var{line}, struct utmp *@var{buffer}, struct utmp **@var{result})
> @standards{GNU, utmp.h}
> -@safety{@prelim{}@mtunsafe{@mtasurace{:utent} @mtascusig{:ALRM} @mtascutimer{}}@asunsafe{@asulock{}}@acunsafe{@aculock{} @acsfd{}}}
> -@c getutline_r @mtasurace:utent @mtascusig:ALRM @mtascutimer @asulock @aculock @acsfd
> -@c libc_lock_lock dup @asulock @aculock
> -@c __libc_getutline_r @mtasurace:utent @mtascusig:ALRM @mtascutimer @acsfd
> -@c getutline_r_unknown @mtasurace:utent @acsfd
> -@c setutent_unknown dup @mtasurace:utent @acsfd
> -@c getutline_r_file @mtasurace:utent @mtascusig:ALRM @mtascutimer
> -@c LOCK_FILE @mtascusig:ALRM @mtascutimer
> -@c alarm dup @mtascutimer
> -@c sigemptyset dup ok
> -@c sigaction dup ok
> -@c memset dup ok
> -@c fcntl_not_cancel dup ok
> -@c LOCKING_FAILED ok
> -@c read_not_cancel dup ok
> -@c strncmp dup ok
> -@c UNLOCK_FILE @mtascutimer
> -@c fcntl_not_cancel dup ok
> -@c alarm dup @mtascutimer
> -@c sigaction dup ok
> -@c memcpy dup ok
> -@c libc_lock_unlock dup ok
> -This function retrieves just like @code{getutline} the next entry
> -matching the information stored in @var{line}. But the result is stored
> -in the buffer pointed to by the parameter @var{buffer}.
> -
> -If successful the function returns @code{0} and the pointer variable
> -pointed to by the parameter @var{result} contains a pointer to the
> -buffer with the result (probably the same as @var{result}. If not
> -successful the function return @code{-1}.
> -
> -This function is a GNU extension.
> +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
> +This function is no-op, it always return @code{-1} with @code{errno} set to @code{ENOTSUP}.
> @end deftypefun
>
> -
> -In addition to the user accounting database, most systems keep a number
> -of similar databases. For example most systems keep a log file with all
> -previous logins (usually in @file{/etc/wtmp} or @file{/var/log/wtmp}).
> -
> -For specifying which database to examine, the following function should
> -be used.
> -
> @deftypefun int utmpname (const char *@var{file})
> @standards{SVID, utmp.h}
> -@safety{@prelim{}@mtunsafe{@mtasurace{:utent}}@asunsafe{@asulock{} @ascuheap{}}@acunsafe{@aculock{} @acsmem{}}}
> -@c utmpname @mtasurace:utent @asulock @ascuheap @aculock @acsmem
> -@c libc_lock_lock dup @asulock @aculock
> -@c __libc_endutent dup @mtasurace:utent
> -@c strcmp dup ok
> -@c free dup @ascuheap @acsmem
> -@c strdup dup @ascuheap @acsmem
> -@c libc_lock_unlock dup @aculock
> -The @code{utmpname} function changes the name of the database to be
> -examined to @var{file}, and closes any previously opened database. By
> -default @code{getutent}, @code{getutid}, @code{getutline} and
> -@code{pututline} read from and write to the user accounting database.
> -
> -The following macros are defined for use as the @var{file} argument:
> -
> -@deftypevr Macro {char *} _PATH_UTMP
> -This macro is used to specify the user accounting database.
> -@end deftypevr
> -
> -@deftypevr Macro {char *} _PATH_WTMP
> -This macro is used to specify the user accounting log file.
> -@end deftypevr
> -
> -The @code{utmpname} function returns a value of @code{0} if the new name
> -was successfully stored, and a value of @code{-1} to indicate an error.
> -Note that @code{utmpname} does not try to open the database, and that
> -therefore the return value does not say anything about whether the
> -database can be successfully opened.
> +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
> +This function is no-op, it always return @code{-1} with @code{errno} set to @code{ENOTSUP}.
> @end deftypefun
>
> -Specially for maintaining log-like databases @theglibc{} provides
> -the following function:
> -
> @deftypefun void updwtmp (const char *@var{wtmp_file}, const struct utmp *@var{utmp})
> @standards{SVID, utmp.h}
> -@safety{@prelim{}@mtunsafe{@mtascusig{:ALRM} @mtascutimer{}}@asunsafe{}@acunsafe{@acsfd{}}}
> -@c updwtmp @mtascusig:ALRM @mtascutimer @acsfd
> -@c TRANSFORM_UTMP_FILE_NAME dup ok
> -@c *libc_utmp_file_functions->updwtmp = updwtmp_file @mtascusig:ALRM @mtascutimer @acsfd
> -@c open_not_cancel_2 dup @acsfd
> -@c LOCK_FILE dup @mtascusig:ALRM @mtascutimer
> -@c LOCKING_FAILED dup ok
> -@c lseek64 dup ok
> -@c ftruncate64 dup ok
> -@c write_not_cancel dup ok
> -@c UNLOCK_FILE dup @mtascutimer
> -@c close_not_cancel_no_status dup @acsfd
> -The @code{updwtmp} function appends the entry *@var{utmp} to the
> -database specified by @var{wtmp_file}. For possible values for the
> -@var{wtmp_file} argument see the @code{utmpname} function.
> +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
> +This function is no-op.
> @end deftypefun
>
> -@strong{Portability Note:} Although many operating systems provide a
> -subset of these functions, they are not standardized. There are often
> -subtle differences in the return types, and there are considerable
> -differences between the various definitions of @code{struct utmp}. When
> -programming for @theglibc{}, it is probably best to stick
> -with the functions described in this section. If however, you want your
> -program to be portable, consider using the XPG functions described in
> -@ref{XPG Functions}, or take a look at the BSD compatible functions in
> -@ref{Logging In and Out}.
> -
> -
> @node XPG Functions
> @subsection XPG User Accounting Database Functions
>
> @@ -1540,14 +1241,14 @@ can be found using the @code{sizeof} operator.
>
> @deftypefun void setutxent (void)
> @standards{XPG4.2, utmpx.h}
> -@safety{@prelim{}@mtunsafe{@mtasurace{:utent}}@asunsafe{@asulock{}}@acunsafe{@aculock{} @acsfd{}}}
> +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
> This function is similar to @code{setutent}. In @theglibc{} it is
> simply an alias for @code{setutent}.
> @end deftypefun
>
> @deftypefun {struct utmpx *} getutxent (void)
> @standards{XPG4.2, utmpx.h}
> -@safety{@prelim{}@mtunsafe{@mtuinit{} @mtasurace{:utent} @mtascusig{:ALRM} @mtascutimer{}}@asunsafe{@ascuheap{} @asulock{}}@acunsafe{@aculock{} @acsfd{} @acsmem{}}}
> +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
> The @code{getutxent} function is similar to @code{getutent}, but returns
> a pointer to a @code{struct utmpx} instead of @code{struct utmp}. In
> @theglibc{} it simply is an alias for @code{getutent}.
> @@ -1555,14 +1256,14 @@ a pointer to a @code{struct utmpx} instead of @code{struct utmp}. In
>
> @deftypefun void endutxent (void)
> @standards{XPG4.2, utmpx.h}
> -@safety{@prelim{}@mtunsafe{@mtasurace{:utent}}@asunsafe{@asulock{}}@acunsafe{@aculock{}}}
> +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
> This function is similar to @code{endutent}. In @theglibc{} it is
> simply an alias for @code{endutent}.
> @end deftypefun
>
> @deftypefun {struct utmpx *} getutxid (const struct utmpx *@var{id})
> @standards{XPG4.2, utmpx.h}
> -@safety{@prelim{}@mtunsafe{@mtuinit{} @mtasurace{:utent} @mtascusig{:ALRM} @mtascutimer{}}@asunsafe{@asulock{} @ascuheap{}}@acunsafe{@aculock{} @acsmem{} @acsfd{}}}
> +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
> This function is similar to @code{getutid}, but uses @code{struct utmpx}
> instead of @code{struct utmp}. In @theglibc{} it is simply an alias
> for @code{getutid}.
> @@ -1570,7 +1271,7 @@ for @code{getutid}.
>
> @deftypefun {struct utmpx *} getutxline (const struct utmpx *@var{line})
> @standards{XPG4.2, utmpx.h}
> -@safety{@prelim{}@mtunsafe{@mtuinit{} @mtasurace{:utent} @mtascusig{:ALRM} @mtascutimer{}}@asunsafe{@ascuheap{} @asulock{}}@acunsafe{@aculock{} @acsfd{} @acsmem{}}}
> +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
> This function is similar to @code{getutid}, but uses @code{struct utmpx}
> instead of @code{struct utmp}. In @theglibc{} it is simply an alias
> for @code{getutline}.
> @@ -1578,7 +1279,7 @@ for @code{getutline}.
>
> @deftypefun {struct utmpx *} pututxline (const struct utmpx *@var{utmp})
> @standards{XPG4.2, utmpx.h}
> -@safety{@prelim{}@mtunsafe{@mtasurace{:utent} @mtascusig{:ALRM} @mtascutimer{}}@asunsafe{@asulock{}}@acunsafe{@aculock{} @acsfd{}}}
> +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
> The @code{pututxline} function is functionally identical to
> @code{pututline}, but uses @code{struct utmpx} instead of @code{struct
> utmp}. In @theglibc{}, @code{pututxline} is simply an alias for
> @@ -1587,31 +1288,24 @@ utmp}. In @theglibc{}, @code{pututxline} is simply an alias for
>
> @deftypefun int utmpxname (const char *@var{file})
> @standards{XPG4.2, utmpx.h}
> -@safety{@prelim{}@mtunsafe{@mtasurace{:utent}}@asunsafe{@asulock{} @ascuheap{}}@acunsafe{@aculock{} @acsmem{}}}
> +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
> The @code{utmpxname} function is functionally identical to
> @code{utmpname}. In @theglibc{}, @code{utmpxname} is simply an
> alias for @code{utmpname}.
> @end deftypefun
>
> -You can translate between a traditional @code{struct utmp} and an XPG
> -@code{struct utmpx} with the following functions. In @theglibc{},
> -these functions are merely copies, since the two structures are
> -identical.
> -
> -@deftypefun int getutmp (const struct utmpx *@var{utmpx}, struct utmp *@var{utmp})
> +@deftypefun void getutmp (const struct utmpx *@var{utmpx}, struct utmp *@var{utmp})
> @standards{GNU, utmp.h}
> @standards{GNU, utmpx.h}
> @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
> -@code{getutmp} copies the information, insofar as the structures are
> -compatible, from @var{utmpx} to @var{utmp}.
> +This function is no-op.
> @end deftypefun
>
> -@deftypefun int getutmpx (const struct utmp *@var{utmp}, struct utmpx *@var{utmpx})
> +@deftypefun void getutmpx (const struct utmp *@var{utmp}, struct utmpx *@var{utmpx})
> @standards{GNU, utmp.h}
> @standards{GNU, utmpx.h}
> @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
> -@code{getutmpx} copies the information, insofar as the structures are
> -compatible, from @var{utmp} to @var{utmpx}.
> +This function is no-op.
> @end deftypefun
>
>
> @@ -1619,7 +1313,7 @@ compatible, from @var{utmp} to @var{utmpx}.
> @subsection Logging In and Out
>
> These functions, derived from BSD, are available in the separate
> -@file{libutil} library, and declared in @file{utmp.h}.
> +@file{libutil} library (only for Hurd), and declared in @file{utmp.h}.
> @pindex utmp.h
>
> Note that the @code{ut_user} member of @code{struct utmp} is called
> @@ -1649,76 +1343,22 @@ on error.
>
> @deftypefun void login (const struct utmp *@var{entry})
> @standards{BSD, utmp.h}
> -@safety{@prelim{}@mtunsafe{@mtasurace{:utent} @mtascusig{:ALRM} @mtascutimer{}}@asunsafe{@asulock{} @ascuheap{}}@acunsafe{@aculock{} @acucorrupt{} @acsfd{} @acsmem{}}}
> -@c login @mtasurace:utent @mtascusig:ALRM @mtascutimer @asulock @ascuheap @aculock @acucorrupt @acsfd @acsmem
> -@c getpid dup ok
> -@c tty_name @ascuheap @acucorrupt @acsmem @acsfd
> -@c ttyname_r dup @ascuheap @acsmem @acsfd
> -@c memchr dup ok
> -@c realloc dup @ascuheap @acsmem
> -@c malloc dup @ascuheap @acsmem
> -@c free dup @ascuheap @acsmem
> -@c strncmp dup ok
> -@c basename dup ok
> -@c strncpy dup ok
> -@c utmpname dup @mtasurace:utent @asulock @ascuheap @aculock @acsmem
> -@c setutent dup @mtasurace:utent @asulock @aculock @acsfd
> -@c pututline dup @mtasurace:utent @mtascusig:ALRM @mtascutimer @asulock @aculock @acsfd
> -@c endutent dup @mtasurace:utent @asulock @aculock
> -@c free dup @ascuheap @acsmem
> -@c updwtmp dup @mtascusig:ALRM @mtascutimer @acsfd
> -The @code{login} functions inserts an entry into the user accounting
> -database. The @code{ut_line} member is set to the name of the terminal
> -on standard input. If standard input is not a terminal @code{login}
> -uses standard output or standard error output to determine the name of
> -the terminal. If @code{struct utmp} has a @code{ut_type} member,
> -@code{login} sets it to @code{USER_PROCESS}, and if there is an
> -@code{ut_pid} member, it will be set to the process ID of the current
> -process. The remaining entries are copied from @var{entry}.
> -
> -A copy of the entry is written to the user accounting log file.
> +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
> +This function is no-op.
> @end deftypefun
>
> @deftypefun int logout (const char *@var{ut_line})
> @standards{BSD, utmp.h}
> -@safety{@prelim{}@mtunsafe{@mtasurace{:utent} @mtascusig{:ALRM} @mtascutimer{}}@asunsafe{@asulock{} @ascuheap{}}@acunsafe{@aculock{} @acsfd{} @acsmem{}}}
> -@c logout @mtasurace:utent @mtascusig:ALRM @mtascutimer @asulock @ascuheap @aculock @acsfd @acsmem
> -@c utmpname dup @mtasurace:utent @asulock @ascuheap @aculock @acsmem
> -@c setutent dup @mtasurace:utent @asulock @aculock @acsfd
> -@c strncpy dup ok
> -@c getutline_r dup @mtasurace:utent @mtascusig:ALRM @mtascutimer @asulock @aculock @acsfd
> -@c bzero dup ok
> -@c gettimeofday dup ok
> -@c time dup ok
> -@c pututline dup @mtasurace:utent @mtascusig:ALRM @mtascutimer @asulock @aculock @acsfd
> -@c endutent dup @mtasurace:utent @asulock @aculock
> -This function modifies the user accounting database to indicate that the
> -user on @var{ut_line} has logged out.
> -
> -The @code{logout} function returns @code{1} if the entry was successfully
> -written to the database, or @code{0} on error.
> +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
> +This function is no-op, it always return @code{-1} with @code{errno} set to @code{ENOTSUP}.
> @end deftypefun
>
> @deftypefun void logwtmp (const char *@var{ut_line}, const char *@var{ut_name}, const char *@var{ut_host})
> @standards{BSD, utmp.h}
> -@safety{@prelim{}@mtunsafe{@mtascusig{:ALRM} @mtascutimer{}}@asunsafe{}@acunsafe{@acsfd{}}}
> -@c logwtmp @mtascusig:ALRM @mtascutimer @acsfd
> -@c memset dup ok
> -@c getpid dup ok
> -@c strncpy dup ok
> -@c gettimeofday dup ok
> -@c time dup ok
> -@c updwtmp dup @mtascusig:ALRM @mtascutimer @acsfd
> -The @code{logwtmp} function appends an entry to the user accounting log
> -file, for the current time and the information provided in the
> -@var{ut_line}, @var{ut_name} and @var{ut_host} arguments.
> +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
> +This function is no-op.
> @end deftypefun
>
> -@strong{Portability Note:} The BSD @code{struct utmp} only has the
> -@code{ut_line}, @code{ut_name}, @code{ut_host} and @code{ut_time}
> -members. Older systems do not even have the @code{ut_host} member.
> -
> -
> @node User Database
> @section User Database
> @cindex user database
> diff --git a/sysdeps/generic/paths.h b/sysdeps/generic/paths.h
> index 893b4c2286..a41fcf76f6 100644
> --- a/sysdeps/generic/paths.h
> +++ b/sysdeps/generic/paths.h
> @@ -60,10 +60,10 @@
> #define _PATH_SHELLS "/etc/shells"
> #define _PATH_TTY "/dev/tty"
> #define _PATH_UNIX "/vmunix"
> -#define _PATH_UTMP "/var/run/utmp"
> -#define _PATH_UTMP_DB "/var/run/utmp.db"
> +#define _PATH_UTMP "/dev/null/utmp"
> +#define _PATH_UTMP_DB "/dev/null/utmp.db"
> #define _PATH_VI "/usr/bin/vi"
> -#define _PATH_WTMP "/var/log/wtmp"
> +#define _PATH_WTMP "/dev/null/wtmp"
>
> /* Provide trailing slash, since mostly used for building pathnames. */
> #define _PATH_DEV "/dev/"
> diff --git a/sysdeps/gnu/Makefile b/sysdeps/gnu/Makefile
> index 1143abfc4b..c164b107ea 100644
> --- a/sysdeps/gnu/Makefile
> +++ b/sysdeps/gnu/Makefile
> @@ -16,19 +16,6 @@
> # <https://www.gnu.org/licenses/>.
>
> ifeq ($(subdir),login)
> -sysdep_routines += \
> - endutxent \
> - getutmp \
> - getutmpx \
> - getutxent \
> - getutxid \
> - getutxline \
> - pututxline \
> - setutxent \
> - updwtmpx \
> - utmpxname \
> - # sysdep_routines
> -
> sysdep_headers += \
> bits/utmpx.h \
> utmpx.h \
> diff --git a/sysdeps/gnu/getutmp.c b/sysdeps/gnu/getutmp.c
> deleted file mode 100644
> index ea88a489f3..0000000000
> --- a/sysdeps/gnu/getutmp.c
> +++ /dev/null
> @@ -1,34 +0,0 @@
> -/* Copyright (C) 1999-2023 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public
> - License as published by the Free Software Foundation; either
> - version 2.1 of the License, or (at your option) any later version.
> -
> - The GNU C Library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; if not, see
> - <https://www.gnu.org/licenses/>. */
> -
> -#include <assert.h>
> -#include <string.h>
> -#include <utmp.h>
> -#ifndef _UTMPX_H
> -/* This is an ugly hack but we must not see the getutmpx declaration. */
> -# define getutmpx XXXgetutmpx
> -# include <utmpx.h>
> -# undef getutmpx
> -#endif
> -
> -void
> -getutmp (const struct utmpx *utmpx, struct utmp *utmp)
> -{
> - assert (sizeof (struct utmp) == sizeof (struct utmpx));
> - memcpy (utmp, utmpx, sizeof (struct utmp));
> -}
> -strong_alias (getutmp, getutmpx)
> diff --git a/sysdeps/gnu/getutmpx.c b/sysdeps/gnu/getutmpx.c
> deleted file mode 100644
> index f393734a63..0000000000
> --- a/sysdeps/gnu/getutmpx.c
> +++ /dev/null
> @@ -1 +0,0 @@
> -/* We don't need a separate version. it is the same as getutmp(). */
> diff --git a/sysdeps/gnu/updwtmp.c b/sysdeps/gnu/updwtmp.c
> deleted file mode 100644
> index ab61eb40f0..0000000000
> --- a/sysdeps/gnu/updwtmp.c
> +++ /dev/null
> @@ -1,30 +0,0 @@
> -/* Copyright (C) 1998-2023 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public
> - License as published by the Free Software Foundation; either
> - version 2.1 of the License, or (at your option) any later version.
> -
> - The GNU C Library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; if not, see
> - <https://www.gnu.org/licenses/>. */
> -
> -#include <string.h>
> -#include <unistd.h>
> -
> -#define TRANSFORM_UTMP_FILE_NAME(file_name) \
> - ((strcmp (file_name, _PATH_UTMP "x") == 0 \
> - && __access (_PATH_UTMP "x", F_OK) != 0) \
> - ? _PATH_UTMP \
> - : ((strcmp (file_name, _PATH_WTMP "x") == 0 \
> - && __access (_PATH_WTMP "x", F_OK) != 0) \
> - ? _PATH_WTMP \
> - : file_name))
> -
> -#include <login/updwtmp.c>
> diff --git a/sysdeps/gnu/utmp_file.c b/sysdeps/gnu/utmp_file.c
> deleted file mode 100644
> index 9ec4f9ad4b..0000000000
> --- a/sysdeps/gnu/utmp_file.c
> +++ /dev/null
> @@ -1,30 +0,0 @@
> -/* Copyright (C) 1998-2023 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public
> - License as published by the Free Software Foundation; either
> - version 2.1 of the License, or (at your option) any later version.
> -
> - The GNU C Library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; if not, see
> - <https://www.gnu.org/licenses/>. */
> -
> -#include <string.h>
> -#include <unistd.h>
> -
> -#define TRANSFORM_UTMP_FILE_NAME(file_name) \
> - ((strcmp (file_name, _PATH_UTMP "x") == 0 \
> - && __access (_PATH_UTMP "x", F_OK) != 0) \
> - ? _PATH_UTMP \
> - : ((strcmp (file_name, _PATH_WTMP "x") == 0 \
> - && __access (_PATH_WTMP "x", F_OK) != 0) \
> - ? _PATH_WTMP \
> - : file_name))
> -
> -#include <login/utmp_file.c>
> diff --git a/sysdeps/unix/sysv/linux/paths.h b/sysdeps/unix/sysv/linux/paths.h
> index 1342ab3a96..081dcdf523 100644
> --- a/sysdeps/unix/sysv/linux/paths.h
> +++ b/sysdeps/unix/sysv/linux/paths.h
> @@ -61,9 +61,9 @@
> #define _PATH_SHELLS "/etc/shells"
> #define _PATH_TTY "/dev/tty"
> #define _PATH_UNIX "/boot/vmlinux"
> -#define _PATH_UTMP "/var/run/utmp"
> +#define _PATH_UTMP "/dev/null/utmp"
> #define _PATH_VI "/usr/bin/vi"
> -#define _PATH_WTMP "/var/log/wtmp"
> +#define _PATH_WTMP "/dev/null/wtmp"
>
> /* Provide trailing slash, since mostly used for building pathnames. */
> #define _PATH_DEV "/dev/"
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/Makefile b/sysdeps/unix/sysv/linux/s390/s390-32/Makefile
> index 6b6d59b7dd..fb3c4554bf 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-32/Makefile
> +++ b/sysdeps/unix/sysv/linux/s390/s390-32/Makefile
> @@ -1,10 +1,6 @@
> # See Makeconfig regarding the use of default-abi.
> default-abi := 32
>
> -ifeq ($(subdir),login)
> -sysdep_routines += utmp32 utmpx32 login32
> -endif
> -
> ifeq ($(subdir),misc)
> sysdep_headers += sys/elf.h
> endif
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getutent.c b/sysdeps/unix/sysv/linux/s390/s390-32/getutent.c
> index 562495b122..75a3b72d2b 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-32/getutent.c
> +++ b/sysdeps/unix/sysv/linux/s390/s390-32/getutent.c
> @@ -20,13 +20,20 @@
>
> #include "utmp-compat.h"
>
> -#if defined SHARED
> -# undef weak_alias
> -# define weak_alias(n,a)
> -#endif
> -#include "login/getutent.c"
> -_weak_alias (buffer, __libc_getutent_freemem_ptr)
> +struct utmp *
> +__getutent (void)
> +{
> + return NULL;
> +}
> +symbol_version (__getutent, getutent, GLIBC_2.0);
> +symbol_version (__getutent, getutxent, GLIBC_2.1);
>
> #if defined SHARED
> default_symbol_version (__getutent, getutent, UTMP_COMPAT_BASE);
> +default_symbol_version (__getutent, getutxent, UTMP_COMPAT_BASE);
> +#else
> +weak_alias (__getutent, getutent)
> +weak_alias (__getutent, getutxent)
> #endif
> +stub_warning (getutent)
> +stub_warning (getutxent)
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getutent_r.c b/sysdeps/unix/sysv/linux/s390/s390-32/getutent_r.c
> index 7d4f588d99..286b71c9b1 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-32/getutent_r.c
> +++ b/sysdeps/unix/sysv/linux/s390/s390-32/getutent_r.c
> @@ -15,23 +15,30 @@
> License along with the GNU C Library; if not, see
> <https://www.gnu.org/licenses/>. */
>
> -#include <libc-lock.h>
> #include <stdlib.h>
> #include <utmp.h>
>
> #include "utmp-compat.h"
> -#include "utmp-private.h"
>
> #if defined SHARED
> +extern void __setutent (void);
> +extern void __endutent (void);
> +
> weak_alias (__setutent, setutent)
> weak_alias (__endutent, endutent)
> +weak_alias (__endutent, endutxent)
>
> # undef weak_alias
> # define weak_alias(n,a)
> #endif
> #include "login/getutent_r.c"
> +symbol_version (__setutent, setutxent, GLIBC_2.1);
> +symbol_version (__getutent_r, getutent_r, GLIBC_2.0);
> +symbol_version (__pututline, pututline, GLIBC_2.0);
> +symbol_version (__pututline, pututxline, GLIBC_2.1);
>
> #if defined SHARED
> default_symbol_version (__getutent_r, getutent_r, UTMP_COMPAT_BASE);
> default_symbol_version (__pututline, pututline, UTMP_COMPAT_BASE);
> +default_symbol_version (__pututline, pututxline, UTMP_COMPAT_BASE);
> #endif
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getutid.c b/sysdeps/unix/sysv/linux/s390/s390-32/getutid.c
> index ccdc25b2d6..1d5d59f205 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-32/getutid.c
> +++ b/sysdeps/unix/sysv/linux/s390/s390-32/getutid.c
> @@ -25,8 +25,10 @@
> # define weak_alias(n,a)
> #endif
> #include "login/getutid.c"
> -_weak_alias (buffer, __libc_getutid_freemem_ptr)
>
> +symbol_version (__getutid, getutid, GLIBC_2.0);
> +symbol_version (__getutid, getutxid, GLIBC_2.1);
> #if defined SHARED
> default_symbol_version (__getutid, getutid, UTMP_COMPAT_BASE);
> +default_symbol_version (__getutid, getutxid, UTMP_COMPAT_BASE);
> #endif
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getutid_r.c b/sysdeps/unix/sysv/linux/s390/s390-32/getutid_r.c
> index e97a3c842d..4d6fb3169d 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-32/getutid_r.c
> +++ b/sysdeps/unix/sysv/linux/s390/s390-32/getutid_r.c
> @@ -21,13 +21,13 @@
> #include <utmp.h>
>
> #include "utmp-compat.h"
> -#include "utmp-private.h"
>
> #if defined SHARED
> # undef weak_alias
> # define weak_alias(n,a)
> #endif
> #include "login/getutid_r.c"
> +symbol_version (__getutid_r, getutid_r, GLIBC_2.0);
>
> #if defined SHARED
> default_symbol_version (__getutid_r, getutid_r, UTMP_COMPAT_BASE);
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getutline.c b/sysdeps/unix/sysv/linux/s390/s390-32/getutline.c
> index 16e8f17915..ddf449d4e8 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-32/getutline.c
> +++ b/sysdeps/unix/sysv/linux/s390/s390-32/getutline.c
> @@ -25,8 +25,10 @@
> # define weak_alias(n,a)
> #endif
> #include "login/getutline.c"
> -_weak_alias (buffer, __libc_getutline_freemem_ptr)
>
> +symbol_version (__getutline, getutline, GLIBC_2.0);
> +symbol_version (__getutline, getutxline, GLIBC_2.1);
> #if defined SHARED
> default_symbol_version (__getutline, getutline, UTMP_COMPAT_BASE);
> +default_symbol_version (__getutline, getutxline, UTMP_COMPAT_BASE);
> #endif
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getutline_r.c b/sysdeps/unix/sysv/linux/s390/s390-32/getutline_r.c
> index 4983b98953..106634dc9a 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-32/getutline_r.c
> +++ b/sysdeps/unix/sysv/linux/s390/s390-32/getutline_r.c
> @@ -20,13 +20,13 @@
> #include <utmp.h>
>
> #include "utmp-compat.h"
> -#include "utmp-private.h"
>
> #if defined SHARED
> # undef weak_alias
> # define weak_alias(n,a)
> #endif
> #include "login/getutline_r.c"
> +symbol_version (__getutline_r, getutline_r, GLIBC_2.0);
>
> #if defined SHARED
> default_symbol_version (__getutline_r, getutline_r, UTMP_COMPAT_BASE);;
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getutmp.c b/sysdeps/unix/sysv/linux/s390/s390-32/getutmp.c
> index cbce597ab6..ed61962462 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-32/getutmp.c
> +++ b/sysdeps/unix/sysv/linux/s390/s390-32/getutmp.c
> @@ -17,20 +17,20 @@
>
> #include <string.h>
> #include <utmp.h>
> -/* This is an ugly hack but we must not see the getutmpx declaration. */
> -#define getutmpx XXXgetutmpx
> +#define getutmpx __redirect_getutmpx
> #include <utmpx.h>
> #undef getutmpx
>
> #include "utmp-compat.h"
>
> -#undef weak_alias
> -#define weak_alias(n,a)
> -#define getutmp __getutmp
> -#define getutmpx __getutmpx
> -#include "sysdeps/gnu/getutmp.c"
> -#undef getutmp
> -#undef getutmpx
> +void
> +__getutmp (const struct utmpx *utmpx, struct utmp *utmp)
> +{
> +}
> +symbol_version (__getutmp, getutmp, GLIBC_2.1.1);
> +symbol_version (__getutmp, getutmpx, GLIBC_2.1.1);
>
> default_symbol_version (__getutmp, getutmp, UTMP_COMPAT_BASE);
> -default_symbol_version (__getutmpx, getutmpx, UTMP_COMPAT_BASE);
> +default_symbol_version (__getutmp, getutmpx, UTMP_COMPAT_BASE);
> +stub_warning (getutmp)
> +stub_warning (getutmpx)
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getutxent.c b/sysdeps/unix/sysv/linux/s390/s390-32/getutxent.c
> deleted file mode 100644
> index 4d84e95a6f..0000000000
> --- a/sysdeps/unix/sysv/linux/s390/s390-32/getutxent.c
> +++ /dev/null
> @@ -1,29 +0,0 @@
> -/* Copyright (C) 2008-2023 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public
> - License as published by the Free Software Foundation; either
> - version 2.1 of the License, or (at your option) any later version.
> -
> - The GNU C Library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; if not, see
> - <https://www.gnu.org/licenses/>. */
> -
> -#include <utmp.h>
> -#include <utmpx.h>
> -
> -#include "utmp-compat.h"
> -
> -#undef weak_alias
> -#define weak_alias(n,a)
> -#define getutxent __getutxent
> -#include "login/getutxent.c"
> -#undef getutxent
> -
> -default_symbol_version (__getutxent, getutxent, UTMP_COMPAT_BASE);
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getutxid.c b/sysdeps/unix/sysv/linux/s390/s390-32/getutxid.c
> deleted file mode 100644
> index abc6a8dfbf..0000000000
> --- a/sysdeps/unix/sysv/linux/s390/s390-32/getutxid.c
> +++ /dev/null
> @@ -1,29 +0,0 @@
> -/* Copyright (C) 2008-2023 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public
> - License as published by the Free Software Foundation; either
> - version 2.1 of the License, or (at your option) any later version.
> -
> - The GNU C Library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; if not, see
> - <https://www.gnu.org/licenses/>. */
> -
> -#include <utmp.h>
> -#include <utmpx.h>
> -
> -#include "utmp-compat.h"
> -
> -#undef weak_alias
> -#define weak_alias(n,a)
> -#define getutxid __getutxid
> -#include "login/getutxid.c"
> -#undef getutxid
> -
> -default_symbol_version (__getutxid, getutxid, UTMP_COMPAT_BASE);
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getutxline.c b/sysdeps/unix/sysv/linux/s390/s390-32/getutxline.c
> deleted file mode 100644
> index 0149758b52..0000000000
> --- a/sysdeps/unix/sysv/linux/s390/s390-32/getutxline.c
> +++ /dev/null
> @@ -1,29 +0,0 @@
> -/* Copyright (C) 2008-2023 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public
> - License as published by the Free Software Foundation; either
> - version 2.1 of the License, or (at your option) any later version.
> -
> - The GNU C Library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; if not, see
> - <https://www.gnu.org/licenses/>. */
> -
> -#include <utmp.h>
> -#include <utmpx.h>
> -
> -#include "utmp-compat.h"
> -
> -#undef weak_alias
> -#define weak_alias(n,a)
> -#define getutxline __getutxline
> -#include "login/getutxline.c"
> -#undef getutxline
> -
> -default_symbol_version (__getutxline, getutxline, UTMP_COMPAT_BASE);
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/login.c b/sysdeps/unix/sysv/linux/s390/s390-32/login.c
> index 583428d86a..3ae6f243c7 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-32/login.c
> +++ b/sysdeps/unix/sysv/linux/s390/s390-32/login.c
> @@ -29,6 +29,7 @@
> #undef compat_symbol
> #define compat_symbol(...)
> #include "login/login.c"
> +symbol_version (__login, login, GLIBC_2.0);
>
> /* Compatibility symbol as formerly found in libutil. login@GLIBC_2.0
> is supplied by login32.c. */
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/login32.c b/sysdeps/unix/sysv/linux/s390/s390-32/login32.c
> deleted file mode 100644
> index e66ee9eb72..0000000000
> --- a/sysdeps/unix/sysv/linux/s390/s390-32/login32.c
> +++ /dev/null
> @@ -1,37 +0,0 @@
> -/* Copyright (C) 2008-2023 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public
> - License as published by the Free Software Foundation; either
> - version 2.1 of the License, or (at your option) any later version.
> -
> - The GNU C Library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; if not, see
> - <https://www.gnu.org/licenses/>. */
> -
> -#ifdef SHARED
> -# include <sys/types.h>
> -# include <utmp.h>
> -# include <libc-symbols.h>
> -
> -# include "utmp32.h"
> -# include "utmp-convert.h"
> -
> -/* Write the given entry into utmp and wtmp. */
> -void
> -login32 (const struct utmp32 *entry)
> -{
> - struct utmp in64;
> -
> - utmp_convert32to64 (entry, &in64);
> - login (&in64);
> -}
> -
> -symbol_version (login32, login, GLIBC_2.0);
> -#endif
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/pututxline.c b/sysdeps/unix/sysv/linux/s390/s390-32/pututxline.c
> deleted file mode 100644
> index e69f2a9408..0000000000
> --- a/sysdeps/unix/sysv/linux/s390/s390-32/pututxline.c
> +++ /dev/null
> @@ -1,29 +0,0 @@
> -/* Copyright (C) 2008-2023 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public
> - License as published by the Free Software Foundation; either
> - version 2.1 of the License, or (at your option) any later version.
> -
> - The GNU C Library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; if not, see
> - <https://www.gnu.org/licenses/>. */
> -
> -#include <utmp.h>
> -#include <utmpx.h>
> -
> -#include "utmp-compat.h"
> -
> -#undef weak_alias
> -#define weak_alias(n,a)
> -#define pututxline __pututxline
> -#include "login/pututxline.c"
> -#undef pututxline
> -
> -default_symbol_version (__pututxline, pututxline, UTMP_COMPAT_BASE);
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/updwtmp.c b/sysdeps/unix/sysv/linux/s390/s390-32/updwtmp.c
> index a70844ba28..553fcb8dd4 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-32/updwtmp.c
> +++ b/sysdeps/unix/sysv/linux/s390/s390-32/updwtmp.c
> @@ -18,14 +18,16 @@
> #include <utmp.h>
>
> #include "utmp-compat.h"
> -#include "utmp-private.h"
>
> #if defined SHARED
> # undef weak_alias
> # define weak_alias(n,a)
> #endif
> -#include "sysdeps/gnu/updwtmp.c"
> +#include "login/updwtmp.c"
> +symbol_version (__updwtmp, updwtmp, GLIBC_2.0);
> +symbol_version (__updwtmp, updwtmpx, GLIBC_2.1);
>
> #if defined SHARED
> default_symbol_version (__updwtmp, updwtmp, UTMP_COMPAT_BASE);
> +default_symbol_version (__updwtmp, updwtmpx, UTMP_COMPAT_BASE);
> #endif
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/updwtmpx.c b/sysdeps/unix/sysv/linux/s390/s390-32/updwtmpx.c
> deleted file mode 100644
> index 502dfb63ac..0000000000
> --- a/sysdeps/unix/sysv/linux/s390/s390-32/updwtmpx.c
> +++ /dev/null
> @@ -1,29 +0,0 @@
> -/* Copyright (C) 2008-2023 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public
> - License as published by the Free Software Foundation; either
> - version 2.1 of the License, or (at your option) any later version.
> -
> - The GNU C Library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; if not, see
> - <https://www.gnu.org/licenses/>. */
> -
> -#include <utmp.h>
> -#include <utmpx.h>
> -
> -#include "utmp-compat.h"
> -
> -#undef weak_alias
> -#define weak_alias(n,a)
> -#define updwtmpx __updwtmpx
> -#include "login/updwtmpx.c"
> -#undef updwtmpx
> -
> -default_symbol_version (__updwtmpx, updwtmpx, UTMP_COMPAT_BASE);
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/utmp-convert.h b/sysdeps/unix/sysv/linux/s390/s390-32/utmp-convert.h
> deleted file mode 100644
> index f1c67f3e29..0000000000
> --- a/sysdeps/unix/sysv/linux/s390/s390-32/utmp-convert.h
> +++ /dev/null
> @@ -1,85 +0,0 @@
> -/* Copyright (C) 2008-2023 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public
> - License as published by the Free Software Foundation; either
> - version 2.1 of the License, or (at your option) any later version.
> -
> - The GNU C Library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; if not, see
> - <https://www.gnu.org/licenses/>. */
> -
> -
> -/* This file provides functions converting between the 32 and 64 bit
> - struct utmp variants. */
> -
> -#ifndef _UTMP_CONVERT_H
> -#define _UTMP_CONVERT_H 1
> -
> -#include <string.h>
> -
> -#include "utmp32.h"
> -
> -/* Convert the 64 bit struct utmp value in FROM to the 32 bit version
> - returned in TO. */
> -static inline void
> -utmp_convert64to32 (const struct utmp *from, struct utmp32 *to)
> -{
> -#if _HAVE_UT_TYPE - 0
> - to->ut_type = from->ut_type;
> -#endif
> -#if _HAVE_UT_PID - 0
> - to->ut_pid = from->ut_pid;
> -#endif
> - memcpy (to->ut_line, from->ut_line, UT_LINESIZE);
> - memcpy (to->ut_user, from->ut_user, UT_NAMESIZE);
> -#if _HAVE_UT_ID - 0
> - memcpy (to->ut_id, from->ut_id, 4);
> -#endif
> -#if _HAVE_UT_HOST - 0
> - memcpy (to->ut_host, from->ut_host, UT_HOSTSIZE);
> -#endif
> - to->ut_exit = from->ut_exit;
> - to->ut_session = (int32_t) from->ut_session;
> -#if _HAVE_UT_TV - 0
> - to->ut_tv.tv_sec = (int32_t) from->ut_tv.tv_sec;
> - to->ut_tv.tv_usec = (int32_t) from->ut_tv.tv_usec;
> -#endif
> - memcpy (to->ut_addr_v6, from->ut_addr_v6, 4 * 4);
> -}
> -
> -/* Convert the 32 bit struct utmp value in FROM to the 64 bit version
> - returned in TO. */
> -static inline void
> -utmp_convert32to64 (const struct utmp32 *from, struct utmp *to)
> -{
> -#if _HAVE_UT_TYPE - 0
> - to->ut_type = from->ut_type;
> -#endif
> -#if _HAVE_UT_PID - 0
> - to->ut_pid = from->ut_pid;
> -#endif
> - memcpy (to->ut_line, from->ut_line, UT_LINESIZE);
> - memcpy (to->ut_user, from->ut_user, UT_NAMESIZE);
> -#if _HAVE_UT_ID - 0
> - memcpy (to->ut_id, from->ut_id, 4);
> -#endif
> -#if _HAVE_UT_HOST - 0
> - memcpy (to->ut_host, from->ut_host, UT_HOSTSIZE);
> -#endif
> - to->ut_exit = from->ut_exit;
> - to->ut_session = (int64_t) from->ut_session;
> -#if _HAVE_UT_TV - 0
> - to->ut_tv.tv_sec = (int64_t) from->ut_tv.tv_sec;
> - to->ut_tv.tv_usec = (int64_t) from->ut_tv.tv_usec;
> -#endif
> - memcpy (to->ut_addr_v6, from->ut_addr_v6, 4 * 4);
> -}
> -
> -#endif /* utmp-convert.h */
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/utmp32.c b/sysdeps/unix/sysv/linux/s390/s390-32/utmp32.c
> deleted file mode 100644
> index c6ad9b64a6..0000000000
> --- a/sysdeps/unix/sysv/linux/s390/s390-32/utmp32.c
> +++ /dev/null
> @@ -1,183 +0,0 @@
> -/* Copyright (C) 2008-2023 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public
> - License as published by the Free Software Foundation; either
> - version 2.1 of the License, or (at your option) any later version.
> -
> - The GNU C Library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; if not, see
> - <https://www.gnu.org/licenses/>. */
> -
> -#include <sys/types.h>
> -#include <utmp.h>
> -#include <errno.h>
> -#include <stdlib.h>
> -
> -#include "utmp32.h"
> -#include "utmp-convert.h"
> -
> -/* Allocate a static buffer to be returned to the caller. As well as
> - with the existing version of these functions the caller has to be
> - aware that the contents of this buffer will change with subsequent
> - calls. */
> -#define ALLOCATE_UTMP32_OUT(OUT) \
> - static struct utmp32 *OUT = NULL; \
> - \
> - if (OUT == NULL) \
> - { \
> - OUT = malloc (sizeof (struct utmp32)); \
> - if (OUT == NULL) \
> - return NULL; \
> - }
> -
> -/* Perform a lookup for a utmp entry matching FIELD using function
> - FUNC. FIELD is converted to a 64 bit utmp and the result is
> - converted back to 32 bit utmp. */
> -#define ACCESS_UTMP_ENTRY(FUNC, FIELD) \
> - struct utmp in64; \
> - struct utmp *out64; \
> - ALLOCATE_UTMP32_OUT (out32); \
> - \
> - utmp_convert32to64 (FIELD, &in64); \
> - out64 = FUNC (&in64); \
> - \
> - if (out64 == NULL) \
> - return NULL; \
> - \
> - utmp_convert64to32 (out64, out32); \
> - \
> - return out32;
> -
> -/* Search forward from the current point in the utmp file until the
> - next entry with a ut_type matching ID->ut_type. */
> -struct utmp32 *
> -getutid32 (const struct utmp32 *id)
> -{
> - ACCESS_UTMP_ENTRY (__getutid, id)
> -}
> -symbol_version (getutid32, getutid, GLIBC_2.0);
> -
> -/* Search forward from the current point in the utmp file until the
> - next entry with a ut_line matching LINE->ut_line. */
> -struct utmp32 *
> -getutline32 (const struct utmp32 *line)
> -{
> - ACCESS_UTMP_ENTRY (__getutline, line)
> -}
> -symbol_version (getutline32, getutline, GLIBC_2.0);
> -
> -/* Write out entry pointed to by UTMP_PTR into the utmp file. */
> -struct utmp32 *
> -pututline32 (const struct utmp32 *utmp_ptr)
> -{
> - ACCESS_UTMP_ENTRY (__pututline, utmp_ptr)
> -}
> -symbol_version (pututline32, pututline, GLIBC_2.0);
> -
> -/* Read next entry from a utmp-like file. */
> -struct utmp32 *
> -getutent32 (void)
> -{
> - struct utmp *out64;
> - ALLOCATE_UTMP32_OUT (out32);
> -
> - out64 = __getutent ();
> - if (!out64)
> - return NULL;
> -
> - utmp_convert64to32 (out64, out32);
> - return out32;
> -}
> -symbol_version (getutent32, getutent, GLIBC_2.0);
> -
> -/* Reentrant versions of the file for handling utmp files. */
> -
> -int
> -getutent32_r (struct utmp32 *buffer, struct utmp32 **result)
> -{
> - struct utmp out64;
> - struct utmp *out64p;
> - int ret;
> -
> - ret = __getutent_r (&out64, &out64p);
> - if (ret == -1)
> - {
> - *result = NULL;
> - return -1;
> - }
> -
> - utmp_convert64to32 (out64p, buffer);
> - *result = buffer;
> -
> - return 0;
> -}
> -symbol_version (getutent32_r, getutent_r, GLIBC_2.0);
> -
> -int
> -getutid32_r (const struct utmp32 *id, struct utmp32 *buffer,
> - struct utmp32 **result)
> -{
> - struct utmp in64;
> - struct utmp out64;
> - struct utmp *out64p;
> - int ret;
> -
> - utmp_convert32to64 (id, &in64);
> -
> - ret = __getutid_r (&in64, &out64, &out64p);
> - if (ret == -1)
> - {
> - *result = NULL;
> - return -1;
> - }
> -
> - utmp_convert64to32 (out64p, buffer);
> - *result = buffer;
> -
> - return 0;
> -}
> -symbol_version (getutid32_r, getutid_r, GLIBC_2.0);
> -
> -int
> -getutline32_r (const struct utmp32 *line,
> - struct utmp32 *buffer, struct utmp32 **result)
> -{
> - struct utmp in64;
> - struct utmp out64;
> - struct utmp *out64p;
> - int ret;
> -
> - utmp_convert32to64 (line, &in64);
> -
> - ret = __getutline_r (&in64, &out64, &out64p);
> - if (ret == -1)
> - {
> - *result = NULL;
> - return -1;
> - }
> -
> - utmp_convert64to32 (out64p, buffer);
> - *result = buffer;
> -
> - return 0;
> -
> -}
> -symbol_version (getutline32_r, getutline_r, GLIBC_2.0);
> -
> -/* Append entry UTMP to the wtmp-like file WTMP_FILE. */
> -void
> -updwtmp32 (const char *wtmp_file, const struct utmp32 *utmp)
> -{
> - struct utmp in32;
> -
> - utmp_convert32to64 (utmp, &in32);
> - __updwtmp (wtmp_file, &in32);
> -}
> -symbol_version (updwtmp32, updwtmp, GLIBC_2.0);
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/utmp32.h b/sysdeps/unix/sysv/linux/s390/s390-32/utmp32.h
> deleted file mode 100644
> index e29039589c..0000000000
> --- a/sysdeps/unix/sysv/linux/s390/s390-32/utmp32.h
> +++ /dev/null
> @@ -1,51 +0,0 @@
> -/* The `struct utmp' type, describing entries in the utmp file. GNU version.
> - Copyright (C) 1993-2023 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public
> - License as published by the Free Software Foundation; either
> - version 2.1 of the License, or (at your option) any later version.
> -
> - The GNU C Library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; if not, see
> - <https://www.gnu.org/licenses/>. */
> -
> -#ifndef _UTMP32_H
> -#define _UTMP32_H 1
> -
> -#include <paths.h>
> -#include <sys/time.h>
> -#include <sys/types.h>
> -#include <bits/wordsize.h>
> -#include <utmp.h>
> -
> -/* The structure describing an entry in the user accounting database. */
> -struct utmp32
> -{
> - short int ut_type; /* Type of login. */
> - pid_t ut_pid; /* Process ID of login process. */
> - char ut_line[UT_LINESIZE]; /* Devicename. */
> - char ut_id[4]; /* Inittab ID. */
> - char ut_user[UT_NAMESIZE]; /* Username. */
> - char ut_host[UT_HOSTSIZE]; /* Hostname for remote login. */
> - struct exit_status ut_exit; /* Exit status of a process marked
> - as DEAD_PROCESS. */
> - int32_t ut_session; /* Session ID, used for windowing. */
> - struct
> - {
> - int32_t tv_sec; /* Seconds. */
> - int32_t tv_usec; /* Microseconds. */
> - } ut_tv; /* Time entry was made. */
> -
> - int32_t ut_addr_v6[4]; /* Internet address of remote host. */
> - char __glibc_reserved[20]; /* Reserved for future use. */
> -};
> -
> -
> -#endif /* utmp32.h */
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/utmpx-convert.h b/sysdeps/unix/sysv/linux/s390/s390-32/utmpx-convert.h
> deleted file mode 100644
> index 2925d14885..0000000000
> --- a/sysdeps/unix/sysv/linux/s390/s390-32/utmpx-convert.h
> +++ /dev/null
> @@ -1,84 +0,0 @@
> -/* Copyright (C) 2008-2023 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public
> - License as published by the Free Software Foundation; either
> - version 2.1 of the License, or (at your option) any later version.
> -
> - The GNU C Library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; if not, see
> - <https://www.gnu.org/licenses/>. */
> -
> -
> -/* This file provides functions converting between the 32 and 64 bit
> - struct utmp variants. */
> -
> -#ifndef _UTMPX_CONVERT_H
> -#define _UTMPX_CONVERT_H 1
> -
> -#include <string.h>
> -#include "utmpx32.h"
> -
> -/* Convert the 64 bit struct utmpx value in FROM to the 32 bit version
> - returned in TO. */
> -static inline void
> -utmpx_convert64to32 (const struct utmpx *from, struct utmpx32 *to)
> -{
> -#if _HAVE_UT_TYPE - 0
> - to->ut_type = from->ut_type;
> -#endif
> -#if _HAVE_UT_PID - 0
> - to->ut_pid = from->ut_pid;
> -#endif
> - memcpy (to->ut_line, from->ut_line, __UT_LINESIZE);
> - memcpy (to->ut_user, from->ut_user, __UT_NAMESIZE);
> -#if _HAVE_UT_ID - 0
> - memcpy (to->ut_id, from->ut_id, 4);
> -#endif
> -#if _HAVE_UT_HOST - 0
> - memcpy (to->ut_host, from->ut_host, __UT_HOSTSIZE);
> -#endif
> - to->ut_exit = from->ut_exit;
> - to->ut_session = (int32_t) from->ut_session;
> -#if _HAVE_UT_TV - 0
> - to->ut_tv.tv_sec = (int32_t) from->ut_tv.tv_sec;
> - to->ut_tv.tv_usec = (int32_t) from->ut_tv.tv_usec;
> -#endif
> - memcpy (to->ut_addr_v6, from->ut_addr_v6, 4 * 4);
> -}
> -
> -/* Convert the 32 bit struct utmpx value in FROM to the 64 bit version
> - returned in TO. */
> -static inline void
> -utmpx_convert32to64 (const struct utmpx32 *from, struct utmpx *to)
> -{
> -#if _HAVE_UT_TYPE - 0
> - to->ut_type = from->ut_type;
> -#endif
> -#if _HAVE_UT_PID - 0
> - to->ut_pid = from->ut_pid;
> -#endif
> - memcpy (to->ut_line, from->ut_line, __UT_LINESIZE);
> - memcpy (to->ut_user, from->ut_user, __UT_NAMESIZE);
> -#if _HAVE_UT_ID - 0
> - memcpy (to->ut_id, from->ut_id, 4);
> -#endif
> -#if _HAVE_UT_HOST - 0
> - memcpy (to->ut_host, from->ut_host, __UT_HOSTSIZE);
> -#endif
> - to->ut_exit = from->ut_exit;
> - to->ut_session = (int64_t) from->ut_session;
> -#if _HAVE_UT_TV - 0
> - to->ut_tv.tv_sec = (int64_t) from->ut_tv.tv_sec;
> - to->ut_tv.tv_usec = (int64_t) from->ut_tv.tv_usec;
> -#endif
> - memcpy (to->ut_addr_v6, from->ut_addr_v6, 4 * 4);
> -}
> -
> -#endif /* utmpx-convert.h */
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/utmpx32.c b/sysdeps/unix/sysv/linux/s390/s390-32/utmpx32.c
> deleted file mode 100644
> index b1472f9adf..0000000000
> --- a/sysdeps/unix/sysv/linux/s390/s390-32/utmpx32.c
> +++ /dev/null
> @@ -1,138 +0,0 @@
> -/* Copyright (C) 2008-2023 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public
> - License as published by the Free Software Foundation; either
> - version 2.1 of the License, or (at your option) any later version.
> -
> - The GNU C Library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; if not, see
> - <https://www.gnu.org/licenses/>. */
> -
> -#include <sys/types.h>
> -#include <utmp.h>
> -#include <errno.h>
> -#include <stdlib.h>
> -
> -#include "utmp32.h"
> -#include "utmp-convert.h"
> -
> -#include "utmpx32.h"
> -#include "utmpx-convert.h"
> -
> -/* Allocate a static buffer to be returned to the caller. As well as
> - with the existing version of these functions the caller has to be
> - aware that the contents of this buffer will change with subsequent
> - calls. */
> -#define ALLOCATE_UTMPX32_OUT(OUT) \
> - static struct utmpx32 *OUT = NULL; \
> - \
> - if (OUT == NULL) \
> - { \
> - OUT = malloc (sizeof (struct utmpx32)); \
> - if (OUT == NULL) \
> - return NULL; \
> - }
> -
> -/* Perform a lookup for a utmpx entry matching FIELD using function
> - FUNC. FIELD is converted to a 64 bit utmpx and the result is
> - converted back to 32 bit utmpx. */
> -#define ACCESS_UTMPX_ENTRY(FUNC, FIELD) \
> - struct utmpx in64; \
> - struct utmpx *out64; \
> - ALLOCATE_UTMPX32_OUT (out32); \
> - \
> - utmpx_convert32to64 (FIELD, &in64); \
> - out64 = FUNC (&in64); \
> - \
> - if (out64 == NULL) \
> - return NULL; \
> - \
> - utmpx_convert64to32 (out64, out32); \
> - \
> - return out32;
> -
> -
> -/* Get the next entry from the user accounting database. */
> -struct utmpx32 *
> -getutxent32 (void)
> -{
> - struct utmpx *out64;
> - ALLOCATE_UTMPX32_OUT (out32);
> -
> - out64 = __getutxent ();
> - if (!out64)
> - return NULL;
> -
> - utmpx_convert64to32 (out64, out32);
> - return out32;
> -
> -}
> -symbol_version (getutxent32, getutxent, GLIBC_2.1);
> -
> -/* Get the user accounting database entry corresponding to ID. */
> -struct utmpx32 *
> -getutxid32 (const struct utmpx32 *id)
> -{
> - ACCESS_UTMPX_ENTRY (__getutxid, id);
> -}
> -symbol_version (getutxid32, getutxid, GLIBC_2.1);
> -
> -/* Get the user accounting database entry corresponding to LINE. */
> -struct utmpx32 *
> -getutxline32 (const struct utmpx32 *line)
> -{
> - ACCESS_UTMPX_ENTRY (__getutxline, line);
> -}
> -symbol_version (getutxline32, getutxline, GLIBC_2.1);
> -
> -/* Write the entry UTMPX into the user accounting database. */
> -struct utmpx32 *
> -pututxline32 (const struct utmpx32 *utmpx)
> -{
> - ACCESS_UTMPX_ENTRY (__pututxline, utmpx);
> -}
> -symbol_version (pututxline32, pututxline, GLIBC_2.1);
> -
> -/* Append entry UTMP to the wtmpx-like file WTMPX_FILE. */
> -void
> -updwtmpx32 (const char *wtmpx_file, const struct utmpx32 *utmpx)
> -{
> - struct utmpx in64;
> -
> - utmpx_convert32to64 (utmpx, &in64);
> - __updwtmpx (wtmpx_file, &in64);
> -}
> -symbol_version (updwtmpx32, updwtmpx, GLIBC_2.1);
> -
> -/* Copy the information in UTMPX to UTMP. */
> -void
> -getutmp32 (const struct utmpx32 *utmpx, struct utmp32 *utmp)
> -{
> - struct utmpx in64;
> - struct utmp out64;
> -
> - utmpx_convert32to64 (utmpx, &in64);
> - __getutmp (&in64, &out64);
> - utmp_convert64to32 (&out64, utmp);
> -}
> -symbol_version (getutmp32, getutmp, GLIBC_2.1.1);
> -
> -/* Copy the information in UTMP to UTMPX. */
> -void
> -getutmpx32 (const struct utmp32 *utmp, struct utmpx32 *utmpx)
> -{
> - struct utmp in64;
> - struct utmpx out64;
> -
> - utmp_convert32to64 (utmp, &in64);
> - __getutmpx (&in64, &out64);
> - utmpx_convert64to32 (&out64, utmpx);
> -}
> -symbol_version (getutmpx32, getutmpx, GLIBC_2.1.1);
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/utmpx32.h b/sysdeps/unix/sysv/linux/s390/s390-32/utmpx32.h
> deleted file mode 100644
> index 5e559a7ac7..0000000000
> --- a/sysdeps/unix/sysv/linux/s390/s390-32/utmpx32.h
> +++ /dev/null
> @@ -1,59 +0,0 @@
> -/* The `struct utmp' type, describing entries in the utmp file. GNU version.
> - Copyright (C) 1993-2023 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public
> - License as published by the Free Software Foundation; either
> - version 2.1 of the License, or (at your option) any later version.
> -
> - The GNU C Library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; if not, see
> - <https://www.gnu.org/licenses/>. */
> -
> -#ifndef _UTMPX32_H
> -#define _UTMPX32_H 1
> -
> -#include <paths.h>
> -#include <sys/time.h>
> -#include <sys/types.h>
> -#include <bits/wordsize.h>
> -#include <utmpx.h>
> -
> -/* The structure describing an entry in the user accounting database. */
> -struct utmpx32
> -{
> - short int ut_type; /* Type of login. */
> - __pid_t ut_pid; /* Process ID of login process. */
> - char ut_line[__UT_LINESIZE]; /* Devicename. */
> - char ut_id[4]; /* Inittab ID. */
> - char ut_user[__UT_NAMESIZE]; /* Username. */
> - char ut_host[__UT_HOSTSIZE]; /* Hostname for remote login. */
> - struct __exit_status ut_exit; /* Exit status of a process marked
> - as DEAD_PROCESS. */
> - __int64_t ut_session; /* Session ID, used for windowing. */
> - struct
> - {
> - __int64_t tv_sec; /* Seconds. */
> - __int64_t tv_usec; /* Microseconds. */
> - } ut_tv; /* Time entry was made. */
> -
> - __int32_t ut_addr_v6[4]; /* Internet address of remote host. */
> - char __glibc_reserved[20]; /* Reserved for future use. */
> -};
> -
> -/* The internal interface needed by the compat wrapper functions. */
> -extern struct utmpx *__getutxent (void);
> -extern struct utmpx *__getutxid (const struct utmpx *__id);
> -extern struct utmpx *__getutxline (const struct utmpx *__line);
> -extern struct utmpx *__pututxline (const struct utmpx *__utmpx);
> -extern void __updwtmpx (const char *__wtmpx_file, const struct utmpx *__utmpx);
> -extern void __getutmp (const struct utmpx *__utmpx, struct utmp *__utmp);
> -extern void __getutmpx (const struct utmp *__utmp, struct utmpx *__utmpx);
> -
> -#endif /* utmpx32.h */
> diff --git a/sysdeps/unix/sysv/linux/utmp_file.c b/sysdeps/unix/sysv/linux/utmp_file.c
> deleted file mode 100644
> index faa3323079..0000000000
> --- a/sysdeps/unix/sysv/linux/utmp_file.c
> +++ /dev/null
> @@ -1,36 +0,0 @@
> -/* Copyright (C) 1998-2023 Free Software Foundation, Inc.
> - This file is part of the GNU C Library.
> -
> - The GNU C Library is free software; you can redistribute it and/or
> - modify it under the terms of the GNU Lesser General Public
> - License as published by the Free Software Foundation; either
> - version 2.1 of the License, or (at your option) any later version.
> -
> - The GNU C Library is distributed in the hope that it will be useful,
> - but WITHOUT ANY WARRANTY; without even the implied warranty of
> - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> - Lesser General Public License for more details.
> -
> - You should have received a copy of the GNU Lesser General Public
> - License along with the GNU C Library; if not, see
> - <https://www.gnu.org/licenses/>. */
> -
> -#include <string.h>
> -#include <unistd.h>
> -
> -#define TRANSFORM_UTMP_FILE_NAME(file_name) \
> - ((strcmp (file_name, _PATH_UTMP) == 0 \
> - && __access (_PATH_UTMP "x", F_OK) == 0) \
> - ? (_PATH_UTMP "x") \
> - : ((strcmp (file_name, _PATH_WTMP) == 0 \
> - && __access ( _PATH_WTMP "x", F_OK) == 0) \
> - ? (_PATH_WTMP "x") \
> - : ((strcmp (file_name, _PATH_UTMP "x") == 0 \
> - && __access (_PATH_UTMP "x", F_OK) != 0) \
> - ? _PATH_UTMP \
> - : ((strcmp (file_name, _PATH_WTMP "x") == 0 \
> - && __access (_PATH_WTMP "x", F_OK) != 0) \
> - ? _PATH_WTMP \
> - : file_name))))
> -
> -#include <login/utmp_file.c>
> --
> 2.34.1
--
Thorsten Kukuk, Distinguished Engineer, Senior Architect, Future Technologies
SUSE Software Solutions Germany GmbH, Frankenstraße 146, 90461
Nuernberg, Germany
Managing Director: Ivo Totev, Andrew McDonald, Werner Knoblich (HRB
36809, AG Nürnberg)
More information about the Libc-alpha
mailing list