Subject: Re: implementing closeall via a syscall
To: Greywolf <>
From: Andrew Brown <>
List: tech-kern
Date: 01/05/2004 15:18:34
>AB> >solaris has closefrom(), which does the same thing (using /proc if I'm
>AB> >not mistaken). So that would be a better name.
>AB> uh...where?
>Solaris 2.8 and above have (paraphrased):
>closefrom(int n): close all fds equal to and above n
>fdwalk(int (*fn)(void *, int), void *callback): generate a list of open
>	file descriptors, passing the pointer to the callback data
>	as the first arg of fn, and passing the value of the open fd
>	from the list as the second arg of fn.

mine don't.  at least, i can't find them mentioned in any library or
header file.

>I would prefer to see a closem() or closefrom() or whatever apply to
>a range of fds as user-defined, i.e. closem(from,to), which closes all
>descriptors from "from" to "to", inclusive, as a program might wish to
>relocate fds 0, 1, 2 to some other place.  closem(from, -1) or
>closem(-1,to) is what I envisioned.  Unadjustably single-ended ranges
>are a major pain, from a programming point of view.

true, true, but this is not our war to fight.  if, on the other hand,
we were to decide to implement something similar, i presume we'd do
the right thing and give it a better name.  :)

|-----< "CODE WARRIOR" >-----|             * "ah!  i see you have the internet (Andrew Brown)                that goes *ping*!"       * "information is power -- share the wealth."