This is the mail archive of the cygwin mailing list for the Cygwin 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_SETSIZE and sizeof(fd_set)

On 6/23/2016 6:54 AM, Steven Bardwell wrote:

Here is a "program" that shows the issue I am worried about. It is so simple that I must be overlooking something really obvious:

#include <stdio.h>
#define FD_SETSIZE 256
#include <sys/types.h>
#include <sys/select.h>

        fd_set rfds;
        fprintf(stdout, "FD_SETSIZE=%d\n", FD_SETSIZE);
        fprintf(stdout, "sizeof(fd_set)=%d\n", sizeof(fd_set));

Steve Bardwell

I don't know if this is still the case, but when I looked into this years ago I found that it was not possible to change the size of the fd set in linux, it's fixed at 1024 (generally), unless you rebuild the kernel.

Secondly, in the windows api, their version of an fd_set is more like a poll() implementation, you can fake out any size you want since the size of the array is the first entry.

I can't speak for the cygwin implementations, but if they offer poll() or, better, epoll(), use those.


Problem reports:
Unsubscribe info:

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