/proc/self/fd is there on Linux but it's not there on Mac OS. However,
they ported the file descriptor access part of /proc to /dev/fd on Mac
OS. On Linux /dev/fd is a link to /proc/self/fd. /dev/fd is actually
there on Solaris 10 too, but it appears to have different semantics
(looks like all fds rather than just the open ones).
So maybe /dev/fd could be used on those platforms to implement a closeall.
Thanks.
Tom
[EMAIL PROTECTED] wrote:
Tom,
I'm open to the idea of using the C code only on Solaris or even
OpenSolaris. For multi-platform projects, I expect that the number of
packages will not be so large that memory size is a problem running
subprocesses. Also, the majority of situations where running a subprocess
is even necessary are OpenSolaris or run-as-root only (driver installation,
SMF, etc.) If we do get to the point where the performance improvement
from this is necessary, we can do the porting of that later.
Rich sent me an off-list e-mail about some other possibilities for
fdwalk. This lead to an inspection of the underlying code for fdwalk,
available here.
http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libc/port/gen/closefrom.c#54
In the optimal case, fdwalk looks at /proc/self/fd to find the list of
open file descriptors. If MacOS and Linux both support this interface,
we could easily write a multi-platform version of closeall and take it
out of the C module. If you're able to check for the existence of
/proc/self/fd on MacOS and Linux, and would like to use posix_spawn on
those platforms, I don't think it should be too hard to re-write this as
a Python function.
Thanks again to Rich for keeping me honest.
-j
begin:vcard
fn:Tom Mueller
n:Mueller;Tom
org:Sun Microsystems, Inc.;SWI Install/Update Software
adr:;;21915 Hillandale Dr;Elkhorn;NE;68022;USA
email;internet:[EMAIL PROTECTED]
title:Senior Staff Engineer
tel;work:877-250-4011
tel;fax:877-250-4011
tel;home:402-916-9943
x-mozilla-html:TRUE
version:2.1
end:vcard
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss