Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!ut-sally!std-unix From: henry@utzoo.UUCP (Henry Spencer) Newsgroups: comp.std.unix Subject: Re: - copy of item posted to comp.unix.wizards Message-ID: <8297@ut-sally.UUCP> Date: Wed, 17-Jun-87 16:30:43 EDT Article-I.D.: ut-sally.8297 Posted: Wed Jun 17 16:30:43 1987 Date-Received: Mon, 22-Jun-87 02:09:16 EDT References: <3635@spool.WISC.EDU> <292@olamb.UUCP>, <8261@ut-sally.UUCP> Sender: std-unix@ut-sally.UUCP Reply-To: henry@utzoo.UUCP (Henry Spencer) Lines: 22 Approved: jsq@sally.utexas.edu (Moderator, John Quarterman) From: henry@utzoo.UUCP (Henry Spencer) > Agreed that finding out how many files you have to close in order to be > sure you've closed them all is a pain on most implementations of UN*X. > IEEE 1003.1 is attempting to address this... Actually, one way to solve this *particular* problem without the nastiness of the general case would be to have close() yield EBADF (as it does now) for a legal-but-not-open descriptor number and EDOM for a descriptor number beyond the implementation's limit. (1003 doesn't currently include EDOM in its error-number list, since in existing implementations it's not returned by the kernel, but adding it shouldn't hurt anything.) Another alternative would be to vary the code based on whether there is a higher-numbered descriptor still open or not. It's no problem for the kernel to keep track of the highest open descriptor, so that the decision can be made quickly even on a system that allows lots of descriptors. Henry Spencer @ U of Toronto Zoology {allegra,ihnp4,decvax,pyramid}!utzoo!henry Volume-Number: Volume 11, Number 70