diff --git a/src/ca/access.cpp b/src/ca/access.cpp index 032c7b575..85d654acb 100644 --- a/src/ca/access.cpp +++ b/src/ca/access.cpp @@ -33,7 +33,7 @@ threadPrivateId cacRecursionLock; static threadOnceId caClientContextIdOnce = OSITHREAD_ONCE_INIT; -static void ca_client_exit_handler () +extern "C" void ca_client_exit_handler () { if ( caClientContextId ) { threadPrivateDelete ( caClientContextId ); @@ -42,7 +42,7 @@ static void ca_client_exit_handler () } // runs once only for each process -static void ca_init_client_context ( void * ) +extern "C" void ca_init_client_context ( void * ) { caClientContextId = threadPrivateCreate (); if ( caClientContextId ) { diff --git a/src/ca/caConnTest.cpp b/src/ca/caConnTest.cpp index 170b6f6bc..6f1bb3a82 100644 --- a/src/ca/caConnTest.cpp +++ b/src/ca/caConnTest.cpp @@ -12,7 +12,7 @@ static bool subsequentConnect = false; osiTime begin; -static void connHandler ( struct connection_handler_args args ) +extern "C" void caConnTestConnHandler ( struct connection_handler_args args ) { if ( args.op == CA_OP_CONN_UP ) { if ( connCount == 0u ) { @@ -71,7 +71,8 @@ void caConnTest ( const char *pNameIn, unsigned channelCountIn, double delayIn ) printf ( "creating channels\n" ); for ( i = 0u; i < channelCount; i++ ) { - status = ca_search_and_connect ( pNameIn, &pChans[i], connHandler, 0 ); + status = ca_search_and_connect ( pNameIn, + &pChans[i], caConnTestConnHandler, 0 ); SEVCHK ( status, "CA search problems" ); } diff --git a/src/ca/cac.cpp b/src/ca/cac.cpp index 49fb3ab1a..78ee46636 100644 --- a/src/ca/cac.cpp +++ b/src/ca/cac.cpp @@ -21,7 +21,7 @@ #include "nciu_IL.h" #include "ioCounter_IL.h" -static void cacRecursionLockExitHandler () +extern "C" void cacRecursionLockExitHandler () { if ( cacRecursionLock ) { threadPrivateDelete ( cacRecursionLock ); @@ -29,7 +29,7 @@ static void cacRecursionLockExitHandler () } } -static void cacInitRecursionLock ( void * ) +extern "C" void cacInitRecursionLock ( void * ) { cacRecursionLock = threadPrivateCreate (); if ( cacRecursionLock ) { diff --git a/src/ca/getCallback.cpp b/src/ca/getCallback.cpp index 0f47e48a5..97c273be4 100644 --- a/src/ca/getCallback.cpp +++ b/src/ca/getCallback.cpp @@ -34,6 +34,11 @@ void getCallback::destroy () delete this; } +void getCallback::completionNotify () +{ + cacNotify::completionNotify (); +} + void getCallback::completionNotify ( unsigned type, unsigned long count, const void *pData ) { struct event_handler_args args; @@ -46,8 +51,7 @@ void getCallback::completionNotify ( unsigned type, unsigned long count, const v (*this->pFunc) (args); } -void getCallback::exceptionNotify (int status, - const char * /* pContext */) +void getCallback::exceptionNotify (int status, const char * /* pContext */) { struct event_handler_args args; args.usr = this->pPrivate; @@ -59,6 +63,12 @@ void getCallback::exceptionNotify (int status, (*this->pFunc) (args); } +void getCallback::exceptionNotify ( int status, const char *pContext, + unsigned type, unsigned long count ) +{ + cacNotify::exceptionNotify ( status, pContext, type, count); +} + void * getCallback::operator new ( size_t size ) { return getCallback::freeList.allocate ( size ); diff --git a/src/ca/oldAccess.h b/src/ca/oldAccess.h index 10617b844..515060247 100644 --- a/src/ca/oldAccess.h +++ b/src/ca/oldAccess.h @@ -60,8 +60,10 @@ private: caEventCallBackFunc *pFunc; void *pPrivate; ~getCallback (); // allocate only out of pool - virtual void completionNotify (unsigned type, unsigned long count, const void *pData); - virtual void exceptionNotify (int status, const char *pContext); + void completionNotify (); + void completionNotify (unsigned type, unsigned long count, const void *pData); + void exceptionNotify (int status, const char *pContext); + void exceptionNotify ( int status, const char *pContext, unsigned type, unsigned long count ); static tsFreeList < class getCallback, 1024 > freeList; }; @@ -78,8 +80,10 @@ private: caEventCallBackFunc *pFunc; void *pPrivate; ~putCallback (); // allocate only out of pool - virtual void completionNotify (); - virtual void exceptionNotify ( int status, const char *pContext ); + void completionNotify (); + void completionNotify ( unsigned type, unsigned long count, const void *pData ); + void exceptionNotify ( int status, const char *pContext ); + void exceptionNotify ( int status, const char *pContext, unsigned type, unsigned long count ); static tsFreeList < class putCallback, 1024 > freeList; }; @@ -98,8 +102,10 @@ private: caEventCallBackFunc *pFunc; void *pPrivate; + void completionNotify (); void completionNotify ( unsigned type, unsigned long count, const void *pData ); void exceptionNotify ( int status, const char *pContext ); + void exceptionNotify ( int status, const char *pContext, unsigned type, unsigned long count ); ~oldSubscription (); // must allocate from pool static tsFreeList < struct oldSubscription, 1024 > freeList; diff --git a/src/ca/oldChannel.cpp b/src/ca/oldChannel.cpp index 003ae65c9..f7835e8bc 100644 --- a/src/ca/oldChannel.cpp +++ b/src/ca/oldChannel.cpp @@ -27,7 +27,7 @@ tsFreeList < struct oldChannel, 1024 > oldChannel::freeList; * out so that we will not decrement the pending * recv count in the future. */ -static void cacAlreadyConnHandler (struct connection_handler_args) +extern "C" void cacAlreadyConnHandler ( struct connection_handler_args ) { } diff --git a/src/ca/oldSubscription.cpp b/src/ca/oldSubscription.cpp index fa1d9a99a..80aa97ec4 100644 --- a/src/ca/oldSubscription.cpp +++ b/src/ca/oldSubscription.cpp @@ -29,6 +29,11 @@ oldChannel &oldSubscription::channel () return this->chan; } +void oldSubscription::completionNotify () +{ + cacNotify::completionNotify (); +} + void oldSubscription::completionNotify (unsigned type, unsigned long count, const void *pData) { struct event_handler_args args; @@ -39,11 +44,10 @@ void oldSubscription::completionNotify (unsigned type, unsigned long count, cons args.count = count; args.status = ECA_NORMAL; args.dbr = pData; - (*this->pFunc) (args); + ( *this->pFunc ) (args); } -void oldSubscription::exceptionNotify (int status, - const char * /* pContext */ ) +void oldSubscription::exceptionNotify ( int status, const char * /* pContext */ ) { struct event_handler_args args; @@ -53,7 +57,13 @@ void oldSubscription::exceptionNotify (int status, args.count = 0; args.status = status; args.dbr = 0; - (*this->pFunc) (args); + ( *this->pFunc ) (args); +} + +void oldSubscription::exceptionNotify ( int status, const char *pContext, + unsigned type, unsigned long count ) +{ + cacNotify::exceptionNotify ( status, pContext, type, count ); } void oldSubscription::destroy () diff --git a/src/ca/putCallback.cpp b/src/ca/putCallback.cpp index 9bf24dca8..16ef20d3f 100644 --- a/src/ca/putCallback.cpp +++ b/src/ca/putCallback.cpp @@ -47,8 +47,13 @@ void putCallback::completionNotify () (*this->pFunc) (args); } -void putCallback::exceptionNotify (int status, - const char * /* pContext */ ) +void putCallback::completionNotify ( unsigned type, + unsigned long count, const void *pData ) +{ + cacNotify::completionNotify ( type, count, pData ); +} + +void putCallback::exceptionNotify (int status, const char * /* pContext */ ) { struct event_handler_args args; @@ -61,6 +66,12 @@ void putCallback::exceptionNotify (int status, (*this->pFunc) (args); } +void putCallback::exceptionNotify ( int status, + const char *pContext, unsigned type, unsigned long count ) +{ + cacNotify::exceptionNotify ( status, pContext, type, count ); +} + void * putCallback::operator new ( size_t size ) { return putCallback::freeList.allocate ( size ); diff --git a/src/ca/udpiiu.cpp b/src/ca/udpiiu.cpp index c15db0be9..12f1b5f7b 100644 --- a/src/ca/udpiiu.cpp +++ b/src/ca/udpiiu.cpp @@ -267,28 +267,28 @@ epicsShareFunc void epicsShareAPI caStartRepeaterIfNotInstalled ( unsigned repea struct sockaddr_in bd; int flag; - if ( repeaterPort <= 0xffff ) { - tmpSock = socket ( AF_INET, SOCK_DGRAM, IPPROTO_UDP ); - if ( tmpSock != INVALID_SOCKET ) { - ca_uint16_t port = static_cast < ca_uint16_t > ( repeaterPort ); - memset ( (char *) &bd, 0, sizeof ( bd ) ); - bd.sin_family = AF_INET; - bd.sin_addr.s_addr = htonl ( INADDR_ANY ); - bd.sin_port = htons ( port ); - status = bind ( tmpSock, (struct sockaddr *) &bd, sizeof ( bd ) ); - if ( status < 0 ) { - if ( SOCKERRNO == SOCK_EADDRINUSE ) { - installed = true; - } - else { - ca_printf ( "caStartRepeaterIfNotInstalled () : bind failed\n"); - } + if ( repeaterPort > 0xffff ) { + ca_printf ( "caStartRepeaterIfNotInstalled () : strange repeater port specified\n"); + return; + } + + tmpSock = socket ( AF_INET, SOCK_DGRAM, IPPROTO_UDP ); + if ( tmpSock != INVALID_SOCKET ) { + ca_uint16_t port = static_cast < ca_uint16_t > ( repeaterPort ); + memset ( (char *) &bd, 0, sizeof ( bd ) ); + bd.sin_family = AF_INET; + bd.sin_addr.s_addr = htonl ( INADDR_ANY ); + bd.sin_port = htons ( port ); + status = bind ( tmpSock, (struct sockaddr *) &bd, sizeof ( bd ) ); + if ( status < 0 ) { + if ( SOCKERRNO == SOCK_EADDRINUSE ) { + installed = true; + } + else { + ca_printf ( "caStartRepeaterIfNotInstalled () : bind failed\n"); } } } - else { - ca_printf ( "caStartRepeaterIfNotInstalled () : strange repeater port specified\n"); - } /* * turn on reuse only after the test so that