]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
ptsname_r: Remove support for OSF/1.
authorBruno Haible <bruno@clisp.org>
Tue, 9 Sep 2025 10:44:42 +0000 (12:44 +0200)
committerBruno Haible <bruno@clisp.org>
Tue, 9 Sep 2025 10:44:42 +0000 (12:44 +0200)
* m4/ptsname_r.m4 (gl_FUNC_PTSNAME_R): Remove test for non-standard
signature of ptsname_r.
* lib/ptsname_r.c: Remove code for OSF/1.

ChangeLog
lib/ptsname_r.c
m4/ptsname_r.m4

index 40507fafe123570ec3cbf8d7126c7cbac7d4b5c2..79e32a5d0d47166cc7225c95c94a9995333252ab 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2025-09-09  Bruno Haible  <bruno@clisp.org>
 
+       ptsname_r: Remove support for OSF/1.
+       * m4/ptsname_r.m4 (gl_FUNC_PTSNAME_R): Remove test for non-standard
+       signature of ptsname_r.
+       * lib/ptsname_r.c: Remove code for OSF/1.
+
        *printf-posix: Remove support for OSF/1.
        * m4/printf.m4 (gl_PRINTF_ENOMEM, gl_SNPRINTF_TRUNCATION_C99,
        gl_SNPRINTF_DIRECTIVE_N): Remove cross-compilation guesses for OSF/1.
index 3452afb8448186daf338ea749d8f18dea2ccaed4..3673579a50cc8ae56dd14761b85beaf2b9f64997 100644 (file)
@@ -49,7 +49,7 @@
 # include <stdio.h>
 #endif
 
-#if defined _AIX || defined __osf__
+#if defined _AIX
 /* Get ioctl(), ISPTM.  */
 # include <sys/ioctl.h>
 # include <stdio.h>
@@ -173,7 +173,7 @@ ptsname_r (int fd, char *buf, size_t buflen)
       }
     memcpy (buf, tmpbuf, n + 1);
   }
-# elif defined _AIX || defined __osf__ /* AIX, OSF/1 */
+# elif defined _AIX /* AIX */
   /* This implementation returns /dev/pts/N, like ptsname() does.
      Whereas the generic implementation below returns /dev/ttypN.
      Both are correct, but let's be consistent with ptsname().  */
@@ -189,13 +189,7 @@ ptsname_r (int fd, char *buf, size_t buflen)
     int dev;
     char tmpbuf[9 + 10 + 1];
     int n;
-#  ifdef _AIX
     ret = ioctl (fd, ISPTM, &dev);
-#  endif
-#  ifdef __osf__
-    ret = ioctl (fd, ISPTM, NULL);
-    dev = ret;
-#  endif
     if (ret < 0)
       {
         errno = ENOTTY;
index 5cd6f91a07833de5701460dc4ca90953ae449d0f..f240bac67937ac195ced9124f41d2af04fa5a83a 100644 (file)
@@ -1,5 +1,5 @@
 # ptsname_r.m4
-# serial 11
+# serial 12
 dnl Copyright (C) 2010-2025 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -17,41 +17,15 @@ AC_DEFUN([gl_FUNC_PTSNAME_R],
   if test $ac_cv_func_ptsname_r = no; then
     HAVE_PTSNAME_R=0
   else
-    dnl On OSF/1 5.1, the type of the third argument is 'int', not 'size_t',
-    dnl and the declaration is missing if _REENTRANT is not defined.
-    AC_CACHE_CHECK([whether ptsname_r has the same signature as in glibc],
-      [gl_cv_func_ptsname_r_signature_ok],
-      [AC_COMPILE_IFELSE(
-         [AC_LANG_PROGRAM(
-            [[#include <stddef.h>
-              #include <stdlib.h>
-              /* Test whether ptsname_r is declared at all.  */
-              int (*f) (int, char *, size_t) = ptsname_r;
-              /* Test whether it has the same declaration as in glibc.  */
-              #undef ptsname_r
-              extern
-              #ifdef __cplusplus
-              "C"
-              #endif
-              int ptsname_r (int, char *, size_t);
-            ]],
-            [[return f (0, NULL, 0);]])
-         ],
-         [gl_cv_func_ptsname_r_signature_ok=yes],
-         [gl_cv_func_ptsname_r_signature_ok=no])
-      ])
-    if test $gl_cv_func_ptsname_r_signature_ok = no; then
-      REPLACE_PTSNAME_R=1
-    else
-      AC_DEFINE([HAVE_ESSENTIALLY_WORKING_PTSNAME_R], [1],
-        [Define to 1 if ptsname_r() is essentially working.])
-      dnl On FreeBSD 13.0 and Android 4.3, when ptsname_r fails, it returns -1
-      dnl instead of the error code.
-      AC_REQUIRE([AC_CANONICAL_HOST])
-      AC_CACHE_CHECK([whether ptsname_r returns an error code],
-        [gl_cv_func_ptsname_r_retval_ok],
-        [AC_RUN_IFELSE(
-           [AC_LANG_SOURCE([[
+    AC_DEFINE([HAVE_ESSENTIALLY_WORKING_PTSNAME_R], [1],
+      [Define to 1 if ptsname_r() is essentially working.])
+    dnl On FreeBSD 13.0 and Android 4.3, when ptsname_r fails, it returns -1
+    dnl instead of the error code.
+    AC_REQUIRE([AC_CANONICAL_HOST])
+    AC_CACHE_CHECK([whether ptsname_r returns an error code],
+      [gl_cv_func_ptsname_r_retval_ok],
+      [AC_RUN_IFELSE(
+         [AC_LANG_SOURCE([[
 #include <stdlib.h>
 int
 main (void)
@@ -59,32 +33,31 @@ main (void)
   char buf[80];
   return ptsname_r (-1, buf, sizeof buf) == -1;
 }]])],
-           [gl_cv_func_ptsname_r_retval_ok=yes],
-           [gl_cv_func_ptsname_r_retval_ok=no],
-           [case "$host_os" in
-              dnl Guess no on FreeBSD, Android.
-              freebsd* | dragonfly* | midnightbsd* | linux*-android*)
-                gl_cv_func_ptsname_r_retval_ok="guessing no" ;;
-              dnl Guess yes otherwise.
-              *)
-                gl_cv_func_ptsname_r_retval_ok="guessing yes" ;;
-            esac
-           ])
-        ])
-      case "$gl_cv_func_ptsname_r_retval_ok" in
-        *yes) ;;
-        *) REPLACE_PTSNAME_R=1 ;;
-      esac
-      dnl On NetBSD 10.0, when ptsname_r fails with ERANGE, it clobbers the
-      dnl result buffer. We don't use an AC_RUN_IFELSE test here, because
-      dnl while the bug exists on all platforms, only NetBSD/i386 has the
-      dnl files /dev/ptyp[01] on which the bug becomes apparent.
-      dnl
-      dnl On Solaris 11 OmniOS the result buffer is clobbered as well.
-      case "$host_os" in
-        netbsd* | solaris*) REPLACE_PTSNAME_R=1 ;;
-      esac
-    fi
+         [gl_cv_func_ptsname_r_retval_ok=yes],
+         [gl_cv_func_ptsname_r_retval_ok=no],
+         [case "$host_os" in
+            dnl Guess no on FreeBSD, Android.
+            freebsd* | dragonfly* | midnightbsd* | linux*-android*)
+              gl_cv_func_ptsname_r_retval_ok="guessing no" ;;
+            dnl Guess yes otherwise.
+            *)
+              gl_cv_func_ptsname_r_retval_ok="guessing yes" ;;
+          esac
+         ])
+      ])
+    case "$gl_cv_func_ptsname_r_retval_ok" in
+      *yes) ;;
+      *) REPLACE_PTSNAME_R=1 ;;
+    esac
+    dnl On NetBSD 10.0, when ptsname_r fails with ERANGE, it clobbers the
+    dnl result buffer. We don't use an AC_RUN_IFELSE test here, because
+    dnl while the bug exists on all platforms, only NetBSD/i386 has the
+    dnl files /dev/ptyp[01] on which the bug becomes apparent.
+    dnl
+    dnl On Solaris 11 OmniOS the result buffer is clobbered as well.
+    case "$host_os" in
+      netbsd* | solaris*) REPLACE_PTSNAME_R=1 ;;
+    esac
   fi
 
   AC_REQUIRE([AC_HEADER_MAJOR])