delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2018/07/20/21:19:29

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:in-reply-to
:references:mime-version:content-type:content-transfer-encoding;
q=dns; s=default; b=ucXrSVDS3/BlmIZJJWol0IakUKGfMoRYGsGrfGFUAtn
oOacL5R7Ow4Q4O7HhPnBpJDr19977Yd/jESXZIsCHA+lRKy/iS3u/2ZJ9QPUQ1Q2
vmlSK2FhYkJ57PDzyzpaVdN7oufGRlHD3CJ9D69t6PPQPF/4wm53cfLC4zuM86N0
=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:in-reply-to
:references:mime-version:content-type:content-transfer-encoding;
s=default; bh=TGIztT4in0JYVFO9N7zMKGyZIF4=; b=WMltsG+2ouQcApM6o
GCtZ+srUsi735xSFLXIh//2gLUobAjw7TQxB0Rr6eulfDT7f5BU7X1U25ZV9PVT2
JdWPF5zCkxHOjk95yXRq6aiwo/YhSzfgCzLvZkhYEQdOtJpBOQoUfW5/6LQsAwku
MqkqdpnfT+6GuEB/wTi1u/pQgM=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=HContent-Transfer-Encoding:8bit
X-HELO: conssluserg-06.nifty.com
DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-06.nifty.com w6L1J2wq014985
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.ne.jp; s=dec2015msa; t=1532135942; bh=t+wN3qmuobkgNVRuK3BtJI2SMyv/RtKixsUFi/RmDd8=; h=Date:From:To:Subject:In-Reply-To:References:From; b=AKI+w7j4d6FxkFbhxxvuzPXTIJKis4xsxPghi2UtwiDPLpDVK67JGiyQFu/ZhyQh/ Lp9JAdMiO8fKGhc4jrpQa0hzIJ1YYahkjilUmh8MYjO3XY4+NdvfGVB9iwAniMXYB4 KLjEsqrvMVt147wPkXTDhPCmeB4VI/8qxJvit8JPsjq+fnBUWsJKTg492GgwCQdgsk gyJmGDEj1mAAhcx7n7iM8h/xkoU+bLsldWeDF/6HmeIyL5iTef33XuAEBetYLKkcmC g5rSOFJPpphfhtm7ZJtr610w8ot41b35IQyhvKhB/UkXeYHin/s/LV5jCZ4nSu1FxK memj2YnD7pBCw==
Date: Sat, 21 Jul 2018 10:19:03 +0900
From: Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>
To: cygwin AT cygwin DOT com
Subject: Re: Freeze opening /dev/stdout
Message-Id: <20180721101903.bf7eac1aaf824d013fc507ce@nifty.ne.jp>
In-Reply-To: <CAJ+sA04Rkbq3-a-59_iRN2+zzJHZe-TE-7st88bcS8mZ2jj63A@mail.gmail.com>
References: <CAJ+sA04Rkbq3-a-59_iRN2+zzJHZe-TE-7st88bcS8mZ2jj63A AT mail DOT gmail DOT com>
Mime-Version: 1.0
X-IsSubscribed: yes

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 DOT yano AT nifty DOT ne DOT 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019