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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux