| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Thom Brown <thom(at)linux(dot)com> |
| Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: FD_SETSIZE on Linux? |
| Date: | 2014-09-09 23:21:01 |
| Message-ID: | 13030.1410304861@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Thom Brown <thom(at)linux(dot)com> writes:
> I find this in pgbench.c:
> #ifdef FD_SETSIZE
> #define MAXCLIENTS (FD_SETSIZE - 10)
> #else
> #define MAXCLIENTS 1024
> #endif
FD_SETSIZE is supposed to be defined, according to the POSIX spec:
The <sys/select.h> header shall define the following symbolic constant,
which shall have a value suitable for use in #if preprocessing directives:
FD_SETSIZE
Maximum number of file descriptors in an fd_set structure.
It looks like Linux sets it to 1024. On RHEL6, at least, I find this:
$ grep -r FD_SETSIZE /usr/include
/usr/include/linux/posix_types.h:#undef __FD_SETSIZE
/usr/include/linux/posix_types.h:#define __FD_SETSIZE 1024
...
/usr/include/sys/select.h:#define FD_SETSIZE __FD_SETSIZE
...
> #ifdef WIN32
> #define FD_SETSIZE 1024 /* set before winsock2.h is included */
> #endif /* ! WIN32 */
Windows probably hasn't got sys/select.h at all, so it may not provide
this symbol.
Interestingly, it looks like POSIX also requires <sys/time.h> to define
FD_SETSIZE. I wonder whether Windows has that header? It'd definitely
be better to get this symbol from the system than assume 1024 will work.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Kyotaro HORIGUCHI | 2014-09-10 00:04:21 | Re: Escaping from blocked send() reprised. |
| Previous Message | Tomas Vondra | 2014-09-09 22:49:37 | Re: bad estimation together with large work_mem generates terrible slow hash joins |