Tcl Source Code

View Ticket
Login
Ticket UUID: 3019634
Title: errno.h and tclWinPort.h have conflicting defintiions.
Type: Patch Version: None
Submitter: glawlor Created on: 2010-06-22 14:08:14
Subsystem: 52. Portability Support Assigned To: nijtmans
Priority: 9 Immediate Severity:
Status: Closed Last Modified: 2010-06-28 15:50:43
Resolution: Fixed Closed By: nijtmans
    Closed on: 2010-06-28 08:50:43
Description:
MS VC++ 2010 errno.h and tclWinPort.h have conflicting defintiions.

tclWinPort.h:

ln144:  #   define ESOCKTNOSUPPORT 121
ln150:  #   define EPFNOSUPPORT123

errno.h

ln 113:  #define ENOLINK         121
ln 115:  #define ENOPROTOOPT     123
User Comments: nijtmans added on 2010-06-28 15:50:43:

allow_comments - 1

Thanks to you, glawlor, for bringing this to my attention!
Now backported to Tcl 8.4 as well.

While on it, discovered various typing mistakes in the message,
and a bug in the last line:
    return strerror(errno);
should have been:
    return strerror(err);
Fixed that as well.

In trunk, added messages for ECANCELED,
ENOTRECOVERABLE, EOTHER and EOWNERDEAD,
which were still missing.

glawlor added on 2010-06-27 12:59:22:
I've just tested core-8-5-branch and it's fine too with your patch to tclPosixStr.c

Thanks

nijtmans added on 2010-06-24 21:27:10:
Great, thanks for testing!

For Tcl 8.5, change of errno values is not
something expected in a patch release.
Therefore, I resolved the conflict there
in a different way. I would appreciate
it, if you could test the top of the
core-8.5 branch as well.

glawlor added on 2010-06-24 21:15:59:
The new patch is good for vc+2010. There's nothing problematic with the definitions now that I can see . 

Thanks!

nijtmans added on 2010-06-24 19:40:07:
.... or simply use the WSA equivalent.  New patch attached.

Question to glawlor: Do the definitions of ENOTEMPTY,
EREMOTE and EPFNOSUPPORT - which I got
from cygwin - comflict with anything problematic,
or should I better use the WSA equivalent there too?

nijtmans added on 2010-06-24 19:37:20:

File Added - 378260: win.patch

nijtmans added on 2010-06-24 19:35:35:

File Deleted - 378152:

dkf added on 2010-06-24 16:01:09:
Since we're talking int values, why not just add a million or something? We truly don't need them to be contiguous (nor do we need them to fit in in a char).

glawlor added on 2010-06-24 13:16:27:
Tried the new patch - got some collisions in tclPosixStr.c now:

\tcl\win\..\generic\tclPosixStr.c(242) : error C2196: case value '117' already used
\tcl\win\..\generic\tclPosixStr.c(341) : error C2196: case value '132' already used
\tcl\win\..\generic\tclPosixStr.c(404) : error C2196: case value '110' already used
\tcl\win\..\generic\tclPosixStr.c(407) : error C2196: case value '124' already used
\tcl\win\..\generic\tclPosixStr.c(431) : error C2196: case value '129' already used
\tcl\win\..\generic\tclPosixStr.c(690) : error C2196: case value '117' already used
\tcl\win\..\generic\tclPosixStr.c(789) : error C2196: case value '132' already used
\tcl\win\..\generic\tclPosixStr.c(852) : error C2196: case value '110' already used
\tcl\win\..\generic\tclPosixStr.c(855) : error C2196: case value '124' already used
\tcl\win\..\generic\tclPosixStr.c(879) : error C2196: case value '129' already used
NMAKE : fatal error U1077: 
'"C:\Program Files\Microsoft Visual Studio 10.0\VC\BIN\cl.EXE"' : return code '0x2'
Stop.

Here's a snippet of the posix defs from VC++2010 errno.h:

/* POSIX SUPPLEMENT */
#define EADDRINUSE      100
#define EADDRNOTAVAIL   101
#define EAFNOSUPPORT    102
#define EALREADY        103
#define EBADMSG         104
#define ECANCELED       105
#define ECONNABORTED    106
#define ECONNREFUSED    107
#define ECONNRESET      108
#define EDESTADDRREQ    109
#define EHOSTUNREACH    110
#define EIDRM           111
#define EINPROGRESS     112
#define EISCONN         113
#define ELOOP           114
#define EMSGSIZE        115
#define ENETDOWN        116
#define ENETRESET       117
#define ENETUNREACH     118
#define ENOBUFS         119
#define ENODATA         120
#define ENOLINK         121
#define ENOMSG          122
#define ENOPROTOOPT     123
#define ENOSR           124
#define ENOSTR          125
#define ENOTCONN        126
#define ENOTRECOVERABLE 127
#define ENOTSOCK        128
#define ENOTSUP         129
#define EOPNOTSUPP      130
#define EOTHER          131
#define EOVERFLOW       132
#define EOWNERDEAD      133
#define EPROTO          134
#define EPROTONOSUPPORT 135
#define EPROTOTYPE      136
#define ETIME           137
#define ETIMEDOUT       138
#define ETXTBSY         139
#define EWOULDBLOCK     140

nijtmans added on 2010-06-23 21:32:42:

File Added - 378152: win.patch

nijtmans added on 2010-06-23 21:32:08:
There is more to it:
- Nowadays we have cygwin and mingw, it is useful that
  the chosen numbers match with cygwin/mingw as
  much as possible.
So, I looked at it, and came to the following patch.

I don't have VC++ 2010, please check if this patch
works there! (sorting not done yet, but will do....)
Any remarks welcome!

dkf added on 2010-06-23 16:33:40:
This ought to be sorted.

glawlor added on 2010-06-22 21:08:14:

File Added - 378044: tclWinPort.h.patch

Attachments: