about summary refs log tree commit diff
path: root/login/forkpty.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2021-06-30 07:21:14 +0200
committerFlorian Weimer <fweimer@redhat.com>2021-06-30 08:43:37 +0200
commit734c60ebb607086ad6d67b2544d6b7baba72a652 (patch)
tree3d0480b60b81da20b51df998f6585feeb85a8d14 /login/forkpty.c
parent98164ba55d01dfe517a71cbc5538ff1f5dc563d6 (diff)
downloadglibc-734c60ebb607086ad6d67b2544d6b7baba72a652.tar.gz
glibc-734c60ebb607086ad6d67b2544d6b7baba72a652.tar.xz
glibc-734c60ebb607086ad6d67b2544d6b7baba72a652.zip
login: Move libutil into libc
The symbols forkpty, login, login_tty, logout, logwtmp, openpty
were moved using scripts/move-symbol-to-libc.py.

This is a single commit because most of the symbols are tied together
via forkpty, for example.

Several changes to use hidden prototypes are needed.  This commit
also updates pseudoterminal terminology on modified lines.

For 390 (31-bit), this commit follows the existing style for the
compat symbol version creation.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'login/forkpty.c')
-rw-r--r--login/forkpty.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/login/forkpty.c b/login/forkpty.c
index 1e91bd8198..79f9846ac4 100644
--- a/login/forkpty.c
+++ b/login/forkpty.c
@@ -21,34 +21,41 @@
 #include <unistd.h>
 #include <utmp.h>
 #include <pty.h>
+#include <shlib-compat.h>
 
 int
-forkpty (int *amaster, char *name, const struct termios *termp,
-	 const struct winsize *winp)
+__forkpty (int *pptmx, char *name, const struct termios *termp,
+	   const struct winsize *winp)
 {
-  int master, slave, pid;
+  int ptmx, terminal, pid;
 
-  if (openpty (&master, &slave, name, termp, winp) == -1)
+  if (openpty (&ptmx, &terminal, name, termp, winp) == -1)
     return -1;
 
-  switch (pid = fork ())
+  switch (pid = __fork ())
     {
     case -1:
-      close (master);
-      close (slave);
+      __close (ptmx);
+      __close (terminal);
       return -1;
     case 0:
       /* Child.  */
-      close (master);
-      if (login_tty (slave))
+      __close (ptmx);
+      if (login_tty (terminal))
 	_exit (1);
 
       return 0;
     default:
       /* Parent.  */
-      *amaster = master;
-      close (slave);
+      *pptmx = ptmx;
+      __close (terminal);
 
       return pid;
     }
 }
+versioned_symbol (libc, __forkpty, forkpty, GLIBC_2_34);
+libc_hidden_ver (__forkpty, forkpty)
+
+#if OTHER_SHLIB_COMPAT (libutil, GLIBC_2_0, GLIBC_2_34)
+compat_symbol (libutil, __forkpty, forkpty, GLIBC_2_0);
+#endif