home *** CD-ROM | disk | FTP | other *** search
- Submitted-by: brnstnd@KRAMDEN.ACF.NYU.EDU (Dan Bernstein)
-
- Peter da Silva writes:
- > Because the more things you can access via the open() system call, the more
- > powerful an environemnt you have. For example, older programs become able to
- > access more data sources and sinks without modification or recompiling.
-
- No. If you need a kludge to support non-UNIXy programs, use /dev/fd.
- It's vastly simpler than any super-open() could ever be, and it achieves
- your goal of letting older programs open network connections et al.
-
- > For a concrete example, in AmigaDOS this expectation is taken further:
-
- Fine. If you think that AmigaDOS features are appropriate for POSIX
- standardization, then implement them in a UNIX system and wait for their
- obvious advantages to win everyone over.
-
- > > Let's move on to the supposed simplicity of super-open() for programmers.
- > > Since when was it difficult to create, e.g., network connections with the
- > > BSD syscalls?
- > Not very, but it's hard to create one from your ".mailrc" file.
-
- Hmmm? There are many programs running around (e.g., clientserver) which
- do the same thing for network connections that the shell (via < and >)
- does for the filesystem.
-
- > > also bloating the kernel for something which the vast majority of
- > > programs will never use.
- > The challenge is on... let's look though my System III (because it's older
- > and therefore more "pure") Xenix manual:
- > accton, awk, bdiff, bfs, chgrp, chmod, chown, cmp, comm, cp, cron, cu, diff,
- > diff3, ed, finger, join, ln, look, lpq, lpr, mail, make, more (and less),
- > mv, nohup, pr, rm, sdiff, tee, touch, and uucp (etc).
-
- bdiff, cmp, comm, diff, diff3, join, look, more, nohup, pr, sdiff, tee,
- and touch can be written to work with file descriptors under v7. Under
- BSD, the syscalls for working with descriptors are more complete, so you
- can do chgrp, chmod, chown, etc. without explicit filenames. I also
- wonder what sense it makes to do a chmod on /dev/tcp/uunet.uu.net/ftp---
- how are you going to keep track of the modes on *every single possible
- network connection*? Where's your implementation which shows us what the
- issues are?
-
- Three of the programs you list---ln, mv, rm---are red herrings: of
- course they work with filenames in the filesystem, because their job is
- to manipulate those names! (They fall under the category of ``a few
- specialized tools'' that I mentioned.) And do you have a system where
- accton works over the network? If so I'm sure crackers love your system.
-
- finger, lpq, lpr, mail, and uucp are (relatively) complex tools for
- accessing system databases. Fortunately, they can all be written as
- combinations of simpler tools, some of which are dedicated to opening
- files and some of which stick to file descriptors. That's the UNIX way.
-
- Finally, I have to agree with you that awk, ed, and make would have a
- tough time without open(). Like sh, they're all programming languages,
- and like sh they make it very easy for the programmer to open a file.
- So maybe super-open() would make these tools more useful. I doubt it.
- For the same reason that they're powerful enough to open files, they're
- powerful enough to execute arbirtary programs, and those arbitrary
- programs could open network connections just as easily as open() could.
-
- > This list also
- > brings up the question of security: all UNIX security is based on access to
- > files. Adding new ways to create file descriptors involves duplicating all
- > this security and causing a separate source of kernel expansion.
-
- Hardly. Adding new ways to create file descriptors involves thinking up
- new ways to deal with security. Filesystem security is utterly
- inappropriate for network connections, for example. Adding a
- super-open() means kludging these new security mechanisms into a
- protection system designed only for files.
-
- > > Finally, let's consider super-open()'s advantages for users. Certainly
- > > it'd be nice for a user to be able to type something like, say,
- > > % cat #13@athena.mit.edu
- > More like "cat /dev/telnet/athena.mit.edu/13".
-
- Whatever. The shell can still do it!
-
- > then what do you do when you want to access this from "awk", or create a
- > (sumbolic) link to it called "/dev/weather"?
-
- The pure solution is to have every program keep a file descriptor around
- for talking to the shell. Then requests for opening files can be
- shuttled down that descriptor. The problem reduces once again to a small
- matter of shell programming.
-
- Less pure solutions involve /dev/fd or perhaps what Convex calls
- ``watchdogs.'' Both of these are far cleaner mechanisms than
- super-open(), and since they've at least been considered by the market,
- they'd be far more appropriate for standardization.
-
- ---Dan
-
- [ Apologies to anyone who has seen multiple copies of Dan's postings. -- mod ]
-
- Volume-Number: Volume 26, Number 70
-
-