This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fwd: Cygwin64: errno.h error values


Hi all,

Comparing errno.h from cygwin with the ones from mingw(-64) and VS10, the first
ones on the list have equal values, but later on values are diverging. I already
reported that to the mingw-w64 people, and they adapted the list making
it the same as VS10. See:
    <http://sourceforge.net/tracker/?func=detail&atid=983354&aid=3448042&group_id=202880>

Cygwin apparently started with initial values of some early Visual
Studio, and added
the missing ones, using succeeding values. Having different values in Cygwin and
MS might cause unexpected problems: every time when transferring error-codes
between some MS dll and cygwin, proper translation must be done between the
two domains when the error-codes are different.

Wouldn't it be a lot easier when Cygwin started to use the same error-values
than Visual Studio? Then the mingw-w64 cross-compiler doesn't need its own
errno.h (or sys/errno.h) any more, the one from cygwin would work fine as well.
And mingw-w64 would not need constructs like:
    #ifndef EAFNOSUPPORT
    #define EAFNOSUPPORT 102
    #endif
something they only do because of possible conflicting definitions in
mingw/cygwin.

Now that Cygwin64 is not officially released yet, I hope it is not too
late yet to
change this: I realize this is a binary incompatibility and all packages need
to be recompiled.

Here is a test program (main.c) which - when compiled with VS10+ -
just outputs "THE END". It can be used to test whether all errno
values are really the same as the ones from VS10+. I also included
a patch for sys/errno.h, which changes the errno values to be
the same as the values from Visual Studio.

Regards,
           Jan Nijtmans

Attachment: errno.h.diff
Description: Binary data

#include <errno.h>
#include <stdio.h>
void main() {
    int i, a[] = {EADDRINUSE,EADDRNOTAVAIL,EAFNOSUPPORT,EALREADY,EBADMSG,
        ECANCELED,ECONNABORTED,ECONNREFUSED,ECONNRESET,EDESTADDRREQ,
        EHOSTUNREACH,EIDRM,EINPROGRESS,EISCONN,ELOOP, EMSGSIZE,ENETDOWN,
        ENETRESET,ENETUNREACH,ENOBUFS,ENODATA,ENOLINK,ENOMSG,ENOPROTOOPT,
        ENOSR,ENOSTR,ENOTCONN,ENOTRECOVERABLE,ENOTSOCK,ENOTSUP,EOPNOTSUPP,
        131,EOVERFLOW,EOWNERDEAD,EPROTO,EPROTONOSUPPORT,EPROTOTYPE,ETIME,
        ETIMEDOUT,ETXTBSY,EWOULDBLOCK};
    for (i = 0; i <= 40; i++) {
        if (a[i]!=100+i) printf("expected %d but was %d\n",100+i,a[i]);
    }
    printf("THE END\n");
}
--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]