But for an application that (imho) is poorly written but IS COMPLIANT, it
fails.
This program is compliant, if your ulimit -n is maxxed out at 1048576.
I'm not saying it is good design, but it is compliant. The patch hurts
nothing and makes poll() that little bit more friendly.
#include <stdio.h>
#include <sys/poll.h>
#include <errno.h>
#include <string.h>
int
main(void)
{
static struct pollfd ar[1024*1024];
int size = sizeof(ar)/sizeof(*ar);
int i;
for (i = 0; i < size; i++)
ar[i].fd = -1;
ar[1000000].fd = 0;
ar[1000000].events = POLLIN;
i = poll(ar, size, -1);
printf("return = %d (%s)\n", i, i?strerror(errno):"success");
return 0;
}
-- Tim Hockin Systems Software Engineer Sun Microsystems, Cobalt Server Appliances thockin@sun.com - 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/