Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!ut-sally!im4u!rutgers!ames!hao!husc6!cmcl2!brl-adm!adm!bzs@bu-cs.bu.EDU From: bzs@bu-cs.bu.EDU (Barry Shein) Newsgroups: comp.unix.wizards Subject: Determining the max number of open files on System V Message-ID: <7730@brl-adm.ARPA> Date: Sun, 7-Jun-87 13:08:56 EDT Article-I.D.: brl-adm.7730 Posted: Sun Jun 7 13:08:56 1987 Date-Received: Thu, 11-Jun-87 01:18:59 EDT Sender: news@brl-adm.ARPA Lines: 30 From: "Kim Chr. Madsen" >If you just want to know the actual number run the command "/etc/sysdef", >which gives you the current settings of the turnable kernel parameters >and other system information. Or look into the /etc/master.d/kernel file. > >But if you want to inspect the max. number of open files at runtime, you >must use the value stored in the kernel. > >> Please, don't tell me I have to muck around in kernel memory! Or just fork off an /etc/sysdef as part of the runtime startup of your program and get it out of that, maybe use awk to help pluck it out, consider using popen() or system() into a temp file, or just wrap your program in a little shell program and feed the value you need in from the top, say as a command line flag, backquotes come in handy here. I've written a number of programs which use things like ps and ls to get info while maximizing portability, they don't take much longer than you doing the same exact groveling and it's much easier to get working, and works or is trivially fixable when the next release is put up on your system or you need to move to a variant. I'd recommend using a subroutine which forks the job simply because on 4.x you can use getdtablesize() so it would be trivial to conditionalize at compile-time. Remember guys, this is Unix, we keep forks cheap for a reason, why reinvent the wheel? -Barry Shein, Boston University