Hi !
I'm currently working on making an existing app a universal binary. I have noticed that my select() code that worked fine in ppc stops working when running on intel when I have more than 1024 active file descriptors (I'm accessing disk files (sometime LOTS of them) and tcpip sockets). Is there some detail that I'm missing ? I checked and all my disk files are correctly opened (even if way over 1024), only my select call returns -1 (when it should return otherwise). I see all my sockets with data waiting to be read when I run netstat at the same time...
here's what I do : (I trimmed the code)
struct timeval tv = {0, 0}; struct fd_set *readfd_set = nil; struct fd_set *writefd_set = nil;
if (maxDescriptor > -1) { readfd_set =(fd_set *)calloc(howmany(maxDescriptor + 2, NFDBITS), sizeof(int32_t)); writefd_set =(fd_set *)calloc(howmany(maxDescriptor + 2, NFDBITS), sizeof(int32_t)); } else { return FALSE;
}
int numDescriptorSet = select(maxDescriptor + 1, readfd_set, writefd_set, nil, &tv);
numDesciptorSet is -1 100% of the time when maxDescriptor > 1024 !!
thanks for any tip !
|