W3C home > Mailing lists > Public > public-ldp-wg@w3.org > January 2013

Re: LDPRs, LDPCs and the mysterious X

From: Mo McRoberts <Mo.McRoberts@bbc.co.uk>
Date: Fri, 25 Jan 2013 12:48:14 +0000
To: Andy Seaborne <andy.seaborne@epimorphics.com>
CC: "<public-ldp-wg@w3.org>" <public-ldp-wg@w3.org>
Message-ID: <923F0B3E-FC11-45B2-B68F-0A438F319FC1@bbc.co.uk>

To be pedantic, at the filesystem level directories _are_ files, as well as much of the plumbing above it. To prevent accidental oddness, SOME systems enforce a separate set of APIs for reading directories, and the Single UNIX Specification makes specific allowances for this:

[XSI]  The fildes argument refers to a directory **and the implementation does not allow** the directory to be read using read() or pread(). The readdir() function should be used instead.

(emphasis mine)

On many Unix-like systems, you can 'cat' a directory just fine, though what you'll get out of it will be just a set of binary dentries, so it probably won't get you too far.


On Fri 2013-Jan-25, at 12:40, Andy Seaborne <andy.seaborne@epimorphics.com>

> On 25/01/13 11:33, Henry Story wrote:
>> everything including directories are files.
> Not really:
> cat / ==> "cat: /: Is a directory"
> echo $? ==> 1
> man 2 read:
>    fd refers to a directory.
>       Andy

Mo McRoberts - Technical Lead - The Space
0141 422 6036 (Internal: 01-26036) - PGP key CEBCF03E,
Zone 1.08, BBC Scotland, Pacific Quay, Glasgow, G51 1DA
Project Office: Room 7083, BBC Television Centre, London W12 7RJ

This e-mail (and any attachments) is confidential and
may contain personal views which are not the views of the BBC unless specifically stated.
If you have received it in
error, please delete it from your system.
Do not use, copy or disclose the
information in any way nor act in reliance on it and notify the sender
Please note that the BBC monitors e-mails
sent or received.
Further communication will signify your consent to
Received on Friday, 25 January 2013 12:48:54 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:11:44 UTC