Re: [patch 7/8] fdmap v2 - implement sys_socket2

From: Linus Torvalds
Date: Sun Jun 10 2007 - 14:21:27 EST




On Sun, 10 Jun 2007, Eric Dumazet wrote:

> Linus Torvalds a écrit :
> >
> > close(0);
> > close(1);
> > close(2);
> > .. generate filenames, whatever ..
> > if (open(..) < 0 || open(..) < 0 || open(..) < 0)
> > die("Couldn't redirect stdin/stdout/stderr");
> >
> > and there's absolutely nothing wrong with this kind of setup, even if you
> > could obviously have done it other ways too (ie by using "dup2()" instead of
> > "close + open"),
>
> This kind of setup was OK 25 years ago, before multithreading era.
> You cannot reasonably expect it to work in a multithreaded program.

Who said _anything_ about threading?

The above is a totally non-threaded app. 99% of all applications are like
that.

Threading is for the 1%. But 99% is what we need to make sure works.

Linus