[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Poll's grænse



Hej kodere

Jeg er ved at opdatere noget server software skrevet i C. Det havde et problem med antallet af forbindelser, da det brugte select kaldet til at finde filedescriptors, som var klar til læsning/skrivning/havde fejl. Den magiske grænse var på 1024 filedescriptors (bestemt af FD_SETSIZE) og denne grænse kan kun ændres ved at recompile glibc (så vidt jeg ved), og det vil jeg helst undgå.

Derfor har jeg skrevet koden om til at bruge poll, som ikke skulle have en grænse....men det har den, stadigvæk 1024. Der står i manual siden, at poll kan sætte errno til enten EBADF, ENOMEM, EFAULT eller EINTR, men jeg har følgende kode:

////////Kode start///////////////
       selres = poll(PollList, PollListSize, PollTimeout);

if (selres < 0)
{
switch(errno) {
case EBADF: fprintf(stderr,"An invalid file descriptor was given in one of the sets.\n");break;
case ENOMEM: fprintf(stderr,"There was no space to allocate file descriptor tables.\n");break;
case EFAULT: fprintf(stderr,"The array given as argument was not contained in the calling program's address space.\n");break;
case EINTR: fprintf(stderr,"A signal occurred before any requested event.\n");break;
default: fprintf(stderr,"UNKNOWN: %d\n",errno);
}
//Noget mere som afslutter programmet
}
////////Kode slut///////////


Og jeg får altid "UNKNOWN: 22" hvis jeg sætter PollListSize større end 1023. Der er ingen problemer når PollListSize er mindre end eller lig med 1023. Jeg bruger ikke tråde.
I manual siden står der yderligere at poll KAN være emuleret med select, men jeg har læst, at det faktisk skulle være omvendt fra kerne 2.2.x og frem. Jeg kører kerne 2.4.27.


Nogen der ved hvad problemet er ?
Eller en mulig løsning ?

Venlig hilsen
Robert


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 22:44 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *