| 1 |
/* A GNU-like <utmp.h>. |
| 2 |
|
| 3 |
Copyright (C) 2023-2026 Free Software Foundation, Inc. |
| 4 |
|
| 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. |
| 9 |
|
| 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. |
| 14 |
|
| 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/>. */ |
| 17 |
|
| 18 |
#if __GNUC__ >= 3 |
| 19 |
@PRAGMA_SYSTEM_HEADER@ |
| 20 |
#endif |
| 21 |
@PRAGMA_COLUMNS@ |
| 22 |
|
| 23 |
#ifndef _@GUARD_PREFIX@_UTMP_H |
| 24 |
|
| 25 |
#include <sys/types.h> |
| 26 |
|
| 27 |
/* The include_next requires a split double-inclusion guard. */ |
| 28 |
#if @HAVE_UTMP_H@ |
| 29 |
# @INCLUDE_NEXT@ @NEXT_UTMP_H@ |
| 30 |
#endif |
| 31 |
|
| 32 |
#ifndef _@GUARD_PREFIX@_UTMP_H |
| 33 |
#define _@GUARD_PREFIX@_UTMP_H |
| 34 |
|
| 35 |
/* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */ |
| 36 |
#if !_GL_CONFIG_H_INCLUDED |
| 37 |
#error "Please include config.h first." |
| 38 |
#endif |
| 39 |
|
| 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 */ |
| 46 |
# include <util.h> |
| 47 |
# elif @HAVE_LIBUTIL_H@ /* FreeBSD, Haiku */ |
| 48 |
# include <libutil.h> |
| 49 |
# elif @HAVE_TERMIOS_H@ /* Solaris */ |
| 50 |
# include <termios.h> |
| 51 |
# endif |
| 52 |
#endif |
| 53 |
|
| 54 |
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ |
| 55 |
|
| 56 |
/* The definition of _GL_WARN_ON_USE is copied here. */ |
| 57 |
|
| 58 |
|
| 59 |
#if @GNULIB_LOGIN_TTY@ |
| 60 |
# if @REPLACE_LOGIN_TTY@ |
| 61 |
# if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| 62 |
# undef login_tty |
| 63 |
# define login_tty rpl_login_tty |
| 64 |
# endif |
| 65 |
_GL_FUNCDECL_RPL (login_tty, int, (int fd), ); |
| 66 |
_GL_CXXALIAS_RPL (login_tty, int, (int fd)); |
| 67 |
# else |
| 68 |
# if !@HAVE_LOGIN_TTY@ |
| 69 |
_GL_FUNCDECL_SYS (login_tty, int, (int fd), ); |
| 70 |
# endif |
| 71 |
_GL_CXXALIAS_SYS (login_tty, int, (int fd)); |
| 72 |
# endif |
| 73 |
# if __GLIBC__ >= 2 |
| 74 |
_GL_CXXALIASWARN (login_tty); |
| 75 |
# endif |
| 76 |
#elif defined GNULIB_POSIXCHECK |
| 77 |
# if HAVE_RAW_DECL_LOGIN_TTY |
| 78 |
_GL_WARN_ON_USE (login_tty, "login_tty is unportable - " |
| 79 |
"use gnulib module login_tty for portability"); |
| 80 |
# endif |
| 81 |
#endif |
| 82 |
|
| 83 |
|
| 84 |
#endif /* _@GUARD_PREFIX@_UTMP_H */ |
| 85 |
#endif /* _@GUARD_PREFIX@_UTMP_H */ |