[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] fix errno for MinGW64
From: |
Bruno Haible |
Subject: |
Re: [PATCH] fix errno for MinGW64 |
Date: |
Sun, 03 Jun 2012 18:40:12 +0200 |
User-agent: |
KMail/4.7.4 (Linux/3.1.10-1.9-desktop; KDE/4.7.4; x86_64; ; ) |
Hi Paolo,
Sorry for the delay.
> * m4/errno_h.m4: Mark errno.h as incomplete if it lacks any of
> EINPROGRESS, ENOSR, ENOSTR, ENOTRECOVERABLE, ETIME, ETXTBSY.
OK for EINPROGRESS, ENOTRECOVERABLE, ETXTBSY. But in
<http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html>
the identifiers ENODATA, ENOSR, ENOSTR, ETIME are marked as being part
of the "STREAMS" part of POSIX, which few systems implement. I don't see
a reason to have gnulib implement replacements for STREAMS since that
will never be portable anyway.
EINPROGRESS, ETXTBUSY were already in gnulib's testsuite. ENOTRECOVERABLE
and EOWNERDEAD were not, because they were only added in POSIX:2008. So
if we want ENOTRECOVERABLE to be supported, let's do it also for EOWNERDEAD,
and update the doc and test suite. So far, only Linux, Solaris, and mingw64
with pthreads-win32 have these errno values. Patch attached below.
For the rest, I wish minimal changes. So first enumerate the problems one
by one:
- Fedora mingw64 defines EOWNERDEAD, but not ENOTRECOVERABLE.
- Among the "# ifndef EINPROGRESS" block, Fedora mingw64 defines all except
ETXTBSY, ENODATA. ENOSR, ENOSTR, ETIME, EOTHER.
Each of these corresponds to a small patch. I think the sum of these changes
is smaller than your proposed patch, but should nevertheless work fine with
Fedoda-mingw64.
> +# ifndef ENODATA
> +# define ENODATA 2013
> +# define GNULIB_defined_ENODATA 1
> +# endif
> +
> +# ifndef ENOSR
> +# define ENOSR 2013
> +# define GNULIB_defined_ENOSR 1
> +# endif
You use the same replacement value for ENODATA and ENOSR?
2012-06-03 Bruno Haible <address@hidden>
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.
--- doc/posix-headers/errno.texi.orig Sun Jun 3 15:41:57 2012
+++ doc/posix-headers/errno.texi Sun Jun 3 14:40:59 2012
@@ -37,6 +37,11 @@
@code{ETIMEDOUT}, @code{ECONNREFUSED}, @code{EHOSTUNREACH}, @code{EALREADY},
@code{EINPROGRESS} are not defined on some platforms:
mingw, MSVC 9.
address@hidden
+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:
--- lib/errno.in.h.orig Sun Jun 3 15:41:57 2012
+++ lib/errno.in.h Sun Jun 3 15:19:21 2012
@@ -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 /* address@hidden@_ERRNO_H */
#endif /* address@hidden@_ERRNO_H */
--- lib/strerror-override.c.orig Sun Jun 3 15:41:57 2012
+++ lib/strerror-override.c Sun Jun 3 15:02:45 2012
@@ -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;
}
--- lib/strerror-override.h.orig Sun Jun 3 15:41:57 2012
+++ lib/strerror-override.h Sun Jun 3 14:44:02 2012
@@ -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
--- m4/errno_h.m4.orig Sun Jun 3 15:41:57 2012
+++ m4/errno_h.m4 Sun Jun 3 14:42:10 2012
@@ -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])
--- tests/test-errno.c.orig Sun Jun 3 15:41:57 2012
+++ tests/test-errno.c Sun Jun 3 14:40:43 2012
@@ -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
2012-05-21 Paolo Bonzini <address@hidden>
Bruno Haible <address@hidden>
error, strerror-override: Support mingw64 from Fedora 17.
* lib/errno.in.h (GNULIB_defined_ENOTRECOVERABLE): Use a different
indicator for ENOTRECOVERABLE, compared to EOWNERDEAD.
* lib/strerror-override.h (strerror_override): Test it.
* lib/strerror-override.c (strerror_override): Likewise.
--- lib/errno.in.h.orig Sun Jun 3 17:57:03 2012
+++ lib/errno.in.h Sun Jun 3 17:53:22 2012
@@ -85,11 +85,15 @@
# endif
# ifndef EOWNERDEAD
-# define EOWNERDEAD 133
-# define ENOTRECOVERABLE 127
+# define EOWNERDEAD 133
# define GNULIB_defined_EOWNERDEAD 1
# endif
+# ifndef ENOTRECOVERABLE
+# define ENOTRECOVERABLE 127
+# define GNULIB_defined_ENOTRECOVERABLE 1
+# endif
+
# ifndef EINPROGRESS
# define EINPROGRESS 112
# define EALREADY 103
@@ -259,6 +263,7 @@
# define ENOTRECOVERABLE 2014
# endif
# define GNULIB_defined_EOWNERDEAD 1
+# define GNULIB_defined_ENOTRECOVERABLE 1
# endif
#endif /* address@hidden@_ERRNO_H */
--- lib/strerror-override.c.orig Sun Jun 3 17:57:03 2012
+++ lib/strerror-override.c Sun Jun 3 17:34:21 2012
@@ -282,6 +282,9 @@
#if GNULIB_defined_EOWNERDEAD
case EOWNERDEAD:
return "Owner died";
+#endif
+
+#if GNULIB_defined_ENOTRECOVERABLE
case ENOTRECOVERABLE:
return "State not recoverable";
#endif
--- lib/strerror-override.h.orig Sun Jun 3 17:57:03 2012
+++ lib/strerror-override.h Sun Jun 3 17:33:51 2012
@@ -44,7 +44,8 @@
|| GNULIB_defined_ESTALE \
|| GNULIB_defined_EDQUOT \
|| GNULIB_defined_ECANCELED \
- || GNULIB_defined_EOWNERDEAD
+ || GNULIB_defined_EOWNERDEAD \
+ || GNULIB_defined_ENOTRECOVERABLE
extern const char *strerror_override (int errnum);
# else
# define strerror_override(ignored) NULL
2012-05-21 Paolo Bonzini <address@hidden>
Bruno Haible <address@hidden>
error, strerror-override: Support mingw64 from Fedora 17.
* lib/errno.in.h (GNULIB_defined_ESTREAMS): Use a different indicator
for ETXTBSY, ENODATA, ENOSR, ENOSTR, ETIME, EOTHER, compared to
EINPROGRESS.
* lib/strerror-override.h (strerror_override): Test it.
* lib/strerror-override.c (strerror_override): Likewise.
* m4/errno_h.m4 (gl_HEADER_ERRNO_H): Test also ETXTBSY.
--- lib/errno.in.h.orig Sun Jun 3 18:25:35 2012
+++ lib/errno.in.h Sun Jun 3 18:22:25 2012
@@ -118,13 +118,17 @@
# define ELOOP 114
# define EHOSTUNREACH 110
# define EWOULDBLOCK 140
+# define GNULIB_defined_ESOCK 1
+# endif
+
+# ifndef ETXTBSY
# define ETXTBSY 139
# define ENODATA 120 /* not required by POSIX */
# define ENOSR 124 /* not required by POSIX */
# define ENOSTR 125 /* 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_ESTREAMS 1
# endif
/* These are intentionally the same values as the WSA* error numbers, defined
--- lib/strerror-override.c.orig Sun Jun 3 18:25:35 2012
+++ lib/strerror-override.c Sun Jun 3 18:23:54 2012
@@ -89,6 +89,8 @@
return "No route to host";
case EWOULDBLOCK:
return "Operation would block";
+#endif
+#if GNULIB_defined_ESTREAMS /* native Windows platforms with older <errno.h> */
case ETXTBSY:
return "Text file busy";
case ENODATA:
--- lib/strerror-override.h.orig Sun Jun 3 18:25:35 2012
+++ lib/strerror-override.h Sun Jun 3 18:22:41 2012
@@ -30,6 +30,7 @@
describing the error. Otherwise return NULL. */
# if REPLACE_STRERROR_0 \
|| GNULIB_defined_ESOCK \
+ || GNULIB_defined_ESTREAMS \
|| GNULIB_defined_EWINSOCK \
|| GNULIB_defined_ENOMSG \
|| GNULIB_defined_EIDRM \
--- m4/errno_h.m4.orig Sun Jun 3 18:25:35 2012
+++ m4/errno_h.m4 Sun Jun 3 18:25:19 2012
@@ -10,6 +10,9 @@
AC_CACHE_CHECK([for complete errno.h], [gl_cv_header_errno_h_complete], [
AC_EGREP_CPP([booboo],[
#include <errno.h>
+#if !defined ETXTBSY
+booboo
+#endif
#if !defined ENOMSG
booboo
#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [PATCH] fix errno for MinGW64,
Bruno Haible <=