home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sys / sun / admin / 8058 < prev    next >
Encoding:
Internet Message Format  |  1992-11-08  |  2.4 KB

  1. Path: sparky!uunet!auspex-gw!guy
  2. From: guy@Auspex.COM (Guy Harris)
  3. Newsgroups: comp.sys.sun.admin
  4. Subject: Re: number of windows
  5. Message-ID: <15393@auspex-gw.auspex.com>
  6. Date: 7 Nov 92 21:57:09 GMT
  7. References: <1d8niuINN4le@peanuts.informatik.uni-tuebingen.de>
  8. Sender: news@auspex-gw.auspex.com
  9. Organization: Auspex Systems, Santa Clara
  10. Lines: 53
  11. Nntp-Posting-Host: bootme.auspex.com
  12.  
  13. >- Is there a system variable for the possible number of open
  14. > files/windows?
  15.  
  16. There is, but it's not the one you want to increase here.
  17.  
  18. The one you want to increase here is the *per-process* number of open
  19. files (windows require at least one file descriptor).
  20.  
  21. "Too many open file" corresponds to the EMFILE error, which is the error
  22. returned when you run out of per-process file descriptors.
  23.  
  24. "File table overflow" corresponds to the ENFILE error, which is the
  25. error returned when you run out of system-wide file table entries.
  26.  
  27. (The per-process file descriptor table is indexed by the file descriptor
  28. number, and contains pointers to "file table entries".  If the first
  29. table is full, you get EMFILE; if the second table is full, you get
  30. ENFILE.)
  31.  
  32. >- Can this error be handled internally (by the application)?
  33.  
  34. Handled?  Probably not conveniently; once it happens, it may be painful
  35. to recover.
  36.  
  37. Staved off?  Quite possibly, if you're running SunOS 4.1 or later (which
  38. you are, as you have SS2's and SS10's); i.e., you can probably prevent
  39. it from happening in the first place.
  40.  
  41. > If yes, how?
  42.  
  43. By bumping the "soft limit" on per-process open files.  It's a limit
  44. like the other "resource limits", read by "getrlimit()", and set by
  45. "setrlimit()".  The limit is RLIMIT_NOFILE:
  46.  
  47. GETRLIMIT(2)              SYSTEM CALLS               GETRLIMIT(2)
  48.  
  49.     ...
  50.  
  51.      RLIMIT_NOFILE       one more than the maximum value that the
  52.                          system  may  assign  to  a newly created
  53.                          descriptor.  This limit  constrains  the
  54.                          number of descriptors that a process may
  55.                          create.
  56.  
  57. so just get the soft and hard limits for RLIMIT_NOFILE with
  58. "getrlimit()", and set the soft limit to the hard limit with
  59. "setrlimit()".
  60.  
  61. This should work under SunOS 5.x as well.  In fact, it should work under
  62. *ANY* SVR4-based system, not just SunOS 5.x (although most SVR4-based
  63. systems don't support SunView, and even SunOS 5.x only supports it in a
  64. limited binary-compatibility mode; X11, and various X11-based toolkits,
  65. are the Wave of the Future there).
  66.