NT/ALPHA(VMS/printf handler) changes

This commit is contained in:
Jeff Hill
1995-02-13 03:32:27 +00:00
parent de878747c6
commit 1ecdaff1b5
27 changed files with 697 additions and 475 deletions

View File

@@ -15,7 +15,7 @@ $! - You are using Multinet for TCP/IP access. If not, the logical
$! name definitions below will need to be changed
$!
$!
$! Arguments : None
$! Arguments : optional source file name
$!
$! Created 16-NOV-1993 Mark L. Rivers
$! 05-MAY-1994 Jeff O. Hill Updated for EPICS 3.12
@@ -30,11 +30,13 @@ $ define /nolog arpa multinet_root:[multinet.include.arpa]
$ define /nolog tcp multinet_root:[multinet.include]
$!
$! Compile the functions and test programs
$! Define symbol for the CC command
$ call set_cc_command
$ if (p1 .nes. "")
$ then
$ cc /defines=(__STDC__)/include=([]) 'p1'
$ cc_command 'p1'
$ else
$ cc /defines=(__STDC__)/include=([]) -
$ cc_command -
ACCESS, -
CONN, -
CONVERT, -
@@ -50,7 +52,10 @@ IF_DEPEN, -
VMS_DEPEN, -
ELLLIB, -
BUCKETLIB, -
NEXTFIELDSUBR, -
ENVSUBR, -
TSSUBR, -
GENSUBR, -
CATIME, -
ACCTST
$ endif
@@ -71,7 +76,10 @@ IF_DEPEN, -
VMS_DEPEN, -
BSD_DEPEN, -
BUCKETLIB, -
NEXTFIELDSUBR, -
TSSUBR, -
ENVSUBR, -
GENSUBR, -
ELLLIB
$! Link the test programs
$ call link acctst
@@ -84,10 +92,32 @@ $ catime == "$ EPICS_EXE:catime.exe"
$
$!
$ link: subroutine
$ link 'p1', sys$input/options
channel_access/lib
multinet_socket_library/share
sys$share:vaxcrtl/share
$! Link differently for VAX and AXP
$ if f$getsyi("HW_MODEL") .ge. 1024
$ then
$ link 'p1', sys$input/options
channel_access/lib
multinet_socket_library/share
$ else
$ link 'p1', sys$input/options
channel_access/lib
multinet_socket_library/share
sys$share:vaxcrtl/share
$ endif
$ endsubroutine
$
$
$! This subroutine sets up "cc_command" to use different switches for
$! VAX (assumes VAX C compiler) and AXP (DEC C compiler).
$ set_cc_command : subroutine
$ if f$getsyi("HW_MODEL") .ge. 1024
$ then
$! turn of no prototype messages because MULTINET does not
$! supply prototypes.
$ cc_command:== cc /warn=(disable=IMPLICITFUNC)/float=d_float /include=([], [-.include], [-.libcom])
$ else
$ cc_command:== cc /include=([], [-.include], [-.libcom])
$ endif
$ endsubroutine
$! ************************************************************

View File

@@ -10,11 +10,12 @@ DEPLIBS_BASE = $(EPICS_BASE_LIB)
DEPLIBS = ./libca.a\
$(DEPLIBS_BASE)/libCom.a
SRCS.c = \
../iocinf.c ../access.c ../test_event.c ../service.c \
../flow_control.c ../repeater.c ../conn.c ../acctst.c \
../flow_control.c ../repeater.c ../conn.c \
../syncgrp.c ../if_depen.c ../netdb_depen.c ../bsd_depen.c \
../posix_depen.c ../caRepeater.c ../acctst.c
../posix_depen.c ../caRepeater.c ../acctst.c ../catime.c
OBJS = caRepeater.o
@@ -35,3 +36,9 @@ acctst: acctst.o $(DEPLIBS_BASE)/libCom.a libca.a
acctst.o: ../acctst.c
$(COMPILE.c) $<
catime: catime.o $(DEPLIBS_BASE)/libCom.a libca.a
catime.o: ../catime.c
$(COMPILE.c) $<

View File

@@ -134,6 +134,7 @@ static char *sccsId = "@(#) $Id$";
#include "iocinf.h"
#include "net_convert.h"
#include <stdarg.h> /* for VMS old CC include order madness */
/****************************************************************/
@@ -142,19 +143,6 @@ static char *sccsId = "@(#) $Id$";
#define EXTMSGPTR(PIIU)\
((struct extmsg *) &(PIIU)->send.buf[(PIIU)->send.wtix])
/*
* Performs worst case message alignment
*/
#define CAC_ADD_MSG(PIIU) \
{ \
unsigned long size; \
struct extmsg *mp = EXTMSGPTR(PIIU); \
size = mp->m_postsize = CA_MESSAGE_ALIGN(mp->m_postsize); \
mp->m_postsize = htons(mp->m_postsize); \
CAC_RING_BUFFER_WRITE_ADVANCE( \
&(PIIU)->send, sizeof(struct extmsg) + size); \
}
@@ -189,12 +177,14 @@ static struct extmsg nullmsg;
/*
* local functions
*/
#if 0
LOCAL int cac_alloc_msg(
struct ioc_in_use *piiu,
unsigned extsize,
struct extmsg **ppMsg
);
#endif
LOCAL int cac_alloc_msg_no_flush(
struct ioc_in_use *piiu,
unsigned extsize,
@@ -230,6 +220,8 @@ struct extmsg *pmsg,
void *pext
);
LOCAL void cac_add_msg (IIU *piiu);
#ifdef CONVERSION_REQUIRED
LOCAL void *malloc_put_convert(unsigned long size);
LOCAL void free_put_convert(void *pBuf);
@@ -253,15 +245,15 @@ void *pext
)
{
struct extmsg msg;
unsigned long bytesAvailable;
unsigned long actualextsize;
unsigned long extsize;
unsigned long bytesSent;
unsigned bytesAvailable;
unsigned actualextsize;
unsigned extsize;
unsigned bytesSent;
msg = *pmsg;
actualextsize = pmsg->m_postsize;
extsize = CA_MESSAGE_ALIGN(pmsg->m_postsize);
msg.m_postsize = htons(extsize);
msg.m_postsize = htons((ca_uint16_t)extsize);
LOCK;
@@ -347,8 +339,8 @@ void *pext
* if present
*/
{
static nullBuff[32];
int n;
static nullBuff[32];
unsigned n;
n = extsize-actualextsize;
if(n){
@@ -421,6 +413,7 @@ struct extmsg **ppMsg
* LOCK should be on
*
*/
#if 0
LOCAL int cac_alloc_msg(
struct ioc_in_use *piiu,
unsigned extsize,
@@ -480,13 +473,33 @@ struct extmsg **ppMsg
return ECA_NORMAL;
}
#endif
/*
* cac_add_msg ()
*/
LOCAL void cac_add_msg (IIU *piiu)
{
unsigned long size;
struct extmsg *mp = EXTMSGPTR(piiu);
/*
* Performs worst case message alignment
*/
mp->m_postsize = (unsigned short)
CA_MESSAGE_ALIGN(mp->m_postsize);
size = mp->m_postsize;
mp->m_postsize = htons(mp->m_postsize);
CAC_RING_BUFFER_WRITE_ADVANCE(
&piiu->send,
sizeof(struct extmsg) + size);
}
/*
*
* CA_TASK_INITIALIZE
*
*
*/
int APIENTRY ca_task_initialize(void)
{
@@ -518,6 +531,8 @@ int ca_os_independent_init (void)
ca_static->ca_exception_func = ca_default_exception_handler;
ca_static->ca_exception_arg = NULL;
caSetDefaultPrintfHandler();
/* record a default user name */
ca_static->ca_pUserName = localUserName();
if(!ca_static->ca_pUserName){
@@ -541,10 +556,10 @@ int ca_os_independent_init (void)
*/
ca_static->ca_search_retry = 0;
ca_static->ca_conn_next_retry = CA_CURRENT_TIME;
sec = CA_RECAST_DELAY;
sec = (unsigned) CA_RECAST_DELAY;
ca_static->ca_conn_retry_delay.tv_sec = sec;
ca_static->ca_conn_retry_delay.tv_usec =
(CA_RECAST_DELAY-sec)*USEC_PER_SEC;
(long) (CA_RECAST_DELAY-sec)*USEC_PER_SEC;
ellInit(&ca_static->ca_iiuList);
ellInit(&ca_static->ca_ioeventlist);
@@ -597,8 +612,6 @@ int ca_os_independent_init (void)
*/
LOCAL void create_udp_fd()
{
int pri;
char name[64];
int status;
if(ca_static->ca_piiuCast){
@@ -615,38 +628,43 @@ LOCAL void create_udp_fd()
}
#ifdef vxWorks
status = taskPriorityGet(VXTASKIDSELF, &pri);
if(status<0)
ca_signal(ECA_INTERNAL,NULL);
{
int pri;
char name[64];
strcpy(name,"RD ");
strncat(
name,
taskName(VXTHISTASKID),
sizeof(name)-strlen(name)-1);
status = taskPriorityGet(VXTASKIDSELF, &pri);
if(status<0)
ca_signal(ECA_INTERNAL,NULL);
strcpy(name,"RD ");
strncat(
name,
taskName(VXTHISTASKID),
sizeof(name)-strlen(name)-1);
status = taskSpawn(
name,
pri-1,
VX_FP_TASK,
4096,
(FUNCPTR)cac_recv_task,
(int)taskIdCurrent,
0,
0,
0,
0,
0,
0,
0,
0,
0);
if (status<0) {
ca_signal(ECA_INTERNAL,NULL);
}
ca_static->recv_tid = status;
status = taskSpawn(
name,
pri-1,
VX_FP_TASK,
4096,
(FUNCPTR)cac_recv_task,
(int)taskIdCurrent,
0,
0,
0,
0,
0,
0,
0,
0,
0);
if (status<0) {
ca_signal(ECA_INTERNAL,NULL);
}
ca_static->recv_tid = status;
#endif
}
@@ -1072,7 +1090,7 @@ int APIENTRY ca_search_and_connect
chix->pConnFunc = conn_func;
chix->type = TYPENOTCONN; /* invalid initial type */
chix->count = 0; /* invalid initial count */
chix->id.sid = ~0L; /* invalid initial server id */
chix->id.sid = ~0U; /* invalid initial server id */
chix->state = cs_never_conn;
ellInit(&chix->eventq);
@@ -1088,10 +1106,10 @@ int APIENTRY ca_search_and_connect
*/
ca_static->ca_search_retry = 0;
ca_static->ca_conn_next_retry = CA_CURRENT_TIME;
sec = CA_RECAST_DELAY;
sec = (int) CA_RECAST_DELAY;
ca_static->ca_conn_retry_delay.tv_sec = sec;
ca_static->ca_conn_retry_delay.tv_usec =
(CA_RECAST_DELAY-sec)*USEC_PER_SEC;
(long) (CA_RECAST_DELAY-sec)*USEC_PER_SEC;
UNLOCK;
@@ -1152,7 +1170,7 @@ int reply_type
mptr++;
strncpy((char *)mptr, (char *)(chix + 1), size);
CAC_ADD_MSG(piiu);
cac_add_msg(piiu);
/*
* increment the number of times we have tried this
@@ -1721,7 +1739,7 @@ void *pvalue
struct extmsg hdr;
int postcnt;
unsigned size_of_one;
int i;
unsigned i;
# ifdef CONVERSION_REQUIRED
void *pCvrtBuf;
void *pdest;
@@ -1777,6 +1795,8 @@ void *pvalue
case DBR_ENUM:
case DBR_SHORT:
case DBR_PUT_ACKT:
case DBR_PUT_ACKS:
# if DBR_INT != DBR_SHORT
case DBR_INT:
# endif /*DBR_INT != DBR_SHORT*/
@@ -1812,10 +1832,10 @@ void *pvalue
hdr.m_cmmd = htons(cmd);
hdr.m_type = htons(type);
hdr.m_count = htons(count);
hdr.m_count = htons((ca_uint16_t)count);
hdr.m_cid = chix->id.sid;
hdr.m_available = id;
hdr.m_postsize = postcnt;
hdr.m_postsize = (ca_uint16_t) postcnt;
status = cac_push_msg(piiu, &hdr, pvalue);
@@ -2033,7 +2053,6 @@ long mask
{
evid monix;
int status;
int size;
INITCHK;
LOOSECHIXCHK(chix);
@@ -2063,7 +2082,8 @@ long mask
if (!chix->piiu) {
# ifdef vxWorks
static int dbevsize;
int size;
static int dbevsize;
if(!dbevsize){
dbevsize = db_sizeof_event_block();
@@ -2098,7 +2118,7 @@ long mask
monix->p_delta = p_delta;
monix->n_delta = n_delta;
monix->timeout = timeout;
monix->mask = mask;
monix->mask = (unsigned short) mask;
# ifdef vxWorks
if(!chix->piiu){
@@ -2169,8 +2189,10 @@ int ca_request_event(evid monix)
unsigned count;
struct monops msg;
struct ioc_in_use *piiu;
ca_float32_t p_delta;
ca_float32_t n_delta;
ca_float32_t tmo;
piiu = chix->piiu;
/*
@@ -2201,9 +2223,12 @@ int ca_request_event(evid monix)
msg.m_header.m_postsize = sizeof(msg.m_info);
/* msg body */
htonf(&monix->p_delta, &msg.m_info.m_hval);
htonf(&monix->n_delta, &msg.m_info.m_lval);
htonf(&monix->timeout, &msg.m_info.m_toval);
p_delta = (ca_float32_t) monix->p_delta;
n_delta = (ca_float32_t) monix->n_delta;
tmo = (ca_float32_t) monix->timeout;
htonf(&p_delta, &msg.m_info.m_hval);
htonf(&n_delta, &msg.m_info.m_lval);
htonf(&tmo, &msg.m_info.m_toval);
msg.m_info.m_mask = htons(monix->mask);
status = cac_push_msg(piiu, &msg.m_header, &msg.m_info);
@@ -2563,9 +2588,9 @@ int APIENTRY ca_clear_channel (chid chix)
/* msg header */
hdr.m_cmmd = htons(IOC_CLEAR_CHANNEL);
hdr.m_available = chix->cid;
hdr.m_cid = chix->id.sid;
hdr.m_type = htons(0);
hdr.m_count = htons(0);
hdr.m_cid = chix->id.sid;
hdr.m_postsize = 0;
status = cac_push_msg(piiu, &hdr, NULL);
@@ -2697,11 +2722,11 @@ int APIENTRY ca_pend(ca_real timeout, int early)
/*
* Allow for CA background labor
*/
remaining = min(SELECT_POLL, remaining);
remaining = (long) min(SELECT_POLL, remaining);
}
tmo.tv_sec = remaining;
tmo.tv_usec = (remaining-tmo.tv_sec)*USEC_PER_SEC;
tmo.tv_sec = (long) remaining;
tmo.tv_usec = (long) (remaining-tmo.tv_sec)*USEC_PER_SEC;
cac_block_for_io_completion(&tmo);
}
}
@@ -3015,7 +3040,7 @@ int echo_request(struct ioc_in_use *piiu, ca_time *pCurrentTime)
phdr->m_available = htons(0);
phdr->m_postsize = 0;
CAC_ADD_MSG(piiu);
cac_add_msg(piiu);
piiu->echoPending = TRUE;
piiu->send_needed = TRUE;
@@ -3214,7 +3239,7 @@ LOCAL void ca_default_exception_handler(struct exception_handler_args args)
*/
LOCK;
sprintf(sprintf_buf,
"%s - with request chan=%s op=%d data type=%s count=%d\n",
"%s - with request chan=%s op=%d data type=%s count=%d",
args.ctx,
pName,
args.op,
@@ -3265,7 +3290,7 @@ int ca_defunct()
* currently implemented as a function
* (may be implemented as a MACRO in the future)
*/
char APIENTRY *ca_host_name_function(chid chix)
char * APIENTRY ca_host_name_function(chid chix)
{
IIU *piiu;
@@ -3353,3 +3378,69 @@ int ca_channel_status(int tid)
return ECA_NORMAL;
}
#endif /*vxWorks*/
/*
* ca_replace_printf_handler ()
*/
int APIENTRY ca_replace_printf_handler (
int (*ca_printf_func)(char *pformat, va_list args)
)
{
if (ca_printf_func) {
ca_static->ca_printf_func = ca_printf_func;
}
else {
/*
* os dependent
*/
caSetDefaultPrintfHandler();
}
return ECA_NORMAL;
}
/*
* ca_printf()
*/
int ca_printf(char *pformat, ...)
{
int (*ca_printf_func)(char *pformat, va_list args);
va_list theArgs;
int status;
va_start(theArgs, pformat);
ca_printf_func = ca_default_printf;
if (ca_static) {
if (ca_static->ca_printf_func) {
ca_printf_func = ca_static->ca_printf_func;
}
}
status = (*ca_printf_func) (pformat, theArgs);
va_end(theArgs);
return status;
}
/*
* ca_default_printf()
* (this default is replaced under vxWorks
* - see vxWorks_depen.c)
*/
int ca_default_printf(char *pformat, va_list args)
{
int status;
status = vfprintf(
stderr,
pformat,
args);
return status;
}

View File

@@ -10,6 +10,7 @@ static char *sccsId = "@(#) $Id$";
#endif
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "os_depen.h"

View File

@@ -18,8 +18,8 @@ void caAddConfiguredAddr(
SOCKET socket,
int port);
int local_addr(SOCKET socket, struct sockaddr_in *plcladdr);
int local_addr(SOCKET socket, struct sockaddr_in *plcladdr);
int caFetchPortConfig(ENV_PARAM *pEnv, int defaultPort);
union caAddr{
struct sockaddr_in inetAddr;

View File

@@ -45,10 +45,9 @@ int cac_select_io(struct timeval *ptimeout, int flags)
long status;
IIU *piiu;
unsigned long freespace;
int maxfd;
SOCKET maxfd;
caFDInfo *pfdi;
LOCK;
pfdi = (caFDInfo *) ellGet(&ca_static->fdInfoFreeList);

View File

@@ -52,12 +52,7 @@ static char *sccsId = "@(#) $Id$";
* Dump error messages to the appropriate place
*
*/
#ifdef __STDC__
int ca_printf(char *pformat, ...)
#else
int ca_printf(va_alist)
va_dcl
#endif
{
va_list args;
int status;
@@ -65,29 +60,9 @@ va_dcl
va_start(args, pformat);
#if defined(vxWorks)
{
int logMsgArgs[6];
int i;
for(i=0; i< NELEMENTS(logMsgArgs); i++){
logMsgArgs[i] = va_arg(args, int);
}
status = logMsg(
pformat,
logMsgArgs[0],
logMsgArgs[1],
logMsgArgs[2],
logMsgArgs[3],
logMsgArgs[4],
logMsgArgs[5]);
}
status = mprintf(pformat, args);
#else
status = vfprintf(
stderr,
pformat,
args);
status = vfprintf(stderr, pformat, args);
#endif
va_end(args);

View File

@@ -1,29 +1,24 @@
/*
*
* CA performance test
*
* History
* joh 09-12-89 Initial release
* joh 12-20-94 portability
*
*
*/
CA performance test
History
joh 09-12-89 Initial release
*/
#ifdef VMS
#include <LIB$ROUTINES.H>
#endif
/* System includes */
#ifdef vxWorks
#include <vxWorks.h>
#include <taskLib.h>
#endif
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <stdlib.h>
#include <cadef.h>
#include <caerr.h>
#include <db_access.h>
#ifndef LOCAL
#define LOCAL static
#endif
#ifndef OK
#define OK 0
@@ -41,17 +36,44 @@
#define NELEMENTS(A) (sizeof (A) / sizeof ((A) [0]))
#endif
#define NUM 1
#define ITERATION_COUNT 10000
#define WAIT_FOR_ACK
chid chan_list[min(10000,ITERATION_COUNT)];
typedef struct testItem {
chid chix;
char name[40];
int type;
int count;
union db_access_val val;
}ti;
ti itemList[ITERATION_COUNT];
int catime(char *channelName);
typedef void tf (ti *pItems, unsigned iterations);
LOCAL void test (
ti *pItems,
unsigned iterations
);
LOCAL tf test_search;
LOCAL tf test_free;
LOCAL tf test_wait;
LOCAL tf test_put;
LOCAL tf test_wait;
LOCAL tf test_get;
void timeIt(
tf *pfunc,
ti *pItem,
unsigned iterations
);
#ifndef vxWorks
main(argc, argv)
int argc;
char **argv;
int main(int argc, char **argv)
{
char *pname;
@@ -61,167 +83,251 @@ char **argv;
}
else{
printf("usage: %s <channel name>", argv[0]);
return -1;
}
return 0;
}
#endif
catime(channelName)
char *channelName;
/*
* catime ()
*/
int catime (char *channelName)
{
chid ai_1;
long status;
long i,j;
unsigned strsize;
long status;
long i,j;
void *ptr;
int test_search(), test_free();
SEVCHK (ca_task_initialize(),"Unable to initialize");
SEVCHK(ca_task_initialize(),"Unable to initialize");
strsize = sizeof(itemList[i].name)-1;
for (i=0; i<NELEMENTS(itemList); i++) {
strncpy (
itemList[i].name,
channelName,
strsize);
itemList[i].name[strsize]= '\0';
itemList[i].count = 1;
}
printf ("search test\n");
timeIt (test_search, itemList, NELEMENTS(itemList));
SEVCHK(ca_search(channelName,&ai_1),NULL);
status = ca_pend_io(5.0);
SEVCHK(status,NULL);
if(status == ECA_TIMEOUT)
exit(OK);
printf (
"channel name=%s, native type=%d, native count=%d\n",
ca_name(itemList[0].chix),
ca_field_type(itemList[0].chix),
ca_element_count(itemList[0].chix));
ptr = (void *) malloc(NUM*sizeof(union db_access_val)+NUM*MAX_STRING_SIZE);
if(!ptr)
exit(OK);
for (i=0; i<NELEMENTS(itemList); i++) {
itemList[i].val.fltval = 0.0;
itemList[i].type = DBR_FLOAT;
}
printf ("float test\n");
test (itemList, NELEMENTS(itemList));
printf("channel name %s native type %d native count %d\n",ai_1+1,ai_1->type,ai_1->count);
printf("search test\n");
timex(test_search,channelName);
printf("free test\n");
timex(test_free,ai_1);
for (i=0; i<NELEMENTS(itemList); i++) {
strcpy(itemList[i].val.strval, "0.0");
itemList[i].type = DBR_STRING;
}
printf ("string test\n");
test (itemList, NELEMENTS(itemList));
for (i=0; i<NELEMENTS(itemList); i++) {
itemList[i].val.intval = 0;
itemList[i].type = DBR_INT;
}
printf ("interger test\n");
test (itemList, NELEMENTS(itemList));
for(i=0;i<NUM;i++)
((float *)ptr)[i] = 0.0;
test(ai_1, "DBR_FLOAT", DBR_FLOAT, NUM, ptr);
printf ("free test\n");
timeIt (test_free, itemList, NELEMENTS(itemList));
for(i=0;i<NUM;i++)
strcpy((char *)ptr+(MAX_STRING_SIZE*i),"0.0");
test(ai_1, "DBR_STRING", DBR_STRING, NUM, ptr);
for(i=0;i<NUM;i++)
((int *)ptr)[i]=0;
test(ai_1, "DBR_INT", DBR_INT, NUM, ptr);
free(ptr);
exit(OK);
return OK;
}
test(chix, name, type, count, ptr)
chid chix;
char *name;
int type,count;
void *ptr;
/*
* test ()
*/
LOCAL void test (
ti *pItems,
unsigned iterations
)
{
int test_put(), test_get(), test_wait();
printf("%s\n",name);
timex(test_put,chix, name, type, count, ptr);
timex(test_get,chix, name, type, count, ptr);
timex(test_wait,chix, name, type, count, ptr);
printf ("\tasync put test\n");
timeIt(test_put, pItems, iterations);
printf ("\tasync get test\n");
timeIt(test_get, pItems, iterations);
printf ("\tsynch get test\n");
timeIt(test_wait, pItems, iterations);
}
#ifndef vxWorks
timex(pfunc, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
void (*pfunc)();
int arg1;
int arg2;
int arg3;
int arg4;
int arg5;
int arg6;
int arg7;
/*
* timeIt ()
*/
void timeIt(
tf *pfunc,
ti *pItems,
unsigned iterations
)
{
(*pfunc)(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
TS_STAMP end_time;
TS_STAMP start_time;
double delay;
int status;
}
#endif
test_search(name)
char *name;
{
int i;
for(i=0; i< NELEMENTS(chan_list);i++){
SEVCHK(ca_search(name,&chan_list[i]),NULL);
}
SEVCHK(ca_pend_io(0.0),NULL);
status = tsLocalTime(&start_time);
assert (status == S_ts_OK);
(*pfunc) (pItems, iterations);
status = tsLocalTime(&end_time);
assert (status == S_ts_OK);
TsDiffAsDouble(&delay,&end_time,&start_time);
printf ("Elapsed Per Item = %f\n", delay/iterations);
}
test_free(chix)
chid chix;
/*
* test_search ()
*/
LOCAL void test_search(
ti *pItems,
unsigned iterations
)
{
int i;
union db_access_val ival;
int i;
int status;
chid chan;
for(i=0; i< NELEMENTS(chan_list);i++){
SEVCHK(ca_clear_channel(chan_list[i]),NULL);
}
status = ca_search (
pItems[0].name,
&chan);
SEVCHK (status, NULL);
status = ca_pend_io(0.0);
for (i=0; i< iterations;i++) {
pItems[i].chix = chan;
}
SEVCHK (status, NULL);
}
/*
* test_free ()
*/
LOCAL void test_free(
ti *pItems,
unsigned iterations
)
{
int i;
int status;
dbr_int_t val;
status = ca_clear_channel (pItems[0].chix);
SEVCHK (status, NULL);
#if 0
#ifdef WAIT_FOR_ACK
SEVCHK(ca_array_get(DBR_INT,1,chix,&ival),NULL);
SEVCHK(ca_pend_io(0.0),NULL);
#else
SEVCHK(ca_flush_io(),NULL);
status = ca_array_get (DBR_INT, 1, pItems[0].chix, &val);
SEVCHK (status, NULL);
status = ca_pend_io(100.0);
SEVCHK (status, NULL);
#endif
status = ca_clear_channel (pItems[0].chix);
SEVCHK (status, NULL);
status = ca_flush_io();
SEVCHK (status, NULL);
#endif
}
test_put(chix, name, type, count, ptr)
chid chix;
char *name;
int type,count;
void *ptr;
/*
* test_put ()
*/
LOCAL void test_put(
ti *pItems,
unsigned iterations
)
{
int i;
int i;
int status;
dbr_int_t val;
for(i=0; i< ITERATION_COUNT;i++){
SEVCHK(ca_array_put(type,count,chix,ptr),NULL);
#if 0
ca_flush_io();
#endif
}
for (i=1; i<iterations; i++) {
status = ca_array_put(
pItems[i].type,
pItems[i].count,
pItems[i].chix,
&pItems[i].val);
SEVCHK (status, NULL);
}
#ifdef WAIT_FOR_ACK
SEVCHK(ca_array_get(type,count,chix,ptr),NULL);
SEVCHK(ca_pend_io(0.0),NULL);
#else
SEVCHK(ca_flush_io(),NULL);
status = ca_array_get (DBR_INT, 1, pItems[0].chix, &val);
SEVCHK (status, NULL);
status = ca_pend_io(100.0);
#endif
status = ca_array_put(
pItems[0].type,
pItems[0].count,
pItems[0].chix,
&pItems[0].val);
SEVCHK (status, NULL);
status = ca_flush_io();
SEVCHK (status, NULL);
}
test_get(chix, name, type, count, ptr)
chid chix;
char *name;
int type,count;
void *ptr;
/*
* test_get ()
*/
LOCAL void test_get(
ti *pItems,
unsigned iterations
)
{
int i;
for(i=0; i< ITERATION_COUNT;i++){
SEVCHK(ca_array_get(type,count,chix,ptr),NULL);
#if 0
ca_flush_io();
#endif
}
SEVCHK(ca_pend_io(0.0),NULL);
int i;
int status;
for (i=0; i<iterations; i++) {
status = ca_array_get(
pItems[i].type,
pItems[i].count,
pItems[i].chix,
&pItems[i].val);
SEVCHK (status, NULL);
}
status = ca_pend_io(100.0);
SEVCHK (status, NULL);
}
test_wait(chix, name, type, count, ptr)
chid chix;
char *name;
int type,count;
void *ptr;
/*
* test_wait ()
*/
LOCAL void test_wait (
ti *pItems,
unsigned iterations
)
{
int i;
for(i=0; i< ITERATION_COUNT;i++){
SEVCHK(ca_array_get(type,count,chix,ptr),NULL);
SEVCHK(ca_pend_io(0.0),NULL);
}
int i;
int status;
for (i=1; i<iterations; i++) {
status = ca_array_get(
pItems[i].type,
pItems[i].count,
pItems[i].chix,
&pItems[i].val);
SEVCHK (status, NULL);
status = ca_pend_io(100.0);
SEVCHK (status, NULL);
}
}

View File

@@ -68,7 +68,7 @@ void manage_conn(int silent)
IIU *piiu;
ca_time current;
ca_real delay;
unsigned long idelay;
long idelay;
/*
* prevent recursion
@@ -214,10 +214,10 @@ void manage_conn(int silent)
idelay = idelay << ca_static->ca_search_retry;
delay = idelay * CA_RECAST_DELAY; /* sec */
delay = min (CA_RECAST_PERIOD, delay);
idelay = delay;
idelay = (long) delay;
ca_static->ca_conn_retry_delay.tv_sec = idelay;
ca_static->ca_conn_retry_delay.tv_usec =
(delay-idelay)*USEC_PER_SEC;
(long) ((delay-idelay)*USEC_PER_SEC);
ca_static->ca_conn_next_retry =
cac_time_sum (
&current,
@@ -347,12 +347,7 @@ LOCAL void logRetryInterval(char *pFN, unsigned lineno)
/*
*
*
* MARK_SERVER_AVAILABLE
*
*
*
*/
void mark_server_available(struct in_addr *pnet_addr)
{
@@ -465,16 +460,16 @@ void mark_server_available(struct in_addr *pnet_addr)
{
ca_real diff;
ca_real delay;
unsigned idelay;
long idelay;
ca_time ca_delay;
ca_time next;
delay = (port&CA_RECAST_PORT_MASK);
delay /= MSEC_PER_SEC;
delay += CA_RECAST_DELAY;
idelay = delay;
idelay = (long) delay;
ca_delay.tv_sec = idelay;
ca_delay.tv_usec = (delay-idelay) * USEC_PER_SEC;
ca_delay.tv_usec = (long) (delay-idelay) * USEC_PER_SEC;
next = cac_time_sum(&currentTime, &ca_delay);
diff = cac_time_diff(
@@ -484,10 +479,10 @@ void mark_server_available(struct in_addr *pnet_addr)
ca_static->ca_conn_next_retry = next;
LOGRETRYINTERVAL
}
idelay = CA_RECAST_DELAY;
idelay = (long) CA_RECAST_DELAY;
ca_static->ca_conn_retry_delay.tv_sec = idelay;
ca_static->ca_conn_retry_delay.tv_usec =
(CA_RECAST_DELAY-idelay) * USEC_PER_SEC;
(long) ((CA_RECAST_DELAY-idelay) * USEC_PER_SEC);
ca_static->ca_search_retry = 0;
}

View File

@@ -35,11 +35,6 @@ static char *sccsId = "@(#) $Id$";
#include "iocinf.h"
#include "net_convert.h"
void htond(double *pHost, double *pNet);
void ntohd(double *pNet, double *pHost);
void htonf(float *pHost, float *pNet);
void ntohf(float *pNet, float *pHost);
/*
* if hton is true then it is a host to network conversion
* otherwise vise-versa
@@ -1374,7 +1369,7 @@ unsigned long num /* number of values */
}
#ifdef CA_FLOAT_MIT
#if defined(CA_FLOAT_MIT)
/************************************************************************/
/* double convert */
/* (THIS ASSUMES IEEE IS THE NETWORK FLOATING POINT FORMAT) */
@@ -1383,7 +1378,7 @@ unsigned long num /* number of values */
/* (this includes mapping of fringe reals to zero or infinity) */
/* (byte swaps included in conversion */
struct ieeedbl{
struct ieeedbl {
unsigned int mant2 : 32;
unsigned int mant1 : 20;
unsigned int exp : 11;
@@ -1396,7 +1391,7 @@ struct ieeedbl{
/* -1022<exp<1024 with mantissa of form 1.mant */
#define DBLEXPMINIEEE -1022 /* min for norm # IEEE exponent */
struct mitdbl{
struct mitdbl {
unsigned int mant1 : 7;
unsigned int exp : 8;
unsigned int sign : 1;
@@ -1413,7 +1408,6 @@ struct mitdbl{
#define DBLEXPMAXMIT 126 /* max MIT exponent */
#define DBLEXPMINMIT -128 /* min MIT exponent */
void htond(double *pHost, double *pNet)
{
double copyin;
@@ -1538,19 +1532,19 @@ struct mitflt{
void htonf(float *pHost, float *pNet)
{
struct mitflt *pMIT = pHost;
struct ieeeflt *pIEEE = pNet;
struct mitflt *pMIT = (struct mitflt *) pHost;
struct ieeeflt *pIEEE = (struct ieeeflt *) pNet;
long exp,mant,sign;
sign = pHost->sign;
sign = pMIT->sign;
if( (short)(pMIT->exp < EXPMINIEEE + MIT_SB){
if( ((int)pMIT->exp) < EXPMINIEEE + MIT_SB){
exp = 0;
mant = 0;
sign = 0;
}
else{
exp = (short)pMIT->exp-MIT_SB+IEEE_SB;
exp = ((int)pMIT->exp)-MIT_SB+IEEE_SB;
mant = (pMIT->mant1<<16) | pMIT->mant2;
}
pIEEE->mant = mant;
@@ -1566,12 +1560,12 @@ void htonf(float *pHost, float *pNet)
*/
void ntohf(float *pNet, float *pHost)
{
struct mitflt *pMIT = pHost;
struct ieeeflt *pIEEE = pNet;
struct mitflt *pMIT = (struct mitflt *) pHost;
struct ieeeflt *pIEEE = (struct ieeeflt *) pNet;
long exp,mant2,mant1,sign;
*(ca_uint32_t *)pIEEE = ntohl(*(ca_uint32_t *)pIEEE);
if( (short) pIEEE->exp > EXPMAXMIT + IEEE_SB){
if( ((int)pIEEE->exp) > EXPMAXMIT + IEEE_SB){
sign = pIEEE->sign;
exp = EXPMAXMIT + MIT_SB;
mant2 = ~0;
@@ -1598,7 +1592,7 @@ void ntohf(float *pNet, float *pHost)
#endif /*CA_FLOAT_MIT*/
#ifndef CA_FLOAT_MIT
#if !defined(CA_FLOAT_MIT)
/*
* htond ()

View File

@@ -50,8 +50,8 @@ static char *sccsId = "@(#) $Id$";
void flow_control(struct ioc_in_use *piiu)
{
unsigned nbytes;
register int status;
register int busy = piiu->client_busy;
int status;
int busy = piiu->client_busy;
LOCK;

View File

@@ -79,7 +79,9 @@ int local_addr(int s, struct sockaddr_in *plcladdr)
ifconf.ifc_req = ifreq;
status = socket_ioctl(s, SIOCGIFCONF, &ifconf);
if (status < 0 || ifconf.ifc_len == 0) {
ca_printf("CAC: ioctl failed %s\n", strerror(MYERRNO));
ca_printf(
"CAC: ioctl failed because \"%s\"\n",
strerror(MYERRNO));
ifconf.ifc_len = 0;
}
@@ -145,7 +147,7 @@ int local_addr(int s, struct sockaddr_in *plcladdr)
#if 0
/*
* An alternate sloution
* An alternate solution
* for os without the if routines
*/
/*

View File

@@ -73,7 +73,6 @@ static char *sccsId = "@(#) $Id$";
#define CA_GLBLSOURCE
#include "iocinf.h"
#include "net_convert.h"
#include <netinet/tcp.h>
LOCAL void tcp_recv_msg(struct ioc_in_use *piiu);
LOCAL void cac_tcp_send_msg_piiu(struct ioc_in_use *piiu);
@@ -188,6 +187,7 @@ int net_proto
UNLOCK;
return ECA_ALLOCMEM;
}
memset((char *)&pNode->destAddr,0,sizeof(pNode->destAddr));
pNode->destAddr.inetAddr.sin_family = AF_INET;
pNode->destAddr.inetAddr.sin_addr = *pnet_addr;
pNode->destAddr.inetAddr.sin_port =
@@ -641,6 +641,8 @@ LOCAL void cac_udp_send_msg_piiu(struct ioc_in_use *piiu)
pNode = (caAddrNode *) piiu->destAddr.node.next;
while(pNode){
unsigned long actualSendCnt;
status = sendto(
piiu->sock_chan,
&piiu->send.buf[piiu->send.rdix],
@@ -649,18 +651,23 @@ LOCAL void cac_udp_send_msg_piiu(struct ioc_in_use *piiu)
&pNode->destAddr.sockAddr,
sizeof(pNode->destAddr.sockAddr));
if(status<0){
if( MYERRNO != EWOULDBLOCK &&
MYERRNO != ENOBUFS &&
MYERRNO != EINTR){
int localErrno;
localErrno = MYERRNO;
if( localErrno != EWOULDBLOCK &&
localErrno != ENOBUFS &&
localErrno != EINTR){
ca_printf(
"CAC: error on socket send() %s\n",
strerror(MYERRNO));
strerror(localErrno));
}
TAG_CONN_DOWN(piiu);
break;
}
assert(status == sendCnt);
actualSendCnt = (unsigned long) status;
assert (actualSendCnt == sendCnt);
pNode = (caAddrNode *) pNode->node.next;
}
@@ -687,6 +694,7 @@ LOCAL void cac_tcp_send_msg_piiu(struct ioc_in_use *piiu)
{
unsigned long sendCnt;
int status;
int localError;
/*
* check for shutdown in progress
@@ -715,8 +723,6 @@ LOCAL void cac_tcp_send_msg_piiu(struct ioc_in_use *piiu)
sendCnt,
0);
if(status>=0){
assert(status<=sendCnt);
piiu->sendPending = FALSE;
CAC_RING_BUFFER_READ_ADVANCE(&piiu->send, status);
@@ -729,9 +735,11 @@ LOCAL void cac_tcp_send_msg_piiu(struct ioc_in_use *piiu)
return;
}
if( MYERRNO == EWOULDBLOCK ||
MYERRNO == ENOBUFS ||
MYERRNO == EINTR){
localError = MYERRNO;
if( localError == EWOULDBLOCK ||
localError == ENOBUFS ||
localError == EINTR){
UNLOCK;
if(!piiu->sendPending){
cac_gettimeval(&piiu->timeAtSendBlock);
@@ -740,12 +748,12 @@ LOCAL void cac_tcp_send_msg_piiu(struct ioc_in_use *piiu)
return;
}
if( MYERRNO != EPIPE &&
MYERRNO != ECONNRESET &&
MYERRNO != ETIMEDOUT){
if( localError != EPIPE &&
localError != ECONNRESET &&
localError != ETIMEDOUT){
ca_printf(
"CAC: error on socket send() %s\n",
strerror(MYERRNO));
strerror(localError));
}
TAG_CONN_DOWN(piiu);
@@ -890,7 +898,6 @@ LOCAL void tcp_recv_msg(struct ioc_in_use *piiu)
return;
}
if(status>MAX_MSG_SIZE){
ca_printf( "CAC: recv_msg(): message overflow %l\n",
status-MAX_MSG_SIZE);
@@ -1174,15 +1181,15 @@ void close_ioc (struct ioc_in_use *piiu)
chix = (chid) &piiu->chidlist.node.next;
while (chix = (chid) chix->node.next) {
chix->type = TYPENOTCONN;
chix->count = 0;
chix->count = 0U;
chix->state = cs_prev_conn;
chix->id.sid = ~0L;
chix->id.sid = ~0U;
chix->ar.read_access = FALSE;
chix->ar.write_access = FALSE;
/*
* try to reconnect
*/
chix->retry = 0;
chix->retry = 0U;
}
if (piiu->chidlist.count) {
@@ -1564,6 +1571,7 @@ void caAddConfiguredAddr(ELLLIST *pList, ENV_PARAM *pEnv,
}
while(pToken = getToken(&pStr)){
memset((char *)&addr,0,sizeof(addr));
addr.inetAddr.sin_family = AF_INET;
addr.inetAddr.sin_port = htons(port);
addr.inetAddr.sin_addr.s_addr = inet_addr(pToken);
@@ -1654,32 +1662,38 @@ void caPrintAddrList(ELLLIST *pList)
/*
* caFetchPortConfig()
*/
unsigned caFetchPortConfig(ENV_PARAM *pEnv, unsigned defaultPort)
int caFetchPortConfig(ENV_PARAM *pEnv, int defaultPort)
{
long longStatus;
long port;
long epicsParam;
int port;
longStatus = envGetLongConfigParam(pEnv, &port);
longStatus = envGetLongConfigParam(pEnv, &epicsParam);
if (longStatus!=0) {
port = defaultPort;
epicsParam = defaultPort;
ca_printf ("EPICS \"%s\" integer fetch failed\n", pEnv->name);
ca_printf ("setting \"%s\" = %ld\n", pEnv->name, port);
ca_printf ("setting \"%s\" = %ld\n", pEnv->name, epicsParam);
}
/*
* Thus must be a server port that will fit in a signed
* This must be a server port that will fit in a signed
* short
*/
if (port <= IPPORT_USERRESERVED || port>SHRT_MAX) {
if (epicsParam<=IPPORT_USERRESERVED || epicsParam>SHRT_MAX) {
ca_printf ("EPICS \"%s\" out of range\n", pEnv->name);
/*
* Quit if the port is wrong due CA coding error
*/
assert (port != defaultPort);
port = defaultPort;
ca_printf ("Setting \"%s\" = %ld\n", pEnv->name, port);
assert (epicsParam != defaultPort);
epicsParam = defaultPort;
ca_printf ("Setting \"%s\" = %ld\n", pEnv->name, epicsParam);
}
/*
* ok to clip to int here because we checked the range
*/
port = (int) epicsParam;
return port;
}

View File

@@ -85,6 +85,7 @@ HDRVERSIONID(iocinfh, "$Id$")
#include <signal.h>
#include <stdlib.h>
#include <limits.h>
#include <stdarg.h>
/*
@@ -168,8 +169,8 @@ struct pending_io_event{
typedef struct timeval ca_time;
#define LD_CA_TIME(FLOAT_TIME,PCATIME) \
((PCATIME)->tv_sec = (FLOAT_TIME), \
(PCATIME)->tv_usec = ((FLOAT_TIME)-(PCATIME)->tv_sec)*USEC_PER_SEC)
((PCATIME)->tv_sec = (long) (FLOAT_TIME), \
(PCATIME)->tv_usec = (long) ((FLOAT_TIME)-(PCATIME)->tv_sec)*USEC_PER_SEC)
/*
* dont adjust
@@ -409,6 +410,7 @@ struct ca_static{
void (*ca_connection_func)
(struct connection_handler_args);
void *ca_connection_arg;
int (*ca_printf_func)(char *pformat, va_list args);
void (*ca_fd_register_func)
(void *, SOCKET, int);
void *ca_fd_register_arg;
@@ -591,6 +593,8 @@ ca_real cac_time_diff(ca_time *pTVA, ca_time *pTVB);
ca_time cac_time_sum(ca_time *pTVA, ca_time *pTVB);
void caIOBlockFree(evid pIOBlock);
void clearChannelResources(unsigned id);
void caSetDefaultPrintfHandler ();
int ca_default_printf(char *pformat, va_list args);
/*
* !!KLUDGE!!

View File

@@ -82,7 +82,7 @@ typedef float ca_float32_t;
#define IOC_WRITE 4 /* write a channel value */
#define IOC_SNAPSHOT 5 /* snapshot of the system */
#define IOC_SEARCH 6 /* IOC channel search */
/* 7 */
#define IOC_BUILD 7 /* build - obsolete */
#define IOC_EVENTS_OFF 8 /* flow control */
#define IOC_EVENTS_ON 9 /* flow control */
#define IOC_READ_SYNC 10 /* purge old reads */
@@ -91,7 +91,7 @@ typedef float ca_float32_t;
#define IOC_RSRV_IS_UP 13 /* CA server has joined the net */
#define IOC_NOT_FOUND 14 /* channel not found */
#define IOC_READ_NOTIFY 15 /* add a one shot event */
/* 16 */
#define IOC_READ_BUILD 16 /* read and build - obsolete */
#define REPEATER_CONFIRM 17 /* registration confirmation */
#define IOC_CLAIM_CIU 18 /* client claims resource in server */
#define IOC_WRITE_NOTIFY 19 /* notify after write chan value */

View File

@@ -63,10 +63,30 @@
# endif
#endif
#if !defined(MIT_FLOAT) && !defined(CA_LITTLE_ENDIAN)
#define htond(IEEEhost, IEEEnet) (*(double *)(IEEEnet) = *(double *)(IEEEhost))
#define ntohd(IEEEnet, IEEEhost) (*(double *)(IEEEhost) = *(double *)(IEEEnet))
#define htonf(IEEEhost, IEEEnet) (*(float *)(IEEEnet) = *(float *)(IEEEhost))
#define ntohf(IEEEnet, IEEEhost) (*(float *)(IEEEhost) = *(float *)(IEEEnet))
#if defined(CA_FLOAT_IEEE) && !defined(CA_LITTLE_ENDIAN)
# define htond(IEEEhost, IEEEnet) \
(*(double *)(IEEEnet) = *(double *)(IEEEhost))
# define ntohd(IEEEnet, IEEEhost) \
(*(double *)(IEEEhost) = *(double *)(IEEEnet))
# define htonf(IEEEhost, IEEEnet) \
(*(float *)(IEEEnet) = *(float *)(IEEEhost))
# define ntohf(IEEEnet, IEEEhost) \
(*(float *)(IEEEhost) = *(float *)(IEEEnet))
#elif defined(CA_FLOAT_IEEE) && defined(CA_LITTLE_ENDIAN)
# define ntohf(NET,HOST) \
{*((u_long *)(HOST)) = ntohl(*((u_long *)(NET )));}
# define htonf(HOST,NET) \
{*((u_long *)(NET) ) = htonl(*((u_long *)(HOST)));}
# define ntohd(NET,HOST) \
{ ((u_long *)(HOST))[1] = ntohl(((u_long *)(NET))[0]) ; \
((u_long *)(HOST))[0] = ntohl(((u_long *)(NET))[1]) ;}
# define htond(HOST,NET) \
{ ((u_long *)(NET))[1] = htonl(((u_long *)(HOST))[0]) ; \
((u_long *)(NET))[0] = htonl(((u_long *)(HOST))[1]) ;}
#else
void htond(double *pHost, double *pNet);
void ntohd(double *pNet, double *pHost);
void htonf(float *pHost, float *pNet);
void ntohf(float *pNet, float *pHost);
#endif

View File

@@ -39,6 +39,9 @@ static char *sccsId = "@(#) $Id$";
#include <string.h>
#include <assert.h>
#ifdef _WINDOWS
#include <winsock.h>
#endif
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
@@ -55,7 +58,7 @@ void caHostFromInetAddr(struct in_addr *pnet_addr, char *pBuf, unsigned size)
struct hostent *ent;
ent = gethostbyaddr(
pnet_addr,
(char *) pnet_addr,
sizeof(*pnet_addr),
AF_INET);
if(ent){

View File

@@ -24,6 +24,7 @@
* pairs reside at the same C bracket level
* .11 GeG 120992 support VMS/UCX
* .12 CJM 130794 define MYERRNO properly for UCX
* .13 CJM 311094 mods to support DEC C compiler
*
*/
@@ -46,6 +47,7 @@ static char *os_depenhSccsId = "$Id$";
# include <sys/param.h>
# include <sys/socket.h>
# include <netinet/in.h>
# include <netinet/tcp.h>
# include <net/if.h>
# define CA_OS_CONFIGURED
#endif
@@ -57,6 +59,7 @@ static char *os_depenhSccsId = "$Id$";
# include <sys/ioctl.h>
# include <sys/socket.h>
# include <netinet/in.h>
# include <netinet/tcp.h>
# include <net/if.h>
# include <systime.h>
@@ -93,9 +96,13 @@ static char *os_depenhSccsId = "$Id$";
# include <sys/types.h>
# include <sys/socket.h>
# include <netinet/in.h>
# define __TIME_LOADED /* dont include VMS CC time.h under MULTINET */
# include <netinet/tcp.h>
#if !defined(UCX)
# include <sys/time.h>
# include <tcp/errno.h>
# include <tcp/errno.h>
#else
# include <errno>
#endif
# include <ssdef>
# include <stsdef>
# include <iodef.h>
@@ -104,12 +111,12 @@ static char *os_depenhSccsId = "$Id$";
# include <descrip.h>
# define MAXHOSTNAMELEN 75
#ifdef UCX /* GeG 09-DEC-1992 */
# include <sys/ucx$inetdef.h>
# include <ucx.h>
# include <sys/ucx$inetdef.h>
# include <ucx.h>
#else
# include <net/if.h>
# include <vms/inetiodef.h>
# include <sys/ioctl.h>
# include <net/if.h>
# include <vms/inetiodef.h>
# include <sys/ioctl.h>
#endif
# define CA_OS_CONFIGURED
#endif /*VMS*/
@@ -123,7 +130,7 @@ static char *os_depenhSccsId = "$Id$";
#endif /*_WINDOWS*/
#ifndef CA_OS_CONFIGURED
#error Please define one of vxWorks, UNIX or VMS
#error Please define one of vxWorks, UNIX VMS, or _WINDOWS
#endif
/*
@@ -139,10 +146,10 @@ static char *os_depenhSccsId = "$Id$";
#elif defined(_X86_)
# define CA_FLOAT_IEEE
# define CA_LITTLE_ENDIAN
#elif (defined(__ALPHA) || defined(__alpha)) && defined(VMS)
#elif (defined(__ALPHA) && defined(VMS) || defined(__alpha)) && defined(VMS)
# define CA_FLOAT_MIT
# define CA_LITTLE_ENDIAN
#elif (defined(__ALPHA) || defined(__alpha)) && defined(UNIX)
#elif (defined(__ALPHA) && defined(UNIX) || defined(__alpha)) && defined(UNIX)
# define CA_FLOAT_IEEE
# define CA_LITTLE_ENDIAN
#else
@@ -269,7 +276,6 @@ static char *os_depenhSccsId = "$Id$";
# else
# ifdef UCX
# define MYERRNO errno
extern volatile int noshare errno ;
# else
# define MYERRNO socket_errno
# endif
@@ -286,6 +292,12 @@ static char *os_depenhSccsId = "$Id$";
#endif
#ifdef _WINDOWS
# define LOCK
# define UNLOCK
# define LOCKEVENTS
# define UNLOCKEVENTS
# define EVENTLOCKTEST (post_msg_active)
# define MAXHOSTNAMELEN 75
# define IPPORT_USERRESERVED 5000
# define EWOULDBLOCK WSAEWOULDBLOCK
# define ENOBUFS WSAENOBUFS

View File

@@ -31,14 +31,6 @@
*
*/
/*
* ANSI includes
*/
#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <unistd.h>
#include <pwd.h>
#include <sys/param.h>
@@ -98,12 +90,10 @@ void cac_mux_io(struct timeval *ptimeout)
timeout.tv_sec = 0;
}
while(count>0);
ca_process_input_queue();
}
while(newInput);
}
log_time(char *pStr)
@@ -281,25 +271,14 @@ void ca_spawn_repeater()
exit(0);
}
/*
* ca_printf()
* caSetDefaultPrintfHandler ()
* use the normal default here
* ( see access.c )
*/
int ca_printf(char *pformat, ...)
void caSetDefaultPrintfHandler ()
{
va_list args;
int status;
va_start(args, pformat);
status = vfprintf(
stderr,
pformat,
args);
va_end(args);
return status;
ca_static->ca_printf_func = ca_default_printf;
}

View File

@@ -20,11 +20,11 @@
* Los Alamos National Laboratory
*
* Direct inqueries to:
* Andy Kozubal, AT-8, Mail Stop H820
* Jeff HIll, AT-8, Mail Stop H820
* Los Alamos National Laboratory
* Los Alamos, New Mexico 87545
* Phone: (505) 667-6508
* E-mail: kozubal@k2.lanl.gov
* Phone: (505) 665-1831
* E-mail: johill@lanl.gov
*
* PURPOSE:
* Broadcasts fan out over the LAN, but UDP does not allow
@@ -141,8 +141,9 @@ void ca_repeater()
status = local_addr(sock, &local);
if(status != OK){
ca_printf("CA Repeater: no inet interfaces online?\n");
assert(0);
ca_printf(
"CA Repeater: failed during initialization - no local IP address\n");
exit (0);
}
#ifdef DEBUG

View File

@@ -688,7 +688,7 @@ struct in_addr *pnet_addr
}
if (CA_V44(CA_PROTOCOL_VERSION,piiu->minor_version_number)) {
chan->id.sid = ntohl (piiu->curMsg.m_available);
chan->id.sid = piiu->curMsg.m_available;
}
reconnect_channel(piiu, chan);
break;

View File

@@ -97,7 +97,7 @@ void ca_sg_shutdown(struct ca_static *ca_temp)
/*
* ca_sg_create()
*/
int ca_sg_create(CA_SYNC_GID *pgid)
int APIENTRY ca_sg_create(CA_SYNC_GID *pgid)
{
int status;
CASG *pcasg;
@@ -162,7 +162,7 @@ int ca_sg_create(CA_SYNC_GID *pgid)
/*
* ca_sg_delete()
*/
int ca_sg_delete(CA_SYNC_GID gid)
int APIENTRY ca_sg_delete(CA_SYNC_GID gid)
{
int status;
CASG *pcasg;
@@ -200,7 +200,7 @@ int ca_sg_delete(CA_SYNC_GID gid)
/*
* ca_sg_block()
*/
int ca_sg_block(CA_SYNC_GID gid, ca_real timeout)
int APIENTRY ca_sg_block(CA_SYNC_GID gid, ca_real timeout)
{
struct timeval beg_time;
struct timeval cur_time;
@@ -270,8 +270,8 @@ int ca_sg_block(CA_SYNC_GID gid, ca_real timeout)
/*
* wait for asynch notification
*/
tmo.tv_sec = remaining;
tmo.tv_usec = (remaining-tmo.tv_sec)*USEC_PER_SEC;
tmo.tv_sec = (long) remaining;
tmo.tv_usec = (long) ((remaining-tmo.tv_sec)*USEC_PER_SEC);
cac_block_for_sg_completion (pcasg, &tmo);
}
pcasg->opPendCount = 0;
@@ -283,7 +283,7 @@ int ca_sg_block(CA_SYNC_GID gid, ca_real timeout)
/*
* ca_sg_reset
*/
int ca_sg_reset(CA_SYNC_GID gid)
int APIENTRY ca_sg_reset(CA_SYNC_GID gid)
{
CASG *pcasg;
@@ -305,7 +305,7 @@ int ca_sg_reset(CA_SYNC_GID gid)
/*
* ca_sg_test
*/
int ca_sg_test(CA_SYNC_GID gid)
int APIENTRY ca_sg_test(CA_SYNC_GID gid)
{
CASG *pcasg;
@@ -331,7 +331,7 @@ int ca_sg_test(CA_SYNC_GID gid)
/*
* ca_sg_array_put()
*/
int ca_sg_array_put(
int APIENTRY ca_sg_array_put(
CA_SYNC_GID gid,
chtype type,
unsigned long count,
@@ -396,7 +396,7 @@ void *pvalue)
/*
* ca_sg_array_get()
*/
int ca_sg_array_get(
int APIENTRY ca_sg_array_get(
CA_SYNC_GID gid,
chtype type,
unsigned long count,

View File

@@ -19,7 +19,7 @@ static char *sccsId = "$Id$";
#include "iocinf.h"
void ca_test_event(struct event_handler_args args)
void APIENTRY ca_test_event(struct event_handler_args args)
{
ca_printf("CAC: ~~~### in test event for [%s] ###~~~\n",args.chid+1);
ca_printf("CAC: User argument\t%x\n", args.usr);

View File

@@ -6,6 +6,8 @@
*
* GeG 09-DEC-1992 initial edit
* CJM 13-Jul-1994 add fd_set etc for R3.12
* CJM 09-Dec-1994 define fd_set etc. so it will compile for
* both DEC C and Vax C
*
*/
#ifndef _UCX_H_
@@ -70,13 +72,14 @@ typedef long fd_mask ;
#define howmany(x, y) (((x)+((y)-1))/(y))
#endif
typedef struct fd_set {
fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)] ;
} fd_set ;
/*
* Both DEC C and VAX C only allow 32 fd's at once
*/
typedef int fd_set ;
#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
#define FD_SET(n, p) (*(p) |= (1 << ((n) % NFDBITS)))
#define FD_CLR(n, p) (*(p) &= ~(1 << ((n) % NFDBITS)))
#define FD_ISSET(n, p) (*(p) & (1 << ((n) % NFDBITS)))
#define FD_ZERO(p) bzero((char *)(p), sizeof (*(p)))
#include <iodef.h>

View File

@@ -31,15 +31,6 @@
*
*/
/*
* ANSI includes
*/
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include <stdLib.h>
#include <stdarg.h>
/*
* VMS includes
*/
@@ -147,7 +138,7 @@ void os_specific_sg_io_complete(CASG *pcasg)
/*
* cac_block_for_sg_completion()
*/
void cac_block_for_sg_completion(pTV)
void cac_block_for_sg_completion(CASG *pcasg, struct timeval *pTV)
{
cac_mux_io(pTV);
}
@@ -335,19 +326,12 @@ void caHostFromInetAddr(struct in_addr *pnet_addr, char *pBuf, unsigned size)
/*
* ca_printf()
* caSetDefaultPrintfHandler ()
* use the normal default here
* ( see access.c )
*/
int ca_printf(char *pformat, ...)
void caSetDefaultPrintfHandler ()
{
va_list args;
int status;
va_start(args, pformat);
status = vfprintf(stderr, pformat, args);
va_end(args);
return status;
ca_static->ca_printf_func = ca_default_printf;
}

View File

@@ -31,11 +31,10 @@
*
*/
#include <stdarg.h>
#include <callback.h>
#include "iocinf.h"
#include "remLib.h"
#include <mprintf.h>
LOCAL void ca_repeater_task();
LOCAL void ca_task_exit_tcb(WIND_TCB *ptcb);
@@ -379,6 +378,7 @@ int cac_os_depen_init(struct ca_static *pcas)
return status;
}
evuser = (void *) db_init_events();
assert(evuser);
@@ -881,40 +881,17 @@ void cac_recv_task(int tid)
/*
* caSetDefaultPrintfHandler()
*
* replace the default printf handler with a
* vxWorks specific one that calls logMsg ()
* so that:
*
* ca_printf()
*
*
* o messages go to the log file
* o messages dont get intermixed
*/
int ca_printf(char *pformat, ...)
void caSetDefaultPrintfHandler ()
{
va_list args;
int status;
va_start(args, pformat);
{
int logMsgArgs[6];
int i;
for(i=0; i< NELEMENTS(logMsgArgs); i++){
logMsgArgs[i] = va_arg(args, int);
}
status = logMsg(
pformat,
logMsgArgs[0],
logMsgArgs[1],
logMsgArgs[2],
logMsgArgs[3],
logMsgArgs[4],
logMsgArgs[5]);
}
va_end(args);
return status;
ca_static->ca_printf_func = vmprintf;
}

View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Author: Jeffrey O. Hill
* Author: Jeffrey O. Hill, Chris Timossi
* hill@luke.lanl.gov
* (505) 665 1831
* Date: 9-93
@@ -31,14 +31,6 @@
*
*/
/*
* ANSI includes
*/
#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include "iocinf.h"
#ifndef _WINDOWS
@@ -145,7 +137,7 @@ int cac_os_depen_init(struct ca_static *pcas)
{
int status;
ca_static = ca_temp;
ca_static = pcas;
/*
* dont allow disconnect to terminate process
@@ -229,26 +221,59 @@ void ca_spawn_repeater()
}
}
/*
* caSetDefaultPrintfHandler ()
* use the normal default here
* ( see access.c )
*/
void caSetDefaultPrintfHandler ()
{
ca_static->ca_printf_func = ca_default_printf;
}
/*
* ca_printf()
* DllMain ()
*/
int ca_printf(char *pformat, ...)
BOOL APIENTRY DllMain (HANDLE hModule, DWORD dwReason, LPVOID lpReserved)
{
va_list args;
int status;
int status;
WSADATA WsaData;
va_start(args, pformat);
switch (dwReason) {
status = vfprintf(
stderr,
pformat,
args);
case DLL_PROCESS_ATTACH:
va_end(args);
if ((status = WSAStartup(MAKEWORD(1,1), &WsaData)) != 0)
return FALSE;
if (AllocConsole()) {
SetConsoleTitle("Channel Access Status");
freopen( "CONOUT$", "a", stderr );
fprintf(stderr, "Process attached to ca.dll R12\n");
}
break;
case DLL_PROCESS_DETACH:
if ((status = WSACleanup()) !=0)
return FALSE;
break;
case DLL_THREAD_ATTACH:
fprintf(stderr, "Thread attached to ca.dll R12\n");
break;
case DLL_THREAD_DETACH:
fprintf(stderr, "Thread detached from ca.dll R12\n");
break;
default:
break;
}
return TRUE;
return status;
}