lkml.org 
[lkml]   [2007]   [Jun]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch 7/8] fdmap v2 - implement sys_socket2
On Sun, 10 Jun 2007, Paul Mackerras wrote:

> > for (i = 0; i < NR_OPEN; i++)
> > if (!fd_is_special_to_us(i))
> > close(i);
> >
> > Note that this is conceptually buggy, but occurs in several major C
> > programming books, most of the major shells, and a lot of other
> > software to boot.
>
> Buggy in what way? In the use of the NR_OPEN constant?

That is typical daemonize code done by quite a few apps, and even
described in many unix network programming books. Now say that before that
you loaded a library that had an internal fd allocated to get some sort of
services from the kernel (say an epoll fd). What happens when the library
uses the cached apoll fd after that loop?



- Davide


-
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/

\
 
 \ /
  Last update: 2007-06-10 17:59    [W:0.123 / U:0.560 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site