unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* EWOULDBLOCK and EINPROGRESS in process.c
@ 2015-03-24 18:09 Eli Zaretskii
  2015-03-24 21:25 ` Andreas Schwab
  2015-03-24 23:42 ` Paul Eggert
  0 siblings, 2 replies; 5+ messages in thread
From: Eli Zaretskii @ 2015-03-24 18:09 UTC (permalink / raw)
  To: emacs-devel

process.c has this fragment after it calls 'connect':

  #ifdef NON_BLOCKING_CONNECT
  #ifdef EINPROGRESS
	if (is_non_blocking_client && xerrno == EINPROGRESS)
	  break;
  #else  <<<<<<<<<<<<<<<<<<<<<<<<<<<<
  #ifdef EWOULDBLOCK
	if (is_non_blocking_client && xerrno == EWOULDBLOCK)
	  break;
  #endif
  #endif
  #endif

Can someone tell why we need that "#else" there?  Suppose there's a
platform that has both values defined, but only returns EWOULDBLOCK
when a non-blocking 'connect' is called -- that platform will fall
through the cracks here.

Is there any problem to replace #else with #endif here?



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: EWOULDBLOCK and EINPROGRESS in process.c
  2015-03-24 18:09 EWOULDBLOCK and EINPROGRESS in process.c Eli Zaretskii
@ 2015-03-24 21:25 ` Andreas Schwab
  2015-03-25 18:13   ` Eli Zaretskii
  2015-03-24 23:42 ` Paul Eggert
  1 sibling, 1 reply; 5+ messages in thread
From: Andreas Schwab @ 2015-03-24 21:25 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> process.c has this fragment after it calls 'connect':
>
>   #ifdef NON_BLOCKING_CONNECT
>   #ifdef EINPROGRESS
> 	if (is_non_blocking_client && xerrno == EINPROGRESS)
> 	  break;
>   #else  <<<<<<<<<<<<<<<<<<<<<<<<<<<<
>   #ifdef EWOULDBLOCK
> 	if (is_non_blocking_client && xerrno == EWOULDBLOCK)
> 	  break;
>   #endif
>   #endif
>   #endif
>
> Can someone tell why we need that "#else" there?  Suppose there's a
> platform that has both values defined, but only returns EWOULDBLOCK
> when a non-blocking 'connect' is called -- that platform will fall
> through the cracks here.

POSIX only defines EINPROGRESS for this situation, so such a platform
would be buggy.

> Is there any problem to replace #else with #endif here?

I don't think it would make any difference in practice.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: EWOULDBLOCK and EINPROGRESS in process.c
  2015-03-24 18:09 EWOULDBLOCK and EINPROGRESS in process.c Eli Zaretskii
  2015-03-24 21:25 ` Andreas Schwab
@ 2015-03-24 23:42 ` Paul Eggert
  2015-03-25 18:15   ` Eli Zaretskii
  1 sibling, 1 reply; 5+ messages in thread
From: Paul Eggert @ 2015-03-24 23:42 UTC (permalink / raw)
  To: Eli Zaretskii, emacs-devel

Eli Zaretskii wrote:

> Can someone tell why we need that "#else" there?

The EWOULDBLOCK code is there because Kim Storm heard a rumor that some oddball 
nonblocking 'connect' implementations returned EWOULDBLOCK.  Please see:

https://lists.gnu.org/archive/html/emacs-devel/2002-02/msg00718.html

I also vaguely recall stories that some old Unix platforms did that.  The most 
recent reference I found in a quick Google search was UnixWare 7 Release 7.1.4 
(April 2004):

http://uw714doc.sco.com/en/SDK_netapi/sockC.nonBlockSocks.html

If that documentation is right, the current Emacs code wouldn't work on UnixWare 
7.1.4, not that we care.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: EWOULDBLOCK and EINPROGRESS in process.c
  2015-03-24 21:25 ` Andreas Schwab
@ 2015-03-25 18:13   ` Eli Zaretskii
  0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2015-03-25 18:13 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: emacs-devel

> From: Andreas Schwab <schwab@linux-m68k.org>
> Cc: emacs-devel@gnu.org
> Date: Tue, 24 Mar 2015 22:25:11 +0100
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > process.c has this fragment after it calls 'connect':
> >
> >   #ifdef NON_BLOCKING_CONNECT
> >   #ifdef EINPROGRESS
> > 	if (is_non_blocking_client && xerrno == EINPROGRESS)
> > 	  break;
> >   #else  <<<<<<<<<<<<<<<<<<<<<<<<<<<<
> >   #ifdef EWOULDBLOCK
> > 	if (is_non_blocking_client && xerrno == EWOULDBLOCK)
> > 	  break;
> >   #endif
> >   #endif
> >   #endif
> >
> > Can someone tell why we need that "#else" there?  Suppose there's a
> > platform that has both values defined, but only returns EWOULDBLOCK
> > when a non-blocking 'connect' is called -- that platform will fall
> > through the cracks here.
> 
> POSIX only defines EINPROGRESS for this situation, so such a platform
> would be buggy.
> 
> > Is there any problem to replace #else with #endif here?
> 
> I don't think it would make any difference in practice.

Got it, thanks.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: EWOULDBLOCK and EINPROGRESS in process.c
  2015-03-24 23:42 ` Paul Eggert
@ 2015-03-25 18:15   ` Eli Zaretskii
  0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2015-03-25 18:15 UTC (permalink / raw)
  To: Paul Eggert; +Cc: emacs-devel

> Date: Tue, 24 Mar 2015 16:42:00 -0700
> From: Paul Eggert <eggert@cs.ucla.edu>
> 
> The EWOULDBLOCK code is there because Kim Storm heard a rumor that some oddball 
> nonblocking 'connect' implementations returned EWOULDBLOCK.  Please see:
> 
> https://lists.gnu.org/archive/html/emacs-devel/2002-02/msg00718.html
> 
> I also vaguely recall stories that some old Unix platforms did that.  The most 
> recent reference I found in a quick Google search was UnixWare 7 Release 7.1.4 
> (April 2004):
> 
> http://uw714doc.sco.com/en/SDK_netapi/sockC.nonBlockSocks.html
> 
> If that documentation is right, the current Emacs code wouldn't work on UnixWare 
> 7.1.4, not that we care.

Thanks for the references.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-03-25 18:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-24 18:09 EWOULDBLOCK and EINPROGRESS in process.c Eli Zaretskii
2015-03-24 21:25 ` Andreas Schwab
2015-03-25 18:13   ` Eli Zaretskii
2015-03-24 23:42 ` Paul Eggert
2015-03-25 18:15   ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).