* Dag-Erling Sm??rgrav <[email protected]> [090529 02:49] wrote: > Alfred Perlstein <[email protected]> writes: > > Dag-Erling Sm??rgrav <[email protected]> writes: > > > Usually, what you see is closer to this: > > > > > > if ((pid = fork()) == 0) { > > > for (int fd = 3; fd < getdtablesize(); ++fd) > > > (void)close(fd); > > > execve(path, argv, envp); > > > _exit(1); > > > } > > > > I'm probably missing something, but couldn't you iterate > > in the parent setting the close-on-exec flag then vfork? > > This is an example, Alfred. Like most examples, it is greatly > simplified. I invite you to peruse the source to find real-world > instances of non-trivial fork() / execve() usage.
It wasn't meant to critisize, just ask a question for the specific instance because it made me curious. I know how bad it can be with vfork as I observed a few fixes involving mistaken use of vfork at another job. So yes, there's more than one way to skin a cat for this particular example... but in practice using vfork()+exec() is hard to get right? -- - Alfred Perlstein _______________________________________________ [email protected] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[email protected]"

