summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog13
-rw-r--r--generic/tclInt.decls10
-rw-r--r--generic/tclIntPlatDecls.h12
-rw-r--r--unix/Makefile.in4
-rwxr-xr-xunix/configure2
-rw-r--r--unix/tcl.m42
-rw-r--r--win/tclWinError.c33
-rw-r--r--win/tclWinSerial.c2
-rw-r--r--win/tclWinSock.c6
9 files changed, 54 insertions, 30 deletions
diff --git a/ChangeLog b/ChangeLog
index fb79e57..022d1a0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
2012-03-20 Jan Nijtmans <nijtmans@users.sf.net>
+ * generic/tclInt.decls Revert some cygwin-related signature changes from
+ * generic/tclIntPlatDecls.h [835f8e1e9d] (2010-01-22). They were an attempt to
+ * win/tclWinError.c make the cygwin port compile again, but since cygwin
+ is based on unix this serves no purpose any more.
+ * win/tclWinSerial.c: Use EAGAIN in stead of EWOULDBLOCK, because in
+ * win/tclWinSock.c: VS10+ the value of EWOULDBLOCK is no longer the
+ same as EAGAIN
+ * unix/Makefile.in Add tclWinError.c to the CYGWIN build.
+ * unix/tcl.m4
+ * unix/configure
+
+2012-03-20 Jan Nijtmans <nijtmans@users.sf.net>
+
* generic/tcl.decls: [Bug 3508771] load tclreg.dll in cygwin tclsh
* generic/tclInt.decls: Implement TclWinGetPlatformId, Tcl_WinUtfToTChar,
* generic/tclIntPlatDecls.h: Tcl_WinTCharToUtf (and a dummy TclWinCPUID) for
diff --git a/generic/tclInt.decls b/generic/tclInt.decls
index cf88fd3..a476ee8 100644
--- a/generic/tclInt.decls
+++ b/generic/tclInt.decls
@@ -689,12 +689,12 @@ declare 169 {
}
declare 170 {
int TclCheckInterpTraces(Tcl_Interp *interp, const char *command,
- int numChars, Command *cmdPtr, int result, int traceFlags,
+ int numChars, Command *cmdPtr, int result, int traceFlags,
int objc, Tcl_Obj *const objv[])
}
declare 171 {
int TclCheckExecutionTraces(Tcl_Interp *interp, const char *command,
- int numChars, Command *cmdPtr, int result, int traceFlags,
+ int numChars, Command *cmdPtr, int result, int traceFlags,
int objc, Tcl_Obj *const objv[])
}
declare 172 {
@@ -1016,10 +1016,10 @@ interface tclIntPlat
# Windows specific functions
declare 0 win {
- void TclWinConvertError(unsigned long errCode)
+ void TclWinConvertError(DWORD errCode)
}
declare 1 win {
- void TclWinConvertWSAError(unsigned long errCode)
+ void TclWinConvertWSAError(DWORD errCode)
}
declare 2 win {
struct servent *TclWinGetServByName(const char *nm,
@@ -1088,7 +1088,7 @@ declare 19 win {
TclFile TclpOpenFile(const char *fname, int mode)
}
declare 20 win {
- void TclWinAddProcess(void *hProcess, unsigned long id)
+ void TclWinAddProcess(HANDLE hProcess, DWORD id)
}
# removed permanently for 8.4
diff --git a/generic/tclIntPlatDecls.h b/generic/tclIntPlatDecls.h
index 192005c..2169624 100644
--- a/generic/tclIntPlatDecls.h
+++ b/generic/tclIntPlatDecls.h
@@ -94,9 +94,9 @@ EXTERN int TclWinCPUID(unsigned int index, unsigned int *regs);
#endif /* UNIX */
#ifdef __WIN32__ /* WIN */
/* 0 */
-EXTERN void TclWinConvertError(unsigned long errCode);
+EXTERN void TclWinConvertError(DWORD errCode);
/* 1 */
-EXTERN void TclWinConvertWSAError(unsigned long errCode);
+EXTERN void TclWinConvertWSAError(DWORD errCode);
/* 2 */
EXTERN struct servent * TclWinGetServByName(const char *nm,
const char *proto);
@@ -139,7 +139,7 @@ EXTERN TclFile TclpMakeFile(Tcl_Channel channel, int direction);
/* 19 */
EXTERN TclFile TclpOpenFile(const char *fname, int mode);
/* 20 */
-EXTERN void TclWinAddProcess(void *hProcess, unsigned long id);
+EXTERN void TclWinAddProcess(HANDLE hProcess, DWORD id);
/* Slot 21 is reserved */
/* 22 */
EXTERN TclFile TclpCreateTempFile(const char *contents);
@@ -266,8 +266,8 @@ typedef struct TclIntPlatStubs {
int (*tclWinCPUID) (unsigned int index, unsigned int *regs); /* 29 */
#endif /* UNIX */
#ifdef __WIN32__ /* WIN */
- void (*tclWinConvertError) (unsigned long errCode); /* 0 */
- void (*tclWinConvertWSAError) (unsigned long errCode); /* 1 */
+ void (*tclWinConvertError) (DWORD errCode); /* 0 */
+ void (*tclWinConvertWSAError) (DWORD errCode); /* 1 */
struct servent * (*tclWinGetServByName) (const char *nm, const char *proto); /* 2 */
int (*tclWinGetSockOpt) (SOCKET s, int level, int optname, char FAR *optval, int FAR *optlen); /* 3 */
HINSTANCE (*tclWinGetTclInstance) (void); /* 4 */
@@ -286,7 +286,7 @@ typedef struct TclIntPlatStubs {
void (*reserved17)(void);
TclFile (*tclpMakeFile) (Tcl_Channel channel, int direction); /* 18 */
TclFile (*tclpOpenFile) (const char *fname, int mode); /* 19 */
- void (*tclWinAddProcess) (void *hProcess, unsigned long id); /* 20 */
+ void (*tclWinAddProcess) (HANDLE hProcess, DWORD id); /* 20 */
void (*reserved21)(void);
TclFile (*tclpCreateTempFile) (const char *contents); /* 22 */
char * (*tclpGetTZName) (int isdst); /* 23 */
diff --git a/unix/Makefile.in b/unix/Makefile.in
index 0a22a58..81185b4 100644
--- a/unix/Makefile.in
+++ b/unix/Makefile.in
@@ -1541,6 +1541,10 @@ tclMacOSXFCmd.o: $(MAC_OSX_DIR)/tclMacOSXFCmd.c
tclMacOSXNotify.o: $(MAC_OSX_DIR)/tclMacOSXNotify.c
$(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tclMacOSXNotify.c
+# The following is a CYGWIN only source:
+tclWinError.o: $(TOP_DIR)/win/tclWinError.c
+ $(CC) -c $(CC_SWITCHES) $(TOP_DIR)/win/tclWinError.c
+
# DTrace support
$(TCL_OBJS) $(STUB_LIB_OBJS) $(TCLSH_OBJS) $(TCLTEST_OBJS) $(XTTEST_OBJS): @DTRACE_HDR@
diff --git a/unix/configure b/unix/configure
index 72d5d73..e737bd5 100755
--- a/unix/configure
+++ b/unix/configure
@@ -7057,7 +7057,7 @@ fi
SHLIB_CFLAGS=""
SHLIB_LD='${CC} -shared'
SHLIB_SUFFIX=".dll"
- DL_OBJS="tclLoadDl.o"
+ DL_OBJS="tclLoadDl.o tclWinError.o"
DL_LIBS="-ldl"
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""
diff --git a/unix/tcl.m4 b/unix/tcl.m4
index 39f8ca1..f6e002e 100644
--- a/unix/tcl.m4
+++ b/unix/tcl.m4
@@ -1224,7 +1224,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
SHLIB_CFLAGS=""
SHLIB_LD='${CC} -shared'
SHLIB_SUFFIX=".dll"
- DL_OBJS="tclLoadDl.o"
+ DL_OBJS="tclLoadDl.o tclWinError.o"
DL_LIBS="-ldl"
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""
diff --git a/win/tclWinError.c b/win/tclWinError.c
index 4fee02b..1b59dbe 100644
--- a/win/tclWinError.c
+++ b/win/tclWinError.c
@@ -12,11 +12,19 @@
#include "tclInt.h"
+#ifndef WSAEWOULDBLOCK
+# define WSAEWOULDBLOCK 10035L
+#endif
+
+#ifndef __WIN32__
+# define DWORD unsigned int
+#endif
+
/*
* The following table contains the mapping from Win32 errors to errno errors.
*/
-static char errorTable[] = {
+static const unsigned char errorTable[] = {
0,
EINVAL, /* ERROR_INVALID_FUNCTION 1 */
ENOENT, /* ERROR_FILE_NOT_FOUND 2 */
@@ -284,18 +292,16 @@ static char errorTable[] = {
EINVAL, /* 264 */
EINVAL, /* 265 */
EINVAL, /* 266 */
- ENOTDIR, /* ERROR_DIRECTORY 267 */
+ ENOTDIR /* ERROR_DIRECTORY 267 */
};
-static const unsigned int tableLen = sizeof(errorTable);
-
/*
* The following table contains the mapping from WinSock errors to
* errno errors.
*/
-static int wsaErrorTable[] = {
- EWOULDBLOCK, /* WSAEWOULDBLOCK */
+static const unsigned char wsaErrorTable[] = {
+ EAGAIN, /* WSAEWOULDBLOCK */
EINPROGRESS, /* WSAEINPROGRESS */
EALREADY, /* WSAEALREADY */
ENOTSOCK, /* WSAENOTSOCK */
@@ -331,7 +337,7 @@ static int wsaErrorTable[] = {
EUSERS, /* WSAEUSERS */
EDQUOT, /* WSAEDQUOT */
ESTALE, /* WSAESTALE */
- EREMOTE, /* WSAEREMOTE */
+ EREMOTE /* WSAEREMOTE */
};
/*
@@ -352,9 +358,9 @@ static int wsaErrorTable[] = {
void
TclWinConvertError(
- unsigned long errCode) /* Win32 error code. */
+ DWORD errCode) /* Win32 error code. */
{
- if (errCode >= tableLen) {
+ if (errCode >= sizeof(errorTable)/sizeof(errorTable[0])) {
Tcl_SetErrno(EINVAL);
} else {
Tcl_SetErrno(errorTable[errCode]);
@@ -379,12 +385,13 @@ TclWinConvertError(
void
TclWinConvertWSAError(
- unsigned long errCode) /* Win32 error code. */
+ DWORD errCode) /* Win32 error code. */
{
- if ((errCode >= WSAEWOULDBLOCK) && (errCode <= WSAEREMOTE)) {
- Tcl_SetErrno(wsaErrorTable[errCode - WSAEWOULDBLOCK]);
- } else {
+ errCode -= WSAEWOULDBLOCK;
+ if (errCode >= sizeof(wsaErrorTable)/sizeof(wsaErrorTable[0])) {
Tcl_SetErrno(EINVAL);
+ } else {
+ Tcl_SetErrno(wsaErrorTable[errCode]);
}
}
diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c
index 0941d4a..58a9eb4 100644
--- a/win/tclWinSerial.c
+++ b/win/tclWinSerial.c
@@ -1036,7 +1036,7 @@ SerialOutputProc(
* the channel is in non-blocking mode.
*/
- errno = EWOULDBLOCK;
+ errno = EAGAIN;
goto error1;
}
diff --git a/win/tclWinSock.c b/win/tclWinSock.c
index 0c1a270..60cc313 100644
--- a/win/tclWinSock.c
+++ b/win/tclWinSock.c
@@ -1195,7 +1195,7 @@ CreateSocket(
if (connect(sock, addrPtr->ai_addr, addrPtr->ai_addrlen)
== SOCKET_ERROR) {
TclWinConvertWSAError((DWORD) WSAGetLastError());
- if (Tcl_GetErrno() != EWOULDBLOCK) {
+ if (Tcl_GetErrno() != EAGAIN) {
goto looperror;
}
@@ -1389,7 +1389,7 @@ WaitForSocketEvent(
} else if (infoPtr->readyEvents & events) {
break;
} else if (infoPtr->flags & SOCKET_ASYNC) {
- *errorCodePtr = EWOULDBLOCK;
+ *errorCodePtr = EAGAIN;
result = 0;
break;
}
@@ -1913,7 +1913,7 @@ TcpOutputProc(
if (error == WSAEWOULDBLOCK) {
infoPtr->readyEvents &= ~(FD_WRITE);
if (infoPtr->flags & SOCKET_ASYNC) {
- *errorCodePtr = EWOULDBLOCK;
+ *errorCodePtr = EAGAIN;
bytesWritten = -1;
break;
}