delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2018/07/20/09:36:15

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:mime-version:from:date:message-id:subject:to
:content-type; q=dns; s=default; b=fPwH6CxEFiGJpM48X2n4sMRUMhMr3
/6ow1JWZNLxWOWReFuTI9ZGaipSQywgvZNGixEaoji5YbIKH31c6MVLrluF6s87p
TdfmEs1+gHBx431Wx1G978wZCBYWxQZkRJJ+Xh10sNM3BSyi1wuf6xad+qyzh3im
rrUWPWfl0AGy7U=
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:mime-version:from:date:message-id:subject:to
:content-type; s=default; bh=4xF7LTqofR2pMZielvZ4DajUNGs=; b=v4W
TZbVoDqyfVc6d29csgrg+xru6swJJB/PWfg4g+TROGWgTovYBPw72vpewU8U3Lav
OOiZ9/LmZBdhV7t15JKRybVuYZIli9S2Jdaz+SJFxZpPEdUN98LPnJqvza6UzR2y
0V4qb+7/rIgUfKLips+udnY6JEsDqxKrns0mWsEk=
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=-6.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,GIT_PATCH_2,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=freezes
X-HELO: mail-oi0-f48.google.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=Zx7Qo2mPsbl0Eb6mHi3p4lRLODPT+pv1ozi5kmR1BWs=; b=m5aR3LSy70IHlMXkF0uPVfQgvkMhUmMrm2t0tk39GgHg6RxLRGrOGs6F2dR7isAEHb GG+FJkuG3OXW98RQOPbyVMRNfkHVNT0FzZYEoPjEko8YITOebJjh9IyZ/sgoZliFeFMP Ndd1gc7omOTPEycjxmEDzx3Vk/oXvBTtwZmlt+HsR24TTvUoAEOqoYAIzPPILxMtaDnU VRhZDihlFuf9lOk7R7XkRD9jQcCo+NnHHvW8z8BrJbUR9E4xt1O6YEzKlCTen4a+ABya u1Ayl0cRmYL6bxpuGFP1vk5JTKFDR6jy3ku6SKDvWzP/cMo3M2rqFqMPKkP3NnwMHk+w 5uow==
MIME-Version: 1.0
From: =?UTF-8?Q?Jo=C3=A3o_Eiras?= <joao DOT eiras AT gmail DOT com>
Date: Fri, 20 Jul 2018 15:35:21 +0200
Message-ID: <CAJ+sA04Rkbq3-a-59_iRN2+zzJHZe-TE-7st88bcS8mZ2jj63A@mail.gmail.com>
Subject: Freeze opening /dev/stdout
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes

Hi.

On linux now and then I call a program passing "/dev/stdout" as output
file parameter, so the data is output in the terminal.

For instance, something tiny in C.

#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.

Interestingly, this does not affect /dev/stderr which is a link to the
console device.

$ ls -la /dev/std*
lrwxrwxrwx 1 user None 15 Sep  6  2017 /dev/stderr -> /proc/self/fd/2
prw------- 1 user None  0 Jun  4 15:54 /dev/stdin
prw------- 1 user None  0 Jun  4 15:54 /dev/stdout

I've just sent another thread about "/dev/stdin" always being a pipe,
so I guess that is related.

--
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