public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Takashi Yano <takashi.yano@nifty.ne.jp>
To: cygwin@cygwin.com
Subject: Re: Freeze opening /dev/stdout
Date: Sat, 21 Jul 2018 07:04:00 -0000	[thread overview]
Message-ID: <20180721101903.bf7eac1aaf824d013fc507ce@nifty.ne.jp> (raw)
In-Reply-To: <CAJ+sA04Rkbq3-a-59_iRN2+zzJHZe-TE-7st88bcS8mZ2jj63A@mail.gmail.com>

On Fri, 20 Jul 2018 15:35:21 +0200
João Eiras wrote:
> #include <fcntl.h>
> #include <stdio.h>
> int main () {
> int fd = open("/dev/stdout", O_WRONLY);
> printf("Opened stdout: %d\n", fd);
> return 0;
> }
> 
> Unfortunately, this freezes. The problem (I think) is because
> /dev/stdout is a pipe, so the open() call waits forever until a
> reader() opens /dev/stdout, which in this case should be the terminal.

I can't reporduce your problem.

The test case outputs:
Opened stdout: 3

$ ls -la /dev/std*
lrwxrwxrwx 1 yano なし 15 Mar 26  2016 /dev/stderr -> /proc/self/fd/2
lrwxrwxrwx 1 yano なし 15 Mar 26  2016 /dev/stdin -> /proc/self/fd/0
lrwxrwxrwx 1 yano なし 15 Mar 26  2016 /dev/stdout -> /proc/self/fd/1

What happens if you execute:
rm /dev/stdin /dev/stdout
ln -s /proc/self/fd/0 /dev/stdin
ln -s /proc/self/fd/1 /dev/output

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

  reply	other threads:[~2018-07-21  1:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-20 16:08 João Eiras
2018-07-21  7:04 ` Takashi Yano [this message]
2018-07-21 11:30   ` Marco Atzeri
2018-07-21 14:56   ` Takashi Yano
2018-07-21 19:22     ` João Eiras

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=20180721101903.bf7eac1aaf824d013fc507ce@nifty.ne.jp \
    --to=takashi.yano@nifty.ne.jp \
    --cc=cygwin@cygwin.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 read-only IMAP folder(s) and NNTP newsgroup(s).