1 // vim: noet sw=4 ts=4:
3 ==================================================================================
4 Copyright (c) 2020 Nokia
5 Copyright (c) 2020 AT&T Intellectual Property.
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
11 http://www.apache.org/licenses/LICENSE-2.0
13 Unless required by applicable law or agreed to in writing, software
14 distributed under the License is distributed on an "AS IS" BASIS,
15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 See the License for the specific language governing permissions and
17 limitations under the License.
18 ==================================================================================
22 *****************************************************************************
24 * Abstract: This routine will fill in the read and write fdsets in the
25 * general info struct based on the current transport provider
26 * list. Those tb blocks that have something queued to send will
27 * be added to the write fdset. The fdcount variable will be set to
28 * the highest sid + 1 and it can be passed to the select system
29 * call when it is made.
31 * Parms: gptr - Pointer to the general info structure
34 * Author: E. Scott Daniels
36 ***************************************************************************
38 #include "sisetup.h" // get definitions etc
39 #include "sitransport.h"
41 extern void SIbldpoll( struct ginfo_blk* gptr ) {
42 struct tp_blk *tpptr; // pointer into tp list
43 struct tp_blk *nextb; // pointer into tp list
46 gptr->fdcount = -1; // reset largest sid found
48 FD_ZERO( &gptr->readfds ); // reset the read and write sets
49 FD_ZERO( &gptr->writefds );
50 FD_ZERO( &gptr->execpfds );
53 while( tpptr != NULL ) {
54 nextb = tpptr->next; // point past allowing for a delete
56 if( tpptr->flags & TPF_DELETE ) {
57 if( tpptr->fd >= 0 ) { // wasn't closed for some reason
58 SIterm( gptr, tpptr );
60 SIrm_tpb( gptr, tpptr ); // safe to remove the block from the list in this thread
62 if( tpptr->fd >= 0 ) { // if valid file descriptor
63 if( tpptr->fd >= gptr->fdcount ) {
64 gptr->fdcount = tpptr->fd + 1; // save largest fd (+1) for select
67 FD_SET( tpptr->fd, &gptr->execpfds ); // set all fds for execpts
69 if( !(tpptr->flags & TPF_DRAIN) ) { // if not draining
70 FD_SET( tpptr->fd, &gptr->readfds ); // set test for data flag
73 if( tpptr->squeue != NULL ) { // stuff pending to send ?
74 FD_SET( tpptr->fd, &gptr->writefds ); // set flag to see if writable