1 /* A GNU-like <utmp.h>.
3 Copyright (C) 2023-2024 Free Software Foundation, Inc.
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
19 @PRAGMA_SYSTEM_HEADER@
23 #ifndef _@GUARD_PREFIX@_UTMP_H
25 #include <sys/types.h>
27 /* The include_next requires a split double-inclusion guard. */
29 # @INCLUDE_NEXT@ @NEXT_UTMP_H@
32 #ifndef _@GUARD_PREFIX@_UTMP_H
33 #define _@GUARD_PREFIX@_UTMP_H
35 /* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */
36 #if !_GL_CONFIG_H_INCLUDED
37 #error "Please include config.h first."
40 /* FreeBSD, NetBSD, OpenBSD, macOS, Minix, Haiku declare login_tty in
41 <util.h> or <libutil.h>, not in <utmp.h>. Solaris declares it in
42 <termios.h>, not in <utmp.h>. */
43 /* But in any case avoid namespace pollution on glibc systems. */
44 #if (@GNULIB_LOGIN_TTY@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__
45 # if @HAVE_UTIL_H@ /* macOS, NetBSD, OpenBSD, Minix */
47 # elif @HAVE_LIBUTIL_H@ /* FreeBSD, Haiku */
49 # elif @HAVE_TERMIOS_H@ /* Solaris */
54 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
56 /* The definition of _GL_WARN_ON_USE is copied here. */
59 #if @GNULIB_LOGIN_TTY@
60 # if @REPLACE_LOGIN_TTY@
61 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
63 # define login_tty rpl_login_tty
65 _GL_FUNCDECL_RPL (login_tty
, int, (int fd
));
66 _GL_CXXALIAS_RPL (login_tty
, int, (int fd
));
68 # if !@HAVE_LOGIN_TTY@
69 _GL_FUNCDECL_SYS (login_tty
, int, (int fd
));
71 _GL_CXXALIAS_SYS (login_tty
, int, (int fd
));
74 _GL_CXXALIASWARN (login_tty
);
76 #elif defined GNULIB_POSIXCHECK
78 # if HAVE_RAW_DECL_LOGIN_TTY
79 _GL_WARN_ON_USE (login_tty
, "login_tty is unportable - "
80 "use gnulib module login_tty for portability");
85 #endif /* _@GUARD_PREFIX@_UTMP_H */
86 #endif /* _@GUARD_PREFIX@_UTMP_H */