Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!rpi!night From: night@itsgw.rpi.edu (Trip Martin) Newsgroups: comp.unix.questions Subject: Re: Starting a daemon on a SVR3 Message-ID: Date: 4 Jan 91 13:13:38 GMT References: <25360@adm.brl.mil> <1752@dschub.dsc.com> <1991Jan03.132149.3565@scuzzy.in-berlin.de> <316@bria.AIX> Reply-To: night@rpi.edu Lines: 24 Nntp-Posting-Host: jec424.its.rpi.edu mike@bria.AIX (Mike Stefanik/78125) writes: >In article <1991Jan03.132149.3565@scuzzy.in-berlin.de> src@scuzzy.in-berlin.de (Heiko Blume) writes: >[question about closing all open file descriptors] >>yes [if you have posix stuff]: >Since file descriptors are guaranteed to be assigned sequentially; whynot >simply do: > i=0; > while ( close(i++) != -1 ) > ; This won't work because there's nothing stopping the program from closing file descriptors. As an example, suppose the process had open file descriptors 0 through 7, and then closed 3. This code would leave open 4 through 7. -- Trip Martin night@rpi.edu -- Trip Martin night@rpi.edu