[1/3] login: Hidden prototypes for _getpt, __ptsname_r, grantpt, unlockpt

Message ID d034541e130b49c4b2069f0947328b7d1e60e4c2.1624275874.git.fweimer@redhat.com
State Committed
Commit 8d1f854d60d159931594f31993599b9d9168552b
Delegated to: Adhemerval Zanella Netto
Headers
Series Move libutil into libc |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent

Commit Message

Florian Weimer June 21, 2021, 11:46 a.m. UTC
  ---
 include/stdlib.h                   | 6 ++++++
 login/getpt.c                      | 1 +
 login/grantpt.c                    | 2 +-
 login/ptsname.c                    | 1 +
 sysdeps/mach/hurd/ptsname.c        | 1 +
 sysdeps/unix/bsd/getpt.c           | 3 ++-
 sysdeps/unix/bsd/unlockpt.c        | 1 +
 sysdeps/unix/grantpt.c             | 1 +
 sysdeps/unix/sysv/linux/getpt.c    | 2 ++
 sysdeps/unix/sysv/linux/grantpt.c  | 1 +
 sysdeps/unix/sysv/linux/ptsname.c  | 1 +
 sysdeps/unix/sysv/linux/unlockpt.c | 1 +
 12 files changed, 19 insertions(+), 2 deletions(-)
  

Comments

Adhemerval Zanella June 29, 2021, 1:21 p.m. UTC | #1
LGTM, thanks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

On 21/06/2021 08:46, Florian Weimer via Libc-alpha wrote:
> ---
>  include/stdlib.h                   | 6 ++++++
>  login/getpt.c                      | 1 +
>  login/grantpt.c                    | 2 +-
>  login/ptsname.c                    | 1 +
>  sysdeps/mach/hurd/ptsname.c        | 1 +
>  sysdeps/unix/bsd/getpt.c           | 3 ++-
>  sysdeps/unix/bsd/unlockpt.c        | 1 +
>  sysdeps/unix/grantpt.c             | 1 +
>  sysdeps/unix/sysv/linux/getpt.c    | 2 ++
>  sysdeps/unix/sysv/linux/grantpt.c  | 1 +
>  sysdeps/unix/sysv/linux/ptsname.c  | 1 +
>  sysdeps/unix/sysv/linux/unlockpt.c | 1 +
>  12 files changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/include/stdlib.h b/include/stdlib.h
> index e2453c1896..1f6e1508e4 100644
> --- a/include/stdlib.h
> +++ b/include/stdlib.h
> @@ -137,6 +137,12 @@ libc_hidden_proto (__libc_reallocarray)
>  
>  extern int __libc_system (const char *line);
>  
> +extern __typeof (getpt) __getpt;
> +extern __typeof (ptsname_r) __ptsname_r;
> +libc_hidden_proto (__getpt)
> +libc_hidden_proto (__ptsname_r)
> +libc_hidden_proto (grantpt)
> +libc_hidden_proto (unlockpt)
>  
>  extern double __strtod_internal (const char *__restrict __nptr,
>  				 char **__restrict __endptr, int __group)
> diff --git a/login/getpt.c b/login/getpt.c
> index 585bc3bffd..9b71765705 100644
> --- a/login/getpt.c
> +++ b/login/getpt.c
> @@ -27,6 +27,7 @@ __getpt (void)
>    __set_errno (ENOSYS);
>    return -1;
>  }
> +libc_hidden_def (__getpt)
>  weak_alias (__getpt, getpt)
>  
>  /* We cannot define posix_openpt in general for BSD systems.  */
> diff --git a/login/grantpt.c b/login/grantpt.c
> index 7dc5db3fb7..939096682a 100644
> --- a/login/grantpt.c
> +++ b/login/grantpt.c
> @@ -28,5 +28,5 @@ grantpt (int fd __attribute__ ((unused)))
>    __set_errno (ENOSYS);
>    return -1;
>  }
> -
> +libc_hidden_def (grantpt)
>  stub_warning (grantpt)
> diff --git a/login/ptsname.c b/login/ptsname.c
> index c42f27d07b..ae94fbddf4 100644
> --- a/login/ptsname.c
> +++ b/login/ptsname.c
> @@ -38,6 +38,7 @@ __ptsname_r (int fd __attribute__ ((unused)),
>    __set_errno (ENOSYS);
>    return ENOSYS;
>  }
> +libc_hidden_def (__ptsname_r)
>  weak_alias (__ptsname_r, ptsname_r)
>  
>  stub_warning(ptsname)
> diff --git a/sysdeps/mach/hurd/ptsname.c b/sysdeps/mach/hurd/ptsname.c
> index d5f21a766f..5405b8f981 100644
> --- a/sysdeps/mach/hurd/ptsname.c
> +++ b/sysdeps/mach/hurd/ptsname.c
> @@ -88,4 +88,5 @@ __ptsname_r (int fd, char *buf, size_t buflen)
>  {
>    return __ptsname_internal (fd, buf, buflen, NULL);
>  }
> +libc_hidden_def (__ptsname_r)
>  weak_alias (__ptsname_r, ptsname_r)
> diff --git a/sysdeps/unix/bsd/getpt.c b/sysdeps/unix/bsd/getpt.c
> index 1dde0cc4f1..2fa6632327 100644
> --- a/sysdeps/unix/bsd/getpt.c
> +++ b/sysdeps/unix/bsd/getpt.c
> @@ -20,7 +20,7 @@
>  #include <fcntl.h>
>  #include <string.h>
>  #include <unistd.h>
> -
> +#include <stdlib.h>
>  
>  /* Prefix for master pseudo terminal nodes.  */
>  #define _PATH_PTY "/dev/pty"
> @@ -79,6 +79,7 @@ __getpt (void)
>  {
>    return __bsd_openpt (O_RDWR);
>  }
> +libc_hidden_def (__getpt)
>  weak_alias (__getpt, getpt)
>  
>  int
> diff --git a/sysdeps/unix/bsd/unlockpt.c b/sysdeps/unix/bsd/unlockpt.c
> index 6cfdb93d36..181e615cc6 100644
> --- a/sysdeps/unix/bsd/unlockpt.c
> +++ b/sysdeps/unix/bsd/unlockpt.c
> @@ -39,3 +39,4 @@ unlockpt (int fd)
>      }
>    return __revoke (buf);
>  }
> +libc_hidden_def (unlockpt)
> diff --git a/sysdeps/unix/grantpt.c b/sysdeps/unix/grantpt.c
> index 46b6f56629..6269ee2bd6 100644
> --- a/sysdeps/unix/grantpt.c
> +++ b/sysdeps/unix/grantpt.c
> @@ -258,3 +258,4 @@ grantpt (int fd)
>  
>    return retval;
>  }
> +libc_hidden_def (grantpt)
> diff --git a/sysdeps/unix/sysv/linux/getpt.c b/sysdeps/unix/sysv/linux/getpt.c
> index 784110abbf..52532f7190 100644
> --- a/sysdeps/unix/sysv/linux/getpt.c
> +++ b/sysdeps/unix/sysv/linux/getpt.c
> @@ -19,6 +19,7 @@
>  #include <fcntl.h>
>  #include <unistd.h>
>  #include <paths.h>
> +#include <stdlib.h>
>  
>  /* Path to the master pseudo terminal cloning device.  */
>  #define _PATH_DEVPTMX _PATH_DEV "ptmx"
> @@ -37,4 +38,5 @@ __getpt (void)
>  {
>    return __posix_openpt (O_RDWR);
>  }
> +libc_hidden_def (__getpt)
>  weak_alias (__getpt, getpt)
> diff --git a/sysdeps/unix/sysv/linux/grantpt.c b/sysdeps/unix/sysv/linux/grantpt.c
> index b4addfded9..57e988fe36 100644
> --- a/sysdeps/unix/sysv/linux/grantpt.c
> +++ b/sysdeps/unix/sysv/linux/grantpt.c
> @@ -39,3 +39,4 @@ grantpt (int fd)
>      __set_errno (EINVAL);
>    return ret;
>  }
> +libc_hidden_def (grantpt)
> diff --git a/sysdeps/unix/sysv/linux/ptsname.c b/sysdeps/unix/sysv/linux/ptsname.c
> index b9701da514..9f78ef42d8 100644
> --- a/sysdeps/unix/sysv/linux/ptsname.c
> +++ b/sysdeps/unix/sysv/linux/ptsname.c
> @@ -79,4 +79,5 @@ __ptsname_r (int fd, char *buf, size_t buflen)
>    __set_errno (save_errno);
>    return 0;
>  }
> +libc_hidden_def (__ptsname_r)
>  weak_alias (__ptsname_r, ptsname_r)
> diff --git a/sysdeps/unix/sysv/linux/unlockpt.c b/sysdeps/unix/sysv/linux/unlockpt.c
> index 57d08d8e96..ae5148afe7 100644
> --- a/sysdeps/unix/sysv/linux/unlockpt.c
> +++ b/sysdeps/unix/sysv/linux/unlockpt.c
> @@ -35,3 +35,4 @@ unlockpt (int fd)
>      __set_errno (EINVAL);
>    return ret;
>  }
> +libc_hidden_def (unlockpt)
>
  

Patch

diff --git a/include/stdlib.h b/include/stdlib.h
index e2453c1896..1f6e1508e4 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -137,6 +137,12 @@  libc_hidden_proto (__libc_reallocarray)
 
 extern int __libc_system (const char *line);
 
+extern __typeof (getpt) __getpt;
+extern __typeof (ptsname_r) __ptsname_r;
+libc_hidden_proto (__getpt)
+libc_hidden_proto (__ptsname_r)
+libc_hidden_proto (grantpt)
+libc_hidden_proto (unlockpt)
 
 extern double __strtod_internal (const char *__restrict __nptr,
 				 char **__restrict __endptr, int __group)
diff --git a/login/getpt.c b/login/getpt.c
index 585bc3bffd..9b71765705 100644
--- a/login/getpt.c
+++ b/login/getpt.c
@@ -27,6 +27,7 @@  __getpt (void)
   __set_errno (ENOSYS);
   return -1;
 }
+libc_hidden_def (__getpt)
 weak_alias (__getpt, getpt)
 
 /* We cannot define posix_openpt in general for BSD systems.  */
diff --git a/login/grantpt.c b/login/grantpt.c
index 7dc5db3fb7..939096682a 100644
--- a/login/grantpt.c
+++ b/login/grantpt.c
@@ -28,5 +28,5 @@  grantpt (int fd __attribute__ ((unused)))
   __set_errno (ENOSYS);
   return -1;
 }
-
+libc_hidden_def (grantpt)
 stub_warning (grantpt)
diff --git a/login/ptsname.c b/login/ptsname.c
index c42f27d07b..ae94fbddf4 100644
--- a/login/ptsname.c
+++ b/login/ptsname.c
@@ -38,6 +38,7 @@  __ptsname_r (int fd __attribute__ ((unused)),
   __set_errno (ENOSYS);
   return ENOSYS;
 }
+libc_hidden_def (__ptsname_r)
 weak_alias (__ptsname_r, ptsname_r)
 
 stub_warning(ptsname)
diff --git a/sysdeps/mach/hurd/ptsname.c b/sysdeps/mach/hurd/ptsname.c
index d5f21a766f..5405b8f981 100644
--- a/sysdeps/mach/hurd/ptsname.c
+++ b/sysdeps/mach/hurd/ptsname.c
@@ -88,4 +88,5 @@  __ptsname_r (int fd, char *buf, size_t buflen)
 {
   return __ptsname_internal (fd, buf, buflen, NULL);
 }
+libc_hidden_def (__ptsname_r)
 weak_alias (__ptsname_r, ptsname_r)
diff --git a/sysdeps/unix/bsd/getpt.c b/sysdeps/unix/bsd/getpt.c
index 1dde0cc4f1..2fa6632327 100644
--- a/sysdeps/unix/bsd/getpt.c
+++ b/sysdeps/unix/bsd/getpt.c
@@ -20,7 +20,7 @@ 
 #include <fcntl.h>
 #include <string.h>
 #include <unistd.h>
-
+#include <stdlib.h>
 
 /* Prefix for master pseudo terminal nodes.  */
 #define _PATH_PTY "/dev/pty"
@@ -79,6 +79,7 @@  __getpt (void)
 {
   return __bsd_openpt (O_RDWR);
 }
+libc_hidden_def (__getpt)
 weak_alias (__getpt, getpt)
 
 int
diff --git a/sysdeps/unix/bsd/unlockpt.c b/sysdeps/unix/bsd/unlockpt.c
index 6cfdb93d36..181e615cc6 100644
--- a/sysdeps/unix/bsd/unlockpt.c
+++ b/sysdeps/unix/bsd/unlockpt.c
@@ -39,3 +39,4 @@  unlockpt (int fd)
     }
   return __revoke (buf);
 }
+libc_hidden_def (unlockpt)
diff --git a/sysdeps/unix/grantpt.c b/sysdeps/unix/grantpt.c
index 46b6f56629..6269ee2bd6 100644
--- a/sysdeps/unix/grantpt.c
+++ b/sysdeps/unix/grantpt.c
@@ -258,3 +258,4 @@  grantpt (int fd)
 
   return retval;
 }
+libc_hidden_def (grantpt)
diff --git a/sysdeps/unix/sysv/linux/getpt.c b/sysdeps/unix/sysv/linux/getpt.c
index 784110abbf..52532f7190 100644
--- a/sysdeps/unix/sysv/linux/getpt.c
+++ b/sysdeps/unix/sysv/linux/getpt.c
@@ -19,6 +19,7 @@ 
 #include <fcntl.h>
 #include <unistd.h>
 #include <paths.h>
+#include <stdlib.h>
 
 /* Path to the master pseudo terminal cloning device.  */
 #define _PATH_DEVPTMX _PATH_DEV "ptmx"
@@ -37,4 +38,5 @@  __getpt (void)
 {
   return __posix_openpt (O_RDWR);
 }
+libc_hidden_def (__getpt)
 weak_alias (__getpt, getpt)
diff --git a/sysdeps/unix/sysv/linux/grantpt.c b/sysdeps/unix/sysv/linux/grantpt.c
index b4addfded9..57e988fe36 100644
--- a/sysdeps/unix/sysv/linux/grantpt.c
+++ b/sysdeps/unix/sysv/linux/grantpt.c
@@ -39,3 +39,4 @@  grantpt (int fd)
     __set_errno (EINVAL);
   return ret;
 }
+libc_hidden_def (grantpt)
diff --git a/sysdeps/unix/sysv/linux/ptsname.c b/sysdeps/unix/sysv/linux/ptsname.c
index b9701da514..9f78ef42d8 100644
--- a/sysdeps/unix/sysv/linux/ptsname.c
+++ b/sysdeps/unix/sysv/linux/ptsname.c
@@ -79,4 +79,5 @@  __ptsname_r (int fd, char *buf, size_t buflen)
   __set_errno (save_errno);
   return 0;
 }
+libc_hidden_def (__ptsname_r)
 weak_alias (__ptsname_r, ptsname_r)
diff --git a/sysdeps/unix/sysv/linux/unlockpt.c b/sysdeps/unix/sysv/linux/unlockpt.c
index 57d08d8e96..ae5148afe7 100644
--- a/sysdeps/unix/sysv/linux/unlockpt.c
+++ b/sysdeps/unix/sysv/linux/unlockpt.c
@@ -35,3 +35,4 @@  unlockpt (int fd)
     __set_errno (EINVAL);
   return ret;
 }
+libc_hidden_def (unlockpt)