%% David Boyce <[EMAIL PROTECTED]> writes: db> At 10:02 AM 7/30/2006, Paul D. Smith wrote: >> %% Lee Killough <[EMAIL PROTECTED]> writes: lk> Perhaps a larger filehandle number, less likely to occur in common lk> shell redirection idioms, should be used for the jobserver. >> >> Well, pipe(2) doesn't allow you to choose your own file descriptors: it >> just uses the lowest available descriptors. I could use dup2(2) to >> force different ones after the pipe has been created, but there's no >> portable way in POSIX (that I know of) to find the maximum valid file >> descriptor. I guess we could just use OPEN_MAX, if we can figure it >> out.
db> I have something like this in my code. What I chose to do, rather db> than try to determine the max fd, was to pick a number north of (say) db> 50 and south of 256. I try to dup to that and then, if it fails, the db> next 10 values or so (or I guess you could go to 257 or 1025 if so db> inclined). If none of them works, I just drop back to using what the db> OS gave me. ISTM the odds of of this not working are very low and db> even if it doesn't you're no worse off. This seems like a useful thing to do. This is not the first time we've seen people confused by the way make steals low-numbered FDs. Can someone (Lee?) create an enhancement bug request for this in the GNU make project on Savannah so it won't get lost? -- ------------------------------------------------------------------------------- Paul D. Smith <[EMAIL PROTECTED]> Find some GNU make tips at: http://www.gnu.org http://make.paulandlesley.org "Please remain calm...I may be mad, but I am a professional." --Mad Scientist _______________________________________________ Help-make mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-make
