From mboxrd@z Thu Jan 1 00:00:00 1970 From: Frederik Eaton Subject: Re: seekable pipes Date: Mon, 20 Jun 2005 22:02:52 -0700 Message-ID: <20050621050252.GC7874@a5.repetae.net> References: <20050616043747.GA25482@a5.repetae.net> Reply-To: frederik@ofb.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: fsdevel , Linux-userfs , x Return-path: Received: from h34-aclarke.sv.meer.net ([205.217.153.34]:17122 "EHLO ofb3.ofb.net") by vger.kernel.org with ESMTP id S261656AbVFUFDA (ORCPT ); Tue, 21 Jun 2005 01:03:00 -0400 To: Bryan Henderson Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org > >The stat type for <() files is "character special" > > When I do it, it's "FIFO" (st_mode contains S_IFIFO). > > >such files are usually seekable. > > Really? Character device special files are usually not in my experience: > terminals, tapes, serial ports. > > >In any case, emacs and vim are cool. > > You can edit a device special file? Emacs gives me "file cannot be read" > on various pipe and character device special files I tried. strace shows > that it does an lstat(), then gives up. I stand corrected. Sorry. Thanks for verifying. I was testing on /proc/self/fd/XX after opening it with 'exec', obviously not the same. So this is a real problem then. I guess the issue is that the shell has to insert a fifo at the end of the pipeline in a <() construct in order to get something that can be read from when written to? Maybe the solution would be to introduce a <>() construct which uses a seekable pipe instead of a fifo at the end? And that would suggest a new version of "|" as well. Or your suggestion of using an ioctl to change the file type... If a seekable pipe were created by "upgrading" a regular one then perhaps this could automatically change the file type at the slave to "regular file" (from "fifo"). This way the shell wouldn't have to know about seekable pipes, which would be good. But I can't see how to get around the race condition where the slave side of the pipe might do a 'stat' call before the master side has had a chance to change the file type. It could be possible to have 'stat' block until the master has written something, but that might introduce deadlocks in existing programs. Frederik -- http://ofb.net/~frederik/