bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: new module 'pipe2'


From: Bruno Haible
Subject: Re: new module 'pipe2'
Date: Sun, 23 Aug 2009 01:46:27 +0200
User-agent: KMail/1.9.9

Eric Blake asked:
> >   /* Check the supported flags.  */
> >   if ((flags & ~(O_CLOEXEC | O_BINARY | O_TEXT)) != 0)
> 
> Is there any way to support NONBLOCK in Woe32?

Not really. The concept of asynchronous I/O in Woe32 means that the I/O
processes independently, and the caller is notified at the end, but has
no way of knowing where the I/O is stuck at any moment. There is also
some non-blocking mode for sockets, but the Microsoft doc says that it's
discouraged and only present for backward compatibility with a particular
product.

That's the reason why in pipe-filter-ii and pipe-filter-ig for Woe32 we use
separate threads.

> >       if ((fcntl_flags = fcntl (fd[1], F_GETFL, 0)) < 0
> >       || fcntl (fd[1], F_SETFL, fcntl_flags | O_NONBLOCK) < 0
> 
> Not safe; per POSIX, F_SETFL success must be checked via != -1 (not < 0).

Oops, right. Fixed, also in pipe-filter-*.c.

> Also, should we offer O_BINARY/O_TEXT support on cygwin, using setmode()?

That's your choice. Does it cause more trouble than it fixes? Cygwin does
a good job in emulating Unix behaviour (e.g. echo emits LFs, not CRLFs).
What problem do you want to fix by allowing O_BINARY / O_TEXT here?

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]