Standards Update, IEEE 1003.1: System services interface

Richard A. O'Keefe ok at goanna.cs.rmit.OZ.AU
Sat Jun 30 20:28:58 AEST 1990


Moderator!:  Delete most of these lines (begin):
Return-Path: <uunet!goanna.cs.rmit.OZ.AU!ok>
Submitted-From: uunet!goanna.cs.rmit.OZ.AU!ok (Richard A. O'Keefe)
Moderator!:  Delete most of these lines (end).

From:  ok at goanna.cs.rmit.OZ.AU (Richard A. O'Keefe)


>In <385 at usenix.ORG> From: jsh at usenix.org, Paul Rabin <rabin at osf.org>
> reports on the April 23-27 meeting in Salt Lake City, UT:
>...
> There was a discussion about whether it is possible (and preferable)
> to improve the low-level directory interfaces instead of adding new,
> high-level interfaces.  Do the high-level interfaces really add new
> functionality for portable applications?  Do they belong with the
> low-level operating system interfaces specified in 1003.1?

In article <754 at longway.TIC.COM>, gwyn at smoke.brl.mil (Doug Gwyn) writes:
> From:  Doug Gwyn <gwyn at smoke.brl.mil>
> No, definitely not.  However, they would be appropriate at the 1003.2
> level.

If I want file tree walking, what's wrong with something on the order of
	FILE *files_selected = popen("find ......");
Presumably popen() and 'find' have to be in 1003.2 anyway.  There is
precisely one reason why I can't use this right now, and that is that
'find' doesn't quote its output, so if there is a file name with an
embedded \n things break.  That might be addressed by any number of
methods; one simple method would be to add a
	-length
subcommand which would do the equivalent of
	printf("%d %s\n", strlen(pathname), pathname);
where the existing
	-print
subcommand does the equivalent of
	printf("%s\n", pathname);

If I understand Doug Gwyn correctly, that's the kind of thing he has
in mind.  It is, after all, no more than the traditional UNIX Way.

By the way, I don't quite understand the file tree walking problem.
Unless one has some absolutely compelling reason for requiring a
depth-first search and not using /tmp files, something like 'find'
can be done using
	- one file descriptor to send file names to
	  (used sequentially)
	- one file descriptor for a work file
	  (random access)
	- one directory descriptor or whatever
	  (each directory being opened once, scanned once, and
	   never looked at again)
Basically you do a breadth-first search of directories, using the work
file to hold the queue.  If you want some other order, sort the output.
This is, of course, vulnerable to directories being renamed while the
walk is in progress, but so is a depth-first walker that can't hang on
to all the directories in the current branch.

-- 
"private morality" is an oxymoron, like "peaceful war".

Volume-Number: Volume 20, Number 76



More information about the Comp.std.unix mailing list