This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: FD_SET and FORTIFY_SOURCE


(3/25/13 1:04 PM), Carlos O'Donell wrote:
> On 03/24/2013 04:17 PM, KOSAKI Motohiro wrote:
>> 1. only turn on __FD_ELT check when running on hurd.
>> 2. only turn on __FD_ELT check when defined some specific macro. (e.g.
>> likes darwin,
>>     but disable by default)
>> 2-2. make FORTIFY_SOURCE variant and check POSIX compliance if enabled.
>> 3. provide select_large_fdset() likes solaris. (I strongly don't
>> recommend. all application
>>     need to modify and recompilation)
>>
>> What do you think?
> 
> The value of __FD_SETSIZE is part of the ABI and can't be changed.

??
We never discuss to change __FD_SETSIZE. A lot of UNIX support >FD_SETSIZE,
but didn't change FD_SETSIZE.


> Imagine one library using a value >1024 while another uses one
> that has a value ==1024. You would have to recompile all of userspace
> to ensure it works reliable and that's what we call an ABI breakage.
> 
> Therefore #1, #2, and #2-2 would break the ABI.

I disagree.
See my last mail, cut-n-paste from BSDs manuals.

		   fd_set *fdsr;
                   int max = fd;

                   fdsr = (fd_set *)calloc(howmany(max+1, NFDBITS),
                       sizeof(fd_mask));
                   if (fdsr == NULL) {
                           ...
                           return (-1);
                   }
                   FD_SET(fd, fdsr);
                   n = select(max+1, fdsr, NULL, NULL, &tv);
                   ...
                   free(fdsr);

This howmany usage mean, keep FD_SETSIZE small, but allow larger bitmap
by allocate fd_set from heap.

Again, Linux already support >FD_SETSIZE over 15 years. I don't talk about
new enhancement.



> The only option is #3, as Solaris did, and they probably did it 
> exactly for this reason.
> 
> Alternatively rewrite using poll/epoll.

As far as I know, all of moder scripting language expose select interface to scripting
and poll has different semantics against select(2). That makes no sense.

One of the way is, to avoid to use FD_SET and other FD_* family likes perl.
perf enforce users to make fd bitmap by themself (by using vec()).

http://perldoc.perl.org/functions/select.html

But, it is extream ugly and useless. I don't think this makes a lot of sense.

> 
> Does that make sense?
> 
> Cheers,
> Carlos.
>  
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]