error, strerror-override: Support new errno values from POSIX:2008.
authorBruno Haible <bruno@clisp.org>
Sun, 3 Jun 2012 13:47:14 +0000 (15:47 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 3 Jun 2012 15:27:30 +0000 (17:27 +0200)
* m4/errno_h.m4 (gl_HEADER_ERRNO_H): Test also EOWNERDEAD and
ENOTRECOVERABLE.
* lib/errno.in.h (EOWNERDEAD, ENOTRECOVERABLE): Define on all
platforms.
* lib/strerror-override.c (strerror_override): Conditionalize the
EOWNERDEAD, ENOTRECOVERABLE handling on GNULIB_defined_EOWNERDEAD.
* lib/strerror-override.h (strerror_override): Declare also if
GNULIB_defined_EOWNERDEAD is defined.
* tests/test-errno.c (e130, e131): New variables.
* doc/posix-headers/errno.texi: Mention the status for EOWNERDEAD,
ENOTRECOVERABLE.
Reported by Paolo Bonzini.

ChangeLog
doc/posix-headers/errno.texi
lib/errno.in.h
lib/strerror-override.c
lib/strerror-override.h
m4/errno_h.m4
tests/test-errno.c

index fa51591..559f455 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2012-06-03  Bruno Haible  <bruno@clisp.org>
+
+       error, strerror-override: Support new errno values from POSIX:2008.
+       * m4/errno_h.m4 (gl_HEADER_ERRNO_H): Test also EOWNERDEAD and
+       ENOTRECOVERABLE.
+       * lib/errno.in.h (EOWNERDEAD, ENOTRECOVERABLE): Define on all
+       platforms.
+       * lib/strerror-override.c (strerror_override): Conditionalize the
+       EOWNERDEAD, ENOTRECOVERABLE handling on GNULIB_defined_EOWNERDEAD.
+       * lib/strerror-override.h (strerror_override): Declare also if
+       GNULIB_defined_EOWNERDEAD is defined.
+       * tests/test-errno.c (e130, e131): New variables.
+       * doc/posix-headers/errno.texi: Mention the status for EOWNERDEAD,
+       ENOTRECOVERABLE.
+       Reported by Paolo Bonzini.
+
 2012-05-31  Jim Meyering  <meyering@redhat.com>
 
        savewd: add missing dependency on sys_wait module
index 799b42e..58ee8b3 100644 (file)
@@ -37,6 +37,11 @@ The macros @code{EWOULDBLOCK}, @code{ETXTBSY}, @code{ELOOP}, @code{ENOTSOCK},
 @code{ETIMEDOUT}, @code{ECONNREFUSED}, @code{EHOSTUNREACH}, @code{EALREADY},
 @code{EINPROGRESS} are not defined on some platforms:
 mingw, MSVC 9.
+@item
+The macros @code{EOWNERDEAD}, @code{ENOTRECOVERABLE} are not defined on
+some platforms:
+glibc/Linux 2.3.6, glibc/Hurd 2.15, glibc/kFreeBSD 2.15,
+MacOS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Cygwin, mingw without pthreads-win32, MSVC 9, Interix 3.5, BeOS.
 @end itemize
 
 Portability problems not fixed by Gnulib:
index 6ccccf3..84d79ac 100644 (file)
 #   define GNULIB_defined_ECANCELED 1
 #  endif
 
+#  ifndef EOWNERDEAD
+#   define EOWNERDEAD      133
+#   define ENOTRECOVERABLE 127
+#   define GNULIB_defined_EOWNERDEAD 1
+#  endif
+
 #  ifndef EINPROGRESS
 #   define EINPROGRESS     112
 #   define EALREADY        103
 #   define ENODATA         120  /* not required by POSIX */
 #   define ENOSR           124  /* not required by POSIX */
 #   define ENOSTR          125  /* not required by POSIX */
-#   define ENOTRECOVERABLE 127  /* not required by POSIX */
-#   define EOWNERDEAD      133  /* not required by POSIX */
 #   define ETIME           137  /* not required by POSIX */
 #   define EOTHER          131  /* not required by POSIX */
 #   define GNULIB_defined_ESOCK 1
 #  define GNULIB_defined_ECANCELED 1
 # endif
 
+/* On many platforms, the macros EOWNERDEAD and ENOTRECOVERABLE are not
+   defined.  */
+
+# ifndef EOWNERDEAD
+#  if defined __sun
+    /* Use the same values as defined for Solaris >= 8, for
+       interoperability.  */
+#   define EOWNERDEAD      58
+#   define ENOTRECOVERABLE 59
+#  elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+    /* We have a conflict here: pthreads-win32 defines these values
+       differently than MSVC 10.  It's hairy to decide which one to use.  */
+#   if defined __MINGW32__ && !defined USE_WINDOWS_THREADS
+     /* Use the same values as defined by pthreads-win32, for
+        interoperability.  */
+#    define EOWNERDEAD      43
+#    define ENOTRECOVERABLE 44
+#   else
+     /* Use the same values as defined by MSVC 10, for
+        interoperability.  */
+#    define EOWNERDEAD      133
+#    define ENOTRECOVERABLE 127
+#   endif
+#  else
+#   define EOWNERDEAD      2013
+#   define ENOTRECOVERABLE 2014
+#  endif
+#  define GNULIB_defined_EOWNERDEAD 1
+# endif
 
 #endif /* _@GUARD_PREFIX@_ERRNO_H */
 #endif /* _@GUARD_PREFIX@_ERRNO_H */
index 9ca6523..b47238c 100644 (file)
@@ -97,10 +97,6 @@ strerror_override (int errnum)
       return "Out of streams resources";
     case ENOSTR:
       return "Device not a stream";
-    case ENOTRECOVERABLE:
-      return "State not recoverable";
-    case EOWNERDEAD:
-      return "Owner died";
     case ETIME:
       return "Timer expired";
     case EOTHER:
@@ -283,6 +279,13 @@ strerror_override (int errnum)
       return "Operation canceled";
 #endif
 
+#if GNULIB_defined_EOWNERDEAD
+    case EOWNERDEAD:
+      return "Owner died";
+    case ENOTRECOVERABLE:
+      return "State not recoverable";
+#endif
+
     default:
       return NULL;
     }
index 09526ea..a41afa7 100644 (file)
@@ -43,7 +43,8 @@
      || GNULIB_defined_ECONNABORTED \
      || GNULIB_defined_ESTALE \
      || GNULIB_defined_EDQUOT \
-     || GNULIB_defined_ECANCELED
+     || GNULIB_defined_ECANCELED \
+     || GNULIB_defined_EOWNERDEAD
 extern const char *strerror_override (int errnum);
 # else
 #  define strerror_override(ignored) NULL
index 4f0bb83..521e76e 100644 (file)
@@ -1,4 +1,4 @@
-# errno_h.m4 serial 10
+# errno_h.m4 serial 11
 dnl Copyright (C) 2004, 2006, 2008-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -49,6 +49,12 @@ booboo
 #if !defined ECANCELED
 booboo
 #endif
+#if !defined EOWNERDEAD
+booboo
+#endif
+#if !defined ENOTRECOVERABLE
+booboo
+#endif
       ],
       [gl_cv_header_errno_h_complete=no],
       [gl_cv_header_errno_h_complete=yes])
index d9a030f..8d00717 100644 (file)
@@ -98,6 +98,8 @@ int e115 = EINPROGRESS;
 int e116 = ESTALE;
 int e122 = EDQUOT;
 int e125 = ECANCELED;
+int e130 = EOWNERDEAD;
+int e131 = ENOTRECOVERABLE;
 
 /* Don't verify that these errno values are all different, except for possibly
    EWOULDBLOCK == EAGAIN.  Even Linux/x86 does not pass this check: it has