emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] GnuTLS support on Woe32


From: Claudio Bley
Subject: Re: [PATCH] GnuTLS support on Woe32
Date: Sun, 13 Mar 2011 14:53:12 +0100
User-agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Gojō) APEL/10.8 Emacs/23.1 (i686-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)

At Sat, 12 Mar 2011 14:48:35 +0200,
Eli Zaretskii wrote:
> 
> > From: address@hidden (Claudio Bley)
> > Date: Wed, 09 Mar 2011 22:12:33 +0100
> > 
> > > > > +static int
> > > > > +wsaerror_to_errno(int err)
> > > > > +{
> > > > > +  switch (err)
> > > > > +    {
> > > > > +    case WSAEWOULDBLOCK:
> > > > > +      return EAGAIN;
> > > > > +    case WSAEINTR:
> > > > > +      return EINTR;
> > > > > +    default:
> > > > > +      return err;
> > > > > +    }
> > > > > +}
> > > > 
> > > > Why is this function needed?  Can you extend w32.c:set_errno instead
> > > > (if it doesn't already support all the values of WSA* errors that you
> > > > need)?
> > > 
> > > Yes, I could extend w32.c:set_errno, if I move the Windows-specific
> > > function to w32.c proper...
> > 
> > I just had a look at this again. It's not so easy.
> > 
> > For GnuTLS, I have to map WSAEWOULDBLOCK to EAGAIN. This is set in
> > stone.
> 
> Set in stone where?  I see this in gnutls.c:
> ...
> So it looks like it already is prepared to deal with EWOULDBLOCK if
> EAGAIN is not available.

You missed the point. I was talking about GnuTLS internals. GnuTLS
only checks for EINTR and EAGAIN. So, I *have* to translate
WSAEWOULDBLOCK to EAGAIN when reporting errors to GnuTLS.

> > Doing this in w32.c:set_errno would break a lot of other stuff that
> > checks for EWOULDBLOCK because that happens to be #define'd to
> > WSAEWOULDBLOCK in sys/socket.h:129 (which seems reasonable after all).
> 
> If all you need is to produce EAGAIN when you have EWOULDBLOCK (the
> other mapping is already in set_errno), it hardly justifies a
> function.

That's true, WSAEINTR already gets mapped. Must have missed that.

> > It works alright when EWOULDBLOCK is #define'd to EAGAIN. In the end
> > it doesn't matter what EWOULDBLOCK is defined to because on Windows
> > MinGWs GCC doesn't define it at all, MSVC has it, but WinSock uses
> > it's own error codes anyway.
> 
> Sorry, I don't follow.  What were you trying to say or suggest here?

That it is OK to mess with EWOULDBLOCK's definition.

> > > > > +static ssize_t
> > > > > +emacs_gnutls_pull(gnutls_transport_ptr_t p, void* buf, size_t sz)
> > > > 
> > > > Can we move the Windows-specific functions to w32.c, and only call
> > > > them from gnutls.c?  I think we want to keep the Windows-related code
> > > > outside w32*.c to the bare minimum.
> > > 
> > > OK.
> > 
> > Maybe the GnuTLS specific stuff should also be kept to the bare
> > minimum outside of gnutls.c?
> 
> What stuff did you have in mind?

All the GnuTLS related functions (even if Windows specific).

> > Considering that these functions would have to be non-static in this
> > case to be accessible by gnutls.c.
> 
> Sure, but I see no problem with that.

I'm usually a bit reluctant to create public functions in a module
which only serve a special purpose in one single other module.

- Claudio





reply via email to

[Prev in Thread] Current Thread [Next in Thread]