X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Frmr%2Fsi%2Fsrc%2Fsi95%2Fsibldpoll.c;h=81817383694559da25b019650f5f2ad5ed211321;hb=11838bcf76f3614384459cb56e2ce80dea788cef;hp=fda092149a1b69c7e282a81420371fd2cb1a543f;hpb=ec88d3c0563eeb6ae5f73427edb0b3c4d7acf299;p=ric-plt%2Flib%2Frmr.git diff --git a/src/rmr/si/src/si95/sibldpoll.c b/src/rmr/si/src/si95/sibldpoll.c index fda0921..8181738 100644 --- a/src/rmr/si/src/si95/sibldpoll.c +++ b/src/rmr/si/src/si95/sibldpoll.c @@ -27,6 +27,7 @@ * be added to the write fdset. The fdcount variable will be set to * the highest sid + 1 and it can be passed to the select system * call when it is made. +* * Parms: gptr - Pointer to the general info structure * Returns: Nothing * Date: 26 March 1995 @@ -42,50 +43,39 @@ extern void SIbldpoll( struct ginfo_blk* gptr ) { struct tp_blk *nextb; // pointer into tp list -// FIX ME? we don't seem to see this flag set - //if( gptr->flags & GIF_SESS_CHANGE ) { // session changed, must rebuild the poll lists - gptr->fdcount = -1; // reset largest sid found + gptr->fdcount = -1; // reset largest sid found + + FD_ZERO( &gptr->readfds ); // reset the read and write sets + FD_ZERO( &gptr->writefds ); + FD_ZERO( &gptr->execpfds ); - FD_ZERO( &gptr->readfds ); // reset the read and write sets - FD_ZERO( &gptr->writefds ); - FD_ZERO( &gptr->execpfds ); - - for( tpptr = gptr->tplist; tpptr != NULL; tpptr = nextb ) { - nextb = tpptr->next; - if( tpptr->flags & TPF_DELETE ) { + tpptr = gptr->tplist; + while( tpptr != NULL ) { + nextb = tpptr->next; // point past allowing for a delete + + if( tpptr->flags & TPF_DELETE ) { + if( tpptr->fd >= 0 ) { // wasn't closed for some reason SIterm( gptr, tpptr ); - } else { - if( tpptr->fd >= 0 ) { // if valid file descriptor - if( tpptr->fd >= gptr->fdcount ) { - gptr->fdcount = tpptr->fd + 1; // save largest fd (+1) for select - } - - FD_SET( tpptr->fd, &gptr->execpfds ); // set all fds for execpts - - if( !(tpptr->flags & TPF_DRAIN) ) { // if not draining - FD_SET( tpptr->fd, &gptr->readfds ); // set test for data flag - } - - if( tpptr->squeue != NULL ) { // stuff pending to send ? - FD_SET( tpptr->fd, &gptr->writefds ); // set flag to see if writable - } - } } + SIrm_tpb( gptr, tpptr ); // safe to remove the block from the list in this thread + } else { + if( tpptr->fd >= 0 ) { // if valid file descriptor + if( tpptr->fd >= gptr->fdcount ) { + gptr->fdcount = tpptr->fd + 1; // save largest fd (+1) for select + } -/* - memcpy( &gptr->readfds_qs, &gptr->readfds, sizeof( fd_set ) ); // stash for use until change - memcpy( &gptr->writefds_qs, &gptr->writefds, sizeof( fd_set ) ); - memcpy( &gptr->execpfds_qs, &gptr->execpfds, sizeof( fd_set ) ); -*/ + FD_SET( tpptr->fd, &gptr->execpfds ); // set all fds for execpts - gptr->flags &= ~GIF_SESS_CHANGE; + if( !(tpptr->flags & TPF_DRAIN) ) { // if not draining + FD_SET( tpptr->fd, &gptr->readfds ); // set test for data flag + } + + if( tpptr->squeue != NULL ) { // stuff pending to send ? + FD_SET( tpptr->fd, &gptr->writefds ); // set flag to see if writable + } + } } -/* - } else { // sessions are the same we can just dup the quick sets we saved - memcpy( &gptr->readfds, &gptr->readfds_qs, sizeof( fd_set ) ); - memcpy( &gptr->writefds, &gptr->writefds_qs, sizeof( fd_set ) ); - memcpy( &gptr->execpfds, &gptr->execpfds_qs, sizeof( fd_set ) ); - } -*/ -} // SIbldpoll + tpptr = nextb; + } +}