Index: doc/SetErrno.3 ================================================================== --- doc/SetErrno.3 +++ doc/SetErrno.3 @@ -6,11 +6,11 @@ '\" .TH Tcl_SetErrno 3 8.3 Tcl "Tcl Library Procedures" .so man.macros .BS .SH NAME -Tcl_SetErrno, Tcl_GetErrno, Tcl_ErrnoId, Tcl_ErrnoMsg \- manipulate errno to store and retrieve error codes +Tcl_SetErrno, Tcl_GetErrno, Tcl_ErrnoId, Tcl_ErrnoMsg, Tcl_WinConvertError \- manipulate errno to store and retrieve error codes .SH SYNOPSIS .nf \fB#include \fR .sp \fBTcl_SetErrno\fR(\fIerrorCode\fR) @@ -21,15 +21,21 @@ const char * \fBTcl_ErrnoId\fR() .sp const char * \fBTcl_ErrnoMsg\fR(\fIerrorCode\fR) +.sp +void +\fBTcl_WinConvertError\fR(\fIwinErrorCode\fR) .fi .SH ARGUMENTS .AS int errorCode .AP int errorCode in A POSIX error code such as \fBENOENT\fR. +.AS unsigned int winErrorCode in +.AP DWORD winErrorCode in +A Windows or Winsock error code such as \fBERROR_FILE_NOT_FOUND\fR. .BE .SH DESCRIPTION .PP \fBTcl_SetErrno\fR and \fBTcl_GetErrno\fR provide portable access @@ -58,8 +64,11 @@ that corresponds to the value of its \fIerrorCode\fR argument. The \fIerrorCode\fR argument is typically the value returned by \fBTcl_GetErrno\fR. The strings returned by these functions are statically allocated and the caller must not free or modify them. +.PP +\fBTcl_WinConvertError\fR (Windows only) maps the passed Windows or Winsock +error code to a POSIX error and stores it in \fBerrno\fR. .SH KEYWORDS errno, error code, global variables Index: tests/socket.test ================================================================== --- tests/socket.test +++ tests/socket.test @@ -2396,13 +2396,15 @@ } -result {{} ok} test socket-14.11.0 {pending [socket -async] and nonblocking [puts], no listener, no flush} \ -constraints {socket notWinCI} \ -body { set sock [socket -async localhost [randport]] + fileevent $sock writable {incr x} + vwait x fconfigure $sock -blocking 0 puts $sock ok - fileevent $sock writable {set x 1} + fileevent $sock writable {incr x} vwait x close $sock } -cleanup { catch {close $sock} unset x