NetBSD-Bugs archive

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

Re: bin/54564: cp of a fifo yields an empty file



The following reply was made to PR bin/54564; it has been noted by GNATS.

From: Robert Elz <kre%munnari.OZ.AU@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: bin/54564: cp of a fifo yields an empty file
Date: Tue, 24 Sep 2019 00:59:49 +0700

     Date:        Mon, 23 Sep 2019 17:30:01 +0000 (UTC)
     From:        Jan Schaumann <jschauma%netmeister.org@localhost>
     Message-ID:  <20190923173001.EF0B87A1FB%mollari.NetBSD.org@localhost>
 
   |  If cp(1) just creates an empty file and never reads,
   |  how come it blocks?
 
 It does open the source file (that's needed for both mmap() and read()
 versions) and uses fstat() rather than stat() for the size check.
 
 I believe that a read mode open on a fifo blocks until a writer apepars,
 but I am no fifo expert by any means, so this is just from a quick can
 of the implementation.
 
 That would explain the block - it isn't waiting for data to arrive, it
 is waiting for a writer to arrive.
 
 kre
 


Home | Main Index | Thread Index | Old Index