home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!auspex-gw!guy
- From: guy@Auspex.COM (Guy Harris)
- Newsgroups: comp.sys.sun.admin
- Subject: Re: number of windows
- Message-ID: <15393@auspex-gw.auspex.com>
- Date: 7 Nov 92 21:57:09 GMT
- References: <1d8niuINN4le@peanuts.informatik.uni-tuebingen.de>
- Sender: news@auspex-gw.auspex.com
- Organization: Auspex Systems, Santa Clara
- Lines: 53
- Nntp-Posting-Host: bootme.auspex.com
-
- >- Is there a system variable for the possible number of open
- > files/windows?
-
- There is, but it's not the one you want to increase here.
-
- The one you want to increase here is the *per-process* number of open
- files (windows require at least one file descriptor).
-
- "Too many open file" corresponds to the EMFILE error, which is the error
- returned when you run out of per-process file descriptors.
-
- "File table overflow" corresponds to the ENFILE error, which is the
- error returned when you run out of system-wide file table entries.
-
- (The per-process file descriptor table is indexed by the file descriptor
- number, and contains pointers to "file table entries". If the first
- table is full, you get EMFILE; if the second table is full, you get
- ENFILE.)
-
- >- Can this error be handled internally (by the application)?
-
- Handled? Probably not conveniently; once it happens, it may be painful
- to recover.
-
- Staved off? Quite possibly, if you're running SunOS 4.1 or later (which
- you are, as you have SS2's and SS10's); i.e., you can probably prevent
- it from happening in the first place.
-
- > If yes, how?
-
- By bumping the "soft limit" on per-process open files. It's a limit
- like the other "resource limits", read by "getrlimit()", and set by
- "setrlimit()". The limit is RLIMIT_NOFILE:
-
- GETRLIMIT(2) SYSTEM CALLS GETRLIMIT(2)
-
- ...
-
- RLIMIT_NOFILE one more than the maximum value that the
- system may assign to a newly created
- descriptor. This limit constrains the
- number of descriptors that a process may
- create.
-
- so just get the soft and hard limits for RLIMIT_NOFILE with
- "getrlimit()", and set the soft limit to the hard limit with
- "setrlimit()".
-
- This should work under SunOS 5.x as well. In fact, it should work under
- *ANY* SVR4-based system, not just SunOS 5.x (although most SVR4-based
- systems don't support SunView, and even SunOS 5.x only supports it in a
- limited binary-compatibility mode; X11, and various X11-based toolkits,
- are the Wave of the Future there).
-