which is "better" - /dev/fd or FIFO

Arthur Chance freebsd at qeng-ho.org
Sat Mar 6 17:11:06 UTC 2021

On 06/03/2021 16:57, tech-lists wrote:
> On Sat, Mar 06, 2021 at 09:37:49AM -0700, @lbutlr wrote:
>> On 06 Mar 2021, at 07:08, tech-lists <tech-lists at zyxst.net> wrote:
>>> Some ports, notably shells/bash, have a makeoptions config where you can
>>> select "enable use of /dev/fd". But there's no explanation given why
>>> this is advantageous or not, or if there's some kind of risk, in a
>>> freebsd context [1]. It's not enabled by default. Please can anyone
>>> explain?
>> Do you have a floppy drive?
> no. I admit i'd not thought of floppy drive at all. In 2021, who does?

Nope, /dev/fd isn't anything to do with floppy disks, that's /dev/fd0 IIRC.

> But the context in which this option is in, is confusing. The option is
> for fdescfs with "enable use of /dev/fd". I don't know what fdescfs
> truly is, apart from something to do with file descriptords, and not
> floppy drives.
> Look here to see what I mean:
> https://cloud.zyxst.net/~john/FreeBSD/ports/bashc/bashc.png
> I think "enable use of /dev/fd" might be a bug; maybe it should say
> "enable use of /dev/fdescfs" ?
> In which case my question should be "which is best - /dev/fdescfs or fifo?"

If you read the manual entry for fdescfs it says it should be mounted via

mount -t fdescfs null /dev/fd

Opening /dev/fd/N gives you an alternate access path to file descriptor
N in your program. I.e. opening /dev/fd/0 gives you access to stdin but
on a different fd.

The number of people predicting the demise of Moore's Law doubles
every 18 months.

More information about the freebsd-questions mailing list