caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Closing all open file descriptors
@ 2007-09-13 22:56 Dave Benjamin
  2007-09-14  1:04 ` [Caml-list] " Erik de Castro Lopo
                   ` (4 more replies)
  0 siblings, 5 replies; 30+ messages in thread
From: Dave Benjamin @ 2007-09-13 22:56 UTC (permalink / raw)
  To: Caml List

I'm writing a daemon and I would like to be able to close all open file 
descriptors. As far as I can tell, there is no way to determine the 
maximum number of file descriptors available, and neither is there a way 
to get a file descriptor from an integer. The best I've come up with is 
the following:

   for fd = 0 to 1024 do
     try Unix.close (Obj.magic fd : Unix.file_descr)
     with Unix.Unix_error _ -> ()
   done;

Is there a better way?

Thanks,
Dave


^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2007-09-17 11:00 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-13 22:56 Closing all open file descriptors Dave Benjamin
2007-09-14  1:04 ` [Caml-list] " Erik de Castro Lopo
2007-09-14  6:35   ` Dave Benjamin
2007-09-14  6:48     ` Erik de Castro Lopo
2007-09-14  7:32       ` Dave Benjamin
2007-09-14  6:33 ` David Allsopp
2007-09-14  6:41   ` Dave Benjamin
2007-09-14 10:54     ` Andre Nathan
2007-09-14 10:00   ` Mattias Engdegård
2007-09-14 20:31     ` Dave Benjamin
2007-09-14 21:52       ` Oliver Bandel
2007-09-14 22:12         ` Markus E L
2007-09-15  9:15           ` Oliver Bandel
2007-09-15  9:26             ` Erik de Castro Lopo
2007-09-15 10:43               ` Oliver Bandel
2007-09-15 11:36                 ` Mattias Engdegård
2007-09-15 11:57                   ` Oliver Bandel
2007-09-15 14:27                     ` Markus E L
2007-09-15 12:16                   ` Oliver Bandel
2007-09-15 14:29                     ` Markus E L
2007-09-15 18:04                       ` skaller
2007-09-15 14:17                   ` Markus E L
2007-09-15 14:16                 ` Markus E L
2007-09-15 15:58                   ` Eric Cooper
2007-09-15 16:17                     ` Markus E L
2007-09-15 18:33                       ` skaller
2007-09-15 17:44                   ` skaller
2007-09-14 10:10 ` Gerd Stolpmann
2007-09-14 11:56 ` Oliver Bandel
2007-09-17 11:00 ` Ville-Pertti Keinonen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).