git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Joachim Schmitz" <jojo@schmitz-digital.de>
To: "'Paolo Bonzini'" <bonzini@gnu.org>
Cc: bug-gnulib@gnu.org, git@vger.kernel.org,
	'Junio C Hamano' <gitster@pobox.com>,
	'Erik Faye-Lund' <kusmabite@gmail.com>
Subject: RE: poll() emulation in git
Date: Wed, 5 Sep 2012 15:36:54 +0200	[thread overview]
Message-ID: <00d801cd8b6b$844bbcd0$8ce33670$@schmitz-digital.de> (raw)
In-Reply-To: 

> From: Joachim Schmitz [mailto:jojo@schmitz-digital.de]
> Sent: Wednesday, September 05, 2012 2:58 PM
> To: 'Paolo Bonzini'
> Cc: 'Junio C Hamano'; 'git@vger.kernel.org'; 'Erik Faye-Lund'; 'bug-gnulib@gnu.org'
> Subject: RE: poll() emulation in git
> 
> > From: Paolo Bonzini [mailto:paolo.bonzini@gmail.com] On Behalf Of Paolo Bonzini
> > Sent: Wednesday, September 05, 2012 2:05 PM
> > To: Joachim Schmitz
> > Cc: 'Junio C Hamano'; git@vger.kernel.org; 'Erik Faye-Lund'; bug-gnulib@gnu.org
> > Subject: Re: poll() emulation in git
> >
> > Il 05/09/2012 13:24, Joachim Schmitz ha scritto:
> > > 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.
> >
> > Actually recv(...,MSG_PEEK) on most Unix variants works on non-sockets
> > too.  The trick is taken from GNU Pth in turn.
> >
> > > 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.
> >
> > Does your system have a working FIONREAD ioctl for pipes?
> 
> It does have FIONREAD ioctl. Whether it works properly is to be determined...
> I'll test if you could show me how?

Oh, now I see what you aimed at, but no, that Mac OS X method doesn't work for me, I tried (at least I think I did).

And <sys/ioctl.h> has
/*
 * Normal IOCTL's supported by the socket interface
 */
#define FIONREAD        _IOR(0, 8, _ioctl_int)       /* Num of bytes to read */
#define FIONBIO         _IOW(0, 9, _ioctl_int)       /* Non-blocking I/O     */

So these seem to be supported on sockets only, I guess.
And indeed the man pages for ioctl confirms:

          Valid values for the request parameter for AF_INET or
          AF_INET6 sockets are:


          FIONREAD  Gets the number of bytes available for reading and
                    stores it at the int pointed at by arg.


So not even AF_UNIX sockets, not to mention pipes...

Bye, Jojo

  parent reply	other threads:[~2012-09-05 13:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-05 11:24 poll() emulation in git Joachim Schmitz
2012-09-05 11:55 ` 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 [this message]
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='00d801cd8b6b$844bbcd0$8ce33670$@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).