home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / volume.11 / text0060.txt < prev    next >
Encoding:
Internet Message Format  |  1987-07-18  |  2.7 KB

  1. From: domo@sphinx.co.uk (Dominic Dunlop)
  2.  
  3. Agreed that finding out how many files you have to close in order to be
  4. sure you've closed them all is a pain on most implementations of UN*X.
  5. IEEE 1003.1 is attempting to address this and related issues (after they
  6. were highlighted by IBM and others).
  7.  
  8. The current draft (#10) of 1003.1, which recently dropped
  9. stone-like through my (physical) mailbox, incorporates something that I and
  10. others cooked up at the April Toronto meeting.  The affected section is
  11. 2.9, "Numerical Limits".  As the changes have yet to be reviewed by the
  12. working group, they may well be thrown out or heavily modified later this
  13. month.
  14.  
  15. Basically what the draft says is that things like OPEN_MAX, the maximum
  16. number of files that a process can have open at any given time, are defined
  17. in a header file, <limits.h>, as "bounded ranges".  OPEN_MAX defines at
  18. compile time the "minimum maximum" number of files that a program can
  19. expect to be able to have open when it runs on a particular
  20. POSIX-conforming implementation (provided that the host system is not
  21. overloaded, that is, in this case, that it hasn't run out of space in its
  22. system open file or inode tables), while OPEN_MAX_CEIL defines the maximum
  23. number of files that any instance of this implementation could ever allow
  24. the program to have open.
  25.  
  26. What this means to the programmer is that applications may be written so
  27. that they rely on being able to open OPEN_MAX files; so that they run
  28. better if they succeed in opening more files than that (although there's no
  29. point in trying if OPEN_MAX_CEIL are already open); and so that they can be
  30. sure that everything is closed (when spawning children, for example) if they
  31.  
  32.     for (i = 0; i < OPEN_MAX_CEIL; (void) close(i++));
  33.  
  34. Thanks for the idea of the bounded range are due to Terence Dowling of Rolm,
  35. who's not on the net.
  36.  
  37. There's much more of this sort of thing in the draft standard.  The
  38. alternative to this compile-time approach is a run-time library function
  39. which delivers either all possible information (in which case you get a
  40. fixed-size structure, and lose binary application compatibility if in 
  41. subsequent releases of a particular POSIX-conforming implementation the
  42. amount of information returned increases); or requested items one at a time
  43. in some sort of union.  If anybody would care to submit a proposal along
  44. these lines to the working group, it is likely that it would be gladly
  45. received.
  46.  
  47. Copy relevant correspondence to John S Quarterman, moderator for
  48. comp.std.unix.  He can be reached at ut-sally!std-unix.
  49. [ Or std-unix@sally.utexas.edu.  -mod ]
  50.  
  51. I am
  52. Dominic Dunlop    Phone +44 628 75343
  53. Sphinx Ltd.    UKnet domo@sphinx.co.uk
  54.  
  55. POSIX is a trademark of the IEEE
  56.  
  57. Volume-Number: Volume 11, Number 61
  58.  
  59.