home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / volume.26 / text0050.txt < prev    next >
Encoding:
Text File  |  1992-02-21  |  3.8 KB  |  98 lines

  1. Submitted-by: peter@ficc.ferranti.com (Peter da Silva)
  2.  
  3. In article <1991Dec20.065940.11851@uunet.uu.net> brnstnd@KRAMDEN.ACF.NYU.EDU (Dan Bernstein) writes:
  4. > Jason Zions writes:
  5. > > There is an expectation that one can open() a local
  6. > > file, a remote file, a real-time message queue, a secure file, and a named
  7. > > network connection, all with a function whose name is open() and has some
  8. > > common parameters.
  9.  
  10. > *Why*?
  11.  
  12. Because the more things you can access via the open() system call, the more
  13. powerful an environemnt you have. For example, older programs become able to
  14. access more data sources and sinks without modification or recompiling.
  15.  
  16. For a concrete example, in AmigaDOS this expectation is taken further: you
  17. can relatively easily create new objects that look like files, and pass
  18. textual information to them in the open call. In general, "DEV:path" passes
  19. the string "path" unmodified to the device "dev". This allows such nice
  20. capabilities as:
  21.  
  22.     CON:0/0/640/200/Debug Window/WAIT
  23.  
  24. Which opens a (NTSC) full-screen window, titled debug window, which you can
  25. print text strings to and which will hang around after close until you click
  26. on the close box. Another example:
  27.  
  28.     APIPE:ps -ef
  29.  
  30. Reading from this file will give you the result of the "ps -ef" command. you
  31. don't have to have the program calling popen with some syntaxes and not others,
  32. you don't have to remember that some programs allow this and others don't. in
  33. UNIX I can open a pipe, in various programs, by doing:
  34.  
  35.     :r !ps -ef
  36.     open "ps -ef" pr
  37.     ~|ps -ef
  38.  
  39. > Let's move on to the supposed simplicity of super-open() for programmers.
  40. > Since when was it difficult to create, e.g., network connections with the
  41. > BSD syscalls?
  42.  
  43. Not very, but it's hard to create one from your ".mailrc" file.
  44.  
  45. > Competent UNIX programmers write tools which stick to stdin, stdout, and
  46. > stderr. Only a few specialized tools---cat, sh, inetd
  47.  
  48. A few specialised tools? cc, mail, diff, just off the top of my head. Not
  49. everything is, or can be, a filter.
  50.  
  51. > also bloating the kernel for something which the vast majority of
  52. > programs will never use.
  53.  
  54. The challenge is on... let's look though my System III (because it's older
  55. and therefore more "pure") Xenix manual:
  56.  
  57. accton, awk, bdiff, bfs, chgrp, chmod, chown, cmp, comm, cp, cron, cu, diff,
  58. diff3, ed, finger, join, ln, look, lpq, lpr, mail, make, more (and less),
  59. mv, nohup, pr, rm, sdiff, tee, touch, and uucp (etc).
  60.  
  61. All these commands operate on, require, or provide access to named files in
  62. ways that bare file descriptors can not easily be wedged in. This list also
  63. brings up the question of security: all UNIX security is based on access to
  64. files. Adding new ways to create file descriptors involves duplicating all
  65. this security and causing a separate source of kernel expansion.
  66.  
  67. > Finally, let's consider super-open()'s advantages for users. Certainly
  68. > it'd be nice for a user to be able to type something like, say,
  69.  
  70. >    % cat #13@athena.mit.edu
  71.  
  72. More like "cat /dev/telnet/athena.mit.edu/13".
  73.  
  74. > (disclaimer: I haven't given any thought to a good notation for this)
  75. > and have cat read from a TCP socket connected to port 13 on athena. Does
  76. > this mean that open() should support such notation? No!
  77.  
  78. I agree, in a way. It's not "open" that's doing the work... it's the virtual
  79. file system mounted on /dev/telnet. If you rely in the shell to figure this
  80. out and convert the call to something like
  81.  
  82.     + telnet athena.mit.edu 47| cat /dev/fd/47
  83.  
  84. then what do you do when you want to access this from "awk", or create a
  85. (sumbolic) link to it called "/dev/weather"? And have this converted to a
  86. link to a serial port with a heathkit WWV receiver when the network's down...
  87.  
  88. UNIX is more than just the shell.
  89. -- 
  90. -- Peter da Silva
  91. -- Ferranti International Controls Corporation
  92. -- Sugar Land, TX  77487-5012;  +1 713 274 5180
  93. -- "Have you hugged your wolf today?"
  94.  
  95.  
  96. Volume-Number: Volume 26, Number 52
  97.  
  98.