[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] GnuTLS support on Woe32
From: |
Eli Zaretskii |
Subject: |
Re: [PATCH] GnuTLS support on Woe32 |
Date: |
Sat, 12 Mar 2011 14:48:35 +0200 |
> 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:
int
emacs_gnutls_write (int fildes, struct Lisp_Process *proc, char *buf,
unsigned int nbyte)
{
register int rtnval, bytes_written;
gnutls_session_t state = proc->gnutls_state;
if (proc->gnutls_initstage != GNUTLS_STAGE_READY) {
#ifdef EWOULDBLOCK
errno = EWOULDBLOCK;
#endif
#ifdef EAGAIN
errno = EAGAIN;
#endif
return -1;
}
So it looks like it already is prepared to deal with EWOULDBLOCK if
EAGAIN is not available.
> 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.
But I would like to understand better why you must produce EAGAIN in
the first place.
> 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?
> > > > +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?
> 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.
- Re: [PATCH] GnuTLS support on Woe32, (continued)
- Re: [PATCH] GnuTLS support on Woe32, Claudio Bley, 2011/03/07
- Re: [PATCH] GnuTLS support on Woe32, Robert Pluim, 2011/03/08
- Re: [PATCH] GnuTLS support on Woe32, Eli Zaretskii, 2011/03/08
- Re: [PATCH] GnuTLS support on Woe32, Robert Pluim, 2011/03/08
- Re: [PATCH] GnuTLS support on Woe32, Lars Magne Ingebrigtsen, 2011/03/08
- Re: [PATCH] GnuTLS support on Woe32, Eli Zaretskii, 2011/03/08
- Re: [PATCH] GnuTLS support on Woe32, Claudio Bley, 2011/03/09
- Re: [PATCH] GnuTLS support on Woe32,
Eli Zaretskii <=
- Re: [PATCH] GnuTLS support on Woe32, Claudio Bley, 2011/03/13
- Re: [PATCH] GnuTLS support on Woe32, Eli Zaretskii, 2011/03/13
- Re: [PATCH] GnuTLS support on Woe32, Claudio Bley, 2011/03/14
- Re: [PATCH] GnuTLS support on Woe32, Ted Zlatanov, 2011/03/14
- Re: [PATCH] GnuTLS support on Woe32, Claudio Bley, 2011/03/15
- Re: [PATCH] GnuTLS support on Woe32, Ted Zlatanov, 2011/03/15
- Re: [PATCH] GnuTLS support on Woe32, Claudio Bley, 2011/03/20
- Re: [PATCH] GnuTLS support on Woe32, Ted Zlatanov, 2011/03/21
- Re: [PATCH] GnuTLS support on Woe32, Stefan Monnier, 2011/03/22
- Re: [PATCH] GnuTLS support on Woe32, Ted Zlatanov, 2011/03/22