]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
termios: make __tcsetattr() the internal interface
authorH. Peter Anvin (Intel) <hpa@zytor.com>
Thu, 12 Jun 2025 01:35:32 +0000 (18:35 -0700)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 17 Jun 2025 12:11:38 +0000 (09:11 -0300)
There is a prototype for an internal __tcsetattr() function in
include/termios.h, but tcsetattr without __ were still declared as the
actual functions.

Make this match the comment and make __tcsetattr() an internal
interface. This will be required to version struct termios for Linux on
MIPS and SPARC.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
include/termios.h
login/openpty.c
misc/getpass.c
sysdeps/unix/bsd/tcsetattr.c
sysdeps/unix/sysv/linux/tcsetattr.c
termios/tcsetattr.c

index e2c35ebbae0967bcf5fc97bf26a7c2819c0f2def..a79da7a1f379e97c3271ac67c5aac92b7186a486 100644 (file)
@@ -10,7 +10,7 @@ extern int __tcsetattr (int __fd, int __optional_actions,
 extern int __libc_tcdrain (int __fd);
 
 libc_hidden_proto (__tcgetattr)
-libc_hidden_proto (tcsetattr)
+libc_hidden_proto (__tcsetattr)
 libc_hidden_proto (cfsetispeed)
 libc_hidden_proto (cfsetospeed)
 
index fc45add3df44e8c58e99f4ab28762f001663f240..f7fd6b7384e671565227dc80e035be844f5e3ccd 100644 (file)
@@ -124,7 +124,7 @@ __openpty (int *pptmx, int *pterminal, char *name,
 
   /* XXX Should we ignore errors here?  */
   if (termp)
-    tcsetattr (terminal, TCSAFLUSH, termp);
+    __tcsetattr (terminal, TCSAFLUSH, termp);
 #ifdef TIOCSWINSZ
   if (winp)
     __ioctl (terminal, TIOCSWINSZ, winp);
index 4fe94537b9268c5b0e071a90ce2b83d35c488e73..a68acf483a2009c23180312e2f34e4dd20375e15 100644 (file)
@@ -83,7 +83,7 @@ getpass (const char *prompt)
       s = t;
       /* Tricky, tricky. */
       t.c_lflag &= ~(ECHO|ISIG);
-      tty_changed = (tcsetattr (fileno (in), TCSAFLUSH|TCSASOFT, &t) == 0);
+      tty_changed = (__tcsetattr (fileno (in), TCSAFLUSH|TCSASOFT, &t) == 0);
     }
   else
     tty_changed = 0;
@@ -110,7 +110,7 @@ getpass (const char *prompt)
 
   /* Restore the original setting.  */
   if (tty_changed)
-    (void) tcsetattr (fileno (in), TCSAFLUSH|TCSASOFT, &s);
+    (void) __tcsetattr (fileno (in), TCSAFLUSH|TCSASOFT, &s);
 
   funlockfile (out);
 
index 38b5f71da27e21f01b6d16d6821356ac8432e020..8693d943e7fe030fd2e20fee690d8a39dc1a9c26 100644 (file)
@@ -32,7 +32,7 @@
 
 /* Set the state of FD to *TERMIOS_P.  */
 int
-tcsetattr (int fd, int optional_actions, const struct termios *termios_p)
+__tcsetattr (int fd, int optional_actions, const struct termios *termios_p)
 {
   struct termios myt;
 
@@ -56,4 +56,6 @@ tcsetattr (int fd, int optional_actions, const struct termios *termios_p)
       return __ioctl (fd, TIOCSETAF, termios_p);
     }
 }
-libc_hidden_def (tcsetattr)
+
+libc_hidden_def (__tcsetattr)
+weak_alias (__tcsetattr, tcsetattr)
index 5a13ad879047a2789ba435b31d0830131cdfc923..49d9d245a06795d37da7846b70abb09770d70c2c 100644 (file)
@@ -77,5 +77,5 @@ __tcsetattr (int fd, int optional_actions, const struct termios *termios_p)
 
   return INLINE_SYSCALL (ioctl, 3, fd, cmd, &k_termios);
 }
+libc_hidden_def (__tcsetattr)
 weak_alias (__tcsetattr, tcsetattr)
-libc_hidden_def (tcsetattr)
index 30bc6d64b95d73594bae9b2f7e89c0c5acf7e30d..f0756be9fec3aea57fd713401cb216c7e6249407 100644 (file)
@@ -23,7 +23,7 @@ static int bad_speed (speed_t speed);
 
 /* Set the state of FD to *TERMIOS_P.  */
 int
-tcsetattr (int fd, int optional_actions, const struct termios *termios_p)
+__tcsetattr (int fd, int optional_actions, const struct termios *termios_p)
 {
   if (fd < 0)
     {
@@ -57,7 +57,8 @@ tcsetattr (int fd, int optional_actions, const struct termios *termios_p)
   __set_errno (ENOSYS);
   return -1;
 }
-libc_hidden_def (tcsetattr)
+libc_hidden_def (__tcsetattr)
+weak_alias (__tcsetattr, tcsetattr)
 
 /* Strychnine checking.  */
 static int