[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: signal() behavior

Howard Chu wrote:
> > From: Kurt D. Zeilenga [mailto:Kurt@OpenLDAP.Org]
> > Seems to me that we can do away with this whole socket pair business if we
> > just close all the listeners on shutdown (as is done when -DHAVE_WINSOCK)
> > is defined...
> I tried something like that - closing a "read" descriptor doesn't seem to
> have any effect on the select() call though - it still just waits. The pipe
> trick worked by closing the write side of the pipe, which caused an EOF
> condition on the read side of the pipe. Just closing the read side had no
> effect. Perhaps using shutdown() to close down the connections would work, I
> didn't try that. But basically, in order to cause the select() to terminate,
> data or an EOF must be generated by the remote side of a connection.
> >
> > Also:
> >
> > #define sock_errstr() STRERROR(errno)
> >
> > is bogus!
> >
> > errno may change from the time it was saved in the local variable and
> > the time it is printed.  Hence, sock_errstr must be written to expect
> > the local variable.
> >
> >       err = sock_errno();
> >       ...
> >       printf("error e=%d s=%s\n", err, sock_errstr(err));
> I know, that's pretty much how I wrote it the first time, but Hallvard
> objected because the Winsock implementation WSAGetLastErrorString() doesn't
> accept an argument, so the macro is misleading there. This bit of semantic
> difference is tough to accomodate reasonably in all cases.

#define sock_errstr(err)	WSAGetErrorString(err)

Note, WSAGetErrorString and WSAGetLastErrorString are NOT WSA routines.
They are -llutil/nt_err.c routines.