X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Frmr%2Fsi%2Fsrc%2Fsi95%2Fsiinit.c;h=0eaadb6355c209c5ed58d6efffab88aa70638440;hb=fa454008020483ac35e1d20300cddfe877d8dd6d;hp=9159f69872cc9d14ec6deb1055d2754bc2f4ec3a;hpb=0d4def6c7b673f3be486338ced65ccdd25a859ed;p=ric-plt%2Flib%2Frmr.git diff --git a/src/rmr/si/src/si95/siinit.c b/src/rmr/si/src/si95/siinit.c index 9159f69..0eaadb6 100644 --- a/src/rmr/si/src/si95/siinit.c +++ b/src/rmr/si/src/si95/siinit.c @@ -22,16 +22,16 @@ ************************************************************************** * Mnemonic: SIinitialise * Abstract: Initialisation and other context management functions. -* +* * Date: 26 March 1995 * Author: E. Scott Daniels * -* Mod: 17 FEB 2002 - To convert to a globally managed gpointer -* 09 Mar 2007 - To allow for ipv6 (added SIinitialise() to +* Mod: 17 FEB 2002 - To convert to a globally managed gpointer +* 09 Mar 2007 - To allow for ipv6 (added SIinitialise() to * replace SIinit()) ************************************************************************** */ -#include "sisetup.h" // get the setup stuff +#include "sisetup.h" // get the setup stuff /* Initialise the SI environment. Specifically: @@ -42,12 +42,12 @@ */ extern struct ginfo_blk* SIinitialise( int opts ) { - struct ginfo_blk *gptr = NULL; // pointer at gen info blk - int status = SI_OK; // status of internal processing - struct tp_blk *tpptr; // pointer at tp stuff - struct sigaction sact; // signal action block - int i; // loop index - int signals = SI_DEF_SIGS; // signals to be set in SIsetsig + struct ginfo_blk *gptr = NULL; // pointer at gen info blk + int status = SI_OK; // status of internal processing + struct tp_blk *tpptr; // pointer at tp stuff + struct sigaction sact; // signal action block + int i; // loop index + int signals = SI_DEF_SIGS; // signals to be set in SIsetsig errno = ENOMEM; @@ -62,31 +62,28 @@ extern struct ginfo_blk* SIinitialise( int opts ) } memset( gptr->tp_map, 0, sizeof( struct tp_blk *) * MAX_FDS ); - gptr->sierr = SI_ERR_TPORT; - gptr->cbtab = (struct callback_blk *) malloc( (sizeof( struct callback_blk ) * MAX_CBS ) ); if( gptr->cbtab != NULL ) { - for( i = 0; i < MAX_CBS; i++ ) { // initialize callback table - gptr->cbtab[i].cbdata = NULL; // no data and no functions + for( i = 0; i < MAX_CBS; i++ ) { // initialize callback table + gptr->cbtab[i].cbdata = NULL; // no data and no functions gptr->cbtab[i].cbrtn = NULL; } - } else { // if call back table allocation failed - error off - SIshutdown( gptr ); // clean up any open fds + } else { // if call back table allocation failed - error off + SIshutdown( gptr ); // clean up any open fds + free( gptr->tp_map ); free( gptr ); - gptr = NULL; // dont allow them to continue + gptr = NULL; // dont allow them to continue } + } // end if gen infor block allocated successfully - gptr->sierr = SI_OK; - } // end if gen infor block allocated successfully - memset( &sact, 0, sizeof( sact ) ); sact.sa_handler = SIG_IGN; sigaction( SIGPIPE, &sact, NULL ); // ignore pipe signals as for some bloody reason linux sets this off if write to closed socket - return gptr; // all's well that ends well -} + return gptr; // all's well that ends well +} /* This will set all of the tcp oriented flags in mask (SI_TF_* constants).