Mercurial > hg > octave-lyh > gnulib-hg
changeset 16891:e98619449f63
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.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sun, 03 Jun 2012 15:47:14 +0200 |
parents | 663c3bea50ab |
children | 75dd3fc6e824 |
files | 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 |
diffstat | 7 files changed, 74 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- a/doc/posix-headers/errno.texi +++ b/doc/posix-headers/errno.texi @@ -37,6 +37,11 @@ @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:
--- a/lib/errno.in.h +++ b/lib/errno.in.h @@ -84,6 +84,12 @@ # 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 @@ -112,8 +118,6 @@ # 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 @@ -227,6 +231,35 @@ # 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 */
--- a/lib/strerror-override.c +++ b/lib/strerror-override.c @@ -97,10 +97,6 @@ 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 @@ return "Operation canceled"; #endif +#if GNULIB_defined_EOWNERDEAD + case EOWNERDEAD: + return "Owner died"; + case ENOTRECOVERABLE: + return "State not recoverable"; +#endif + default: return NULL; }
--- a/lib/strerror-override.h +++ b/lib/strerror-override.h @@ -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
--- a/m4/errno_h.m4 +++ b/m4/errno_h.m4 @@ -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 @@ #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])
--- a/tests/test-errno.c +++ b/tests/test-errno.c @@ -98,6 +98,8 @@ 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