bpo-41818: Add os.login_tty() for *nix. (#29658)

* Add `os.login_tty(fd)` for Unix.

Reviewed-by: Christian Heimes <christian@python.org>
Signed-off-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
This commit is contained in:
Soumendra Ganguly 2022-05-05 11:04:44 -05:00 committed by GitHub
parent 42fee931d0
commit ae553b3561
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 184 additions and 14 deletions

View file

@ -2508,7 +2508,7 @@ AC_CHECK_HEADERS([ \
sys/random.h sys/resource.h sys/select.h sys/sendfile.h sys/socket.h sys/soundcard.h sys/stat.h \
sys/statvfs.h sys/sys_domain.h sys/syscall.h sys/sysmacros.h sys/termio.h sys/time.h sys/times.h \
sys/types.h sys/uio.h sys/un.h sys/utsname.h sys/wait.h sys/xattr.h sysexits.h syslog.h \
termios.h util.h utime.h \
termios.h util.h utime.h utmp.h \
])
AC_HEADER_DIRENT
AC_HEADER_MAJOR
@ -4670,7 +4670,7 @@ PY_CHECK_FUNC([setgroups], [
#endif
])
# check for openpty and forkpty
# check for openpty, login_tty, and forkpty
AC_CHECK_FUNCS(openpty,,
AC_CHECK_LIB(util,openpty,
@ -4678,6 +4678,9 @@ AC_CHECK_FUNCS(openpty,,
AC_CHECK_LIB(bsd,openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lbsd"])
)
)
AC_SEARCH_LIBS([login_tty], [util],
[AC_DEFINE([HAVE_LOGIN_TTY], [1], [Define to 1 if you have the `login_tty' function.])]
)
AC_CHECK_FUNCS(forkpty,,
AC_CHECK_LIB(util,forkpty,
[AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lutil"],