Mark Grosberg wrote:
> fmap[0] = in[0]; /* STDIN */
> fmap[1] = out[1]; /* STDOUT */
> fmap[2] = open("/dev/null", O_RDWR); /* STDERR */
> fmap[3] = -1; /* end */
>
> p = nexec("/bin/cat",
> null_argv,
> NULL,
> filmap);
How about
fdrplc(3,fmap);
exec("/bin/cat",...);
?
0) System call names must be short and cryptic :-)
1) Requiring the kernel to iterate over the array element by element
in order to find out how big it is may be inefficient. Better to
pass the length.
2) System call overhead is marginal, particularly in this case.
3) There may be other uses than exec(2), where a way for closeing
all fds and getting a new set may be useful.
- Werner
-- _________________________________________________________________________ / Werner Almesberger, Buenos Aires, Argentina wa@almesberger.net / /_http://www.almesberger.net/____________________________________________/ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Wed Apr 30 2003 - 22:00:28 EST