GNOME Bugzilla – Bug 357585
Calls to set_cloexec inefficient on Solaris
Last modified: 2006-12-15 08:02:49 UTC
Traversing all possible fds and calling set_cloexec in gspawn.c is inefficient on SOlaris. The function fdwalk should be used. I will supply a patch
Created attachment 73366 [details] [review] Proposed patch to use fdwalk if available
I think we don't want the #ifdef __sun here: +#ifdef __sun +#include <stdlib.h> +#endif I'd rather make that #include <stdlib.h> /* for fdwalk */
Yes. Sorry about that.
Actually, I think it would be nicer to restructure our cloexec code to simple implement fdwalk if it is not available.
Created attachment 73782 [details] [review] alternative patch Does this look ok ?
Created attachment 73829 [details] man page for fdwalk This work for me. You might want to consider making fdwalk return a value. I have attached fdwalk man page for reference.
There was an error in my original patch. The function fdwalk should call return (0);
2006-12-15 Matthias Clasen <mclasen@redhat.com> Fix #357585, Padraig O'Briain. * configure.in: Check for fdwalk. * glib/gspawn.c (do_exec): Use fdwalk() to close all file descriptors. * glib/gspawn.c (fdwalk): Fallback implementation of fdwalk.
This patch caused the build to fail: http://jhbuild.bxlug.be/builds/2006-12-15-0005/logs/glib/#build