From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: claudio.bley@gmail.com (Claudio Bley) Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] GnuTLS support on Woe32 Date: Sun, 13 Mar 2011 14:53:12 +0100 Message-ID: <87ei6bunxz.wl%claudio.bley@gmail.com> References: <87ipvwl1nx.wl%claudio.bley@gmail.com> <83oc5ogp89.fsf@gnu.org> <87ipvuwslp.wl%claudio.bley@gmail.com> <87hbbc0zi6.wl%claudio.bley@gmail.com> <83oc5gsdwc.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Trace: dough.gmane.org 1300025902 4813 80.91.229.12 (13 Mar 2011 14:18:22 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 13 Mar 2011 14:18:22 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Mar 13 15:18:18 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Pym7c-0006jq-JI for ged-emacs-devel@m.gmane.org; Sun, 13 Mar 2011 15:18:16 +0100 Original-Received: from localhost ([127.0.0.1]:49506 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PyloA-0002eo-PZ for ged-emacs-devel@m.gmane.org; Sun, 13 Mar 2011 09:58:10 -0400 Original-Received: from [140.186.70.92] (port=38426 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PylnY-0002Bb-7J for emacs-devel@gnu.org; Sun, 13 Mar 2011 09:58:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pyljj-0003bY-M8 for emacs-devel@gnu.org; Sun, 13 Mar 2011 09:53:36 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:52876) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pyljj-0003bJ-9U for emacs-devel@gnu.org; Sun, 13 Mar 2011 09:53:35 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Pyljf-0007Mp-Cg for emacs-devel@gnu.org; Sun, 13 Mar 2011 14:53:31 +0100 Original-Received: from dslb-188-106-009-008.pools.arcor-ip.net ([188.106.9.8]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 13 Mar 2011 14:53:31 +0100 Original-Received: from claudio.bley by dslb-188-106-009-008.pools.arcor-ip.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 13 Mar 2011 14:53:31 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-devel@gnu.org Original-Lines: 86 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: dslb-188-106-009-008.pools.arcor-ip.net In-Reply-To: <83oc5gsdwc.fsf@gnu.org> Mail-Copies-To: never User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/23.1 (i686-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:137186 Archived-At: At Sat, 12 Mar 2011 14:48:35 +0200, Eli Zaretskii wrote: > > > From: claudio.bley@gmail.com (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