Starting a daemon on a SVR3

Mike Stefanik/78125 mike at bria.AIX
Fri Jan 4 16:48:53 AEST 1991


In article <1991Jan03.132149.3565 at scuzzy.in-berlin.de> src at scuzzy.in-berlin.de (Heiko Blume) writes:
[question about closing all open file descriptors]
>yes [if you have posix stuff]:
>
>    for ( i = 0 ; i < sysconf(_SC_OPEN_MAX) ; i++ )
>	close( i );

Since file descriptors are guaranteed to be assigned sequentially; whynot
simply do:

	i=0;
	while ( close(i++) != -1 )
		;

This would work without any soon-to-be-defunct #define's, and any gee-what-
is-POSIX libraries.  Just a thought.

-----------------------------------------------------------------------------
Michael Stefanik, Systems Engineer (JOAT), Briareus Corporation
UUCP: ...!uunet!bria!mike
"If it was hard to code, it should be harder to use!"



More information about the Comp.unix.questions mailing list