Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple errno references in tcl library

Status
Not open for further replies.

KevMonstah

Programmer
May 2, 2002
2
US
I'm trying to use Tcl to open a socket from an HP-UX11 machine to a server running
on a Windows NT platform. In the code, the key line is a check of errno to see its
value, which should be EINPROGRESS. The errno variable in the code returns a 0
after the connect, but doing a 'perror()' shows that errno is actually EINPROGRESS.
It appears that the errno object referenced through Tcl is not the true global errno used by the system. Is there a way to resolve this? I've tried linking my Tcl library
with various options [-B symbolic] [+s] [+b/dir], and a thorough search of the include
files have not resulted in any success in identifying or solving this problem.

 
I've never worked with "errno" but this is what I found in the help file:
Tcl_SetErrno and Tcl_GetErrno provide portable access to the errno variable, which is used to record a POSIX error code after system calls and other operations such as Tcl_Gets. These procedures are necessary because global variable accesses cannot be made across module boundaries on some platforms.
Tcl_SetErrno sets the errno variable to the value of the errorCode argument C procedures that wish to return error information to their callers via errno should call Tcl_SetErrno rather than setting errno directly.

Tcl_GetErrno returns the current value of errno. Procedures wishing to access errno should call this procedure instead of accessing errno directly.

Tcl_ErrnoId and Tcl_ErrnoMsg return a string representation of the current errno value. Tcl_ErrnoId returns a machine-readable textual identifier such as "EACCES". Tcl_ErrnoMsg returns a human-readable string such as "permission denied". The strings returned by these functions are statically allocated and the caller must not free or modify them.

Bob Rashkin
rrashkin@csc.com
 
That was another thing that I had tried which failed, but I forgot to mention it in the
original post. I had attempted to use Tcl_ErrnoId and it returned 'Unknown'. I just
tested the use of Tcl_GetErrno, and the value it returns (0), is also not consistent
with the global errno (EINPROGRESS).

But thanks for the help.

Kevin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top