git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Joachim Schmitz" <jojo@schmitz-digital.de>
To: "'Junio C Hamano'" <gitster@pobox.com>
Cc: <git@vger.kernel.org>, "'Erik Faye-Lund'" <kusmabite@gmail.com>,
	<bug-gnulib@gnu.org>, "'Paolo Bonzini'" <bonzini@gnu.org>
Subject: RE: poll() emulation in git
Date: Wed, 5 Sep 2012 13:24:25 +0200	[thread overview]
Message-ID: <00c001cd8b59$028e41c0$07aac540$@schmitz-digital.de> (raw)

> From: Joachim Schmitz [mailto:jojo@schmitz-digital.de]
> Sent: Tuesday, September 04, 2012 1:49 PM
> To: 'Junio C Hamano'
> Cc: 'git@vger.kernel.org'; 'Erik Faye-Lund'
> Subject: RE: [PATCH v2] Support non-WIN32 system lacking poll() while keeping the WIN32 part intact
> 
> > From: Junio C Hamano [mailto:gitster@pobox.com]
> > Sent: Friday, August 24, 2012 9:47 PM
> > To: Joachim Schmitz
> > Cc: git@vger.kernel.org; 'Erik Faye-Lund'
> > Subject: Re: [PATCH v2] Support non-WIN32 system lacking poll() while keeping the WIN32 part intact
> >
> > "Joachim Schmitz" <jojo@schmitz-digital.de> writes:
> >
> > > Different, but related question: would poll.[ch] be allowed to #include "git-compat-util.h"?
> >
> > Seeing other existing generic wrappers directly under compat/,
> > e.g. fopen.c, mkdtemp.c, doing so, I would say why not.
> >
> > Windows folks (I see Erik is already CC'ed, which is good ;-),
> > please work with Joachim to make sure such a move won't break your
> > builds.  I believe that it should just be the matter of updating a
> > couple of paths in the top-level Makefile.
> 
> Haven't heard anything from the Windows folks yet.
> 
> I'd prefer to move compat/win32/poll.[ch] into compat/poll.
> Then adjust a few paths in Makefile and that would be the 1st patch
> 
> A 2nd patch would be my already proposed ones that make this usable for others (me in this case ;-)), namely wrapping 2 #inludes.
> 
> diff --git a/compat/poll/poll.c b/compat/poll/poll.c
> index 403eaa7..49541f1 100644
> --- a/compat/poll/poll.c
> +++ b/compat/poll/poll.c
> @@ -24,7 +24,9 @@
>  # pragma GCC diagnostic ignored "-Wtype-limits"
>  #endif
> 
> -#include <malloc.h>
> +#if defined(WIN32)
> +# include <malloc.h>
> +#endif
> 
>  #include <sys/types.h>
> 
> @@ -48,7 +50,9 @@
>  #else
>  # include <sys/time.h>
>  # include <sys/socket.h>
> -# include <sys/select.h>
> +# ifndef NO_SYS_SELECT_H
> +#  include <sys/select.h>
> +# endif
>  # include <unistd.h>
>  #endif
> 
> --
> 1.7.12

However: this poll implementation, while compiling OK, doesn't work properly.
Because it uses recv(...,MSG_PEEK), it works on sockets only (returns ENOTSOCK on anything else), while the real poll() works on all
kind if file descriptors, at least that is my understanding.

Here on HP NonStop, when being connected via an non-interactive SSH, we get a set of pipes (stdin, stdout, stderr) instead of a
socket to talk to, so the poll() just hangs/loops.

As git's implementation is based on ('stolen' from?) gnulib's and still pretty similar, CC to the gnulib list and Paolo

Any idea how this could get solved? I.e. how to implement a poll() that works on non-sockets too?
There is some code that pertains to a seemingly similar problem in Mac OS X, but my problem is not identical, as that fix doesn't
help.

Bye, Jojo

             reply	other threads:[~2012-09-05 11:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-05 11:24 Joachim Schmitz [this message]
2012-09-05 11:55 ` poll() emulation in git Bastien ROUCARIES
2012-09-05 12:04   ` Joachim Schmitz
2012-09-05 12:05 ` Paolo Bonzini
2012-09-05 12:57   ` Joachim Schmitz
2012-09-05 13:36   ` Joachim Schmitz
2012-09-05 15:25     ` Paolo Bonzini
2012-09-06 14:02       ` Joachim Schmitz
2012-09-06 14:31         ` Paolo Bonzini
2012-09-06 14:44           ` Joachim Schmitz
2012-09-06 15:15             ` Paolo Bonzini
2012-09-07  7:23               ` Joachim Schmitz
2012-09-07  7:39           ` Joachim Schmitz
2012-09-07  9:40             ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='00c001cd8b59$028e41c0$07aac540$@schmitz-digital.de' \
    --to=jojo@schmitz-digital.de \
    --cc=bonzini@gnu.org \
    --cc=bug-gnulib@gnu.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=kusmabite@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).