merged LANL changes

This commit is contained in:
Jeff Hill
1993-08-05 02:14:13 +00:00
parent 05578b2f59
commit 1155631e40
11 changed files with 276 additions and 290 deletions

View File

@@ -84,6 +84,9 @@
/* 122192 joh increment outstanding ack count */
/* 050593 joh dont enable deadlock prevention if we are in */
/* post message */
/* 070293 joh set ca_static to nill at the end of */
/* ca_process_exit() under all os and not just */
/* vxWorks */
/* */
/*_begin */
/************************************************************************/
@@ -122,17 +125,13 @@ static char *sccsId = "$Id$\t$Date$";
# include psldef.h
# include prcdef.h
# include descrip.h
#else
# if defined(UNIX)
# else
# if defined(vxWorks)
#elif defined(UNIX)
#elif defined(vxWorks)
# include <vxWorks.h>
# include <taskLib.h>
# include <task_params.h>
# else
#else
@@@@ dont compile @@@@
# endif
# endif
#endif
/*
@@ -313,7 +312,7 @@ unsigned extsize;
*
*
*/
ca_task_initialize
int ca_task_initialize
#ifdef __STDC__
(void)
#else
@@ -357,8 +356,7 @@ ca_task_initialize
if (status != SS$_NORMAL)
lib$signal(status);
}
#else
# if defined(vxWorks)
#elif defined(vxWorks)
{
char name[15];
int status;
@@ -369,11 +367,11 @@ ca_task_initialize
FASTLOCKINIT(&client_lock);
FASTLOCKINIT(&event_lock);
# ifdef V5_vxWorks
#ifdef V5_vxWorks
io_done_sem = semBCreate(SEM_Q_PRIORITY, SEM_EMPTY);
# else
#else
io_done_sem = semCreate();
# endif
#endif
if(!io_done_sem){
abort();
}
@@ -396,12 +394,9 @@ ca_task_initialize
if (status != OK)
abort();
}
# else
# if defined(UNIX)
# else
#elif defined(UNIX)
#else
@@@@ dont compile in this case @@@@
# endif
# endif
#endif
}
@@ -610,7 +605,7 @@ ca_add_task_variable()
* call this routine if you wish to free resources prior to task
* exit- ca_task_exit() is also executed routinely at task exit.
*/
ca_task_exit
int ca_task_exit
#ifdef __STDC__
(void)
#else
@@ -766,9 +761,9 @@ ca_process_exit()
* Cancel all local events
*/
# ifdef vxWorks
chix = (chid) & ca_temp->ca_local_chidlist;
chix = (chid) & ca_temp->ca_local_chidlist.node;
while (chix = (chid) chix->node.next){
while (monix = (evid) ellGet(&chix->eventq)) {
while (monix = (evid) dllGet(&chix->eventq)) {
status = db_cancel_event(monix + 1);
if (status == ERROR)
abort();
@@ -790,7 +785,7 @@ ca_process_exit()
"could not close event facility by id");
}
ellFree(&ca_temp->ca_lcl_buff_list);
dllFree(&ca_temp->ca_lcl_buff_list);
# endif
/*
@@ -814,8 +809,8 @@ ca_process_exit()
* remove remote chid blocks and event blocks
*/
for (i = 0; i < ca_temp->ca_nxtiiu; i++) {
while (chix = (chid) ellGet(&ca_temp->ca_iiu[i].chidlist)) {
while (monix = (evid) ellGet(&chix->eventq)) {
while (chix = (chid) dllGet(&ca_temp->ca_iiu[i].chidlist)) {
while (monix = (evid) dllGet(&chix->eventq)) {
free((char *)monix);
}
free((char *)chix);
@@ -826,15 +821,15 @@ ca_process_exit()
* remove local chid blocks, paddr blocks, waiting ev blocks
*/
# ifdef vxWorks
while (chix = (chid) ellGet(&ca_temp->ca_local_chidlist))
while (chix = (chid) dllGet(&ca_temp->ca_local_chidlist))
free((char *)chix);
ellFree(&ca_temp->ca_dbfree_ev_list);
dllFree(&ca_temp->ca_dbfree_ev_list);
# endif
/* remove remote waiting ev blocks */
ellFree(&ca_temp->ca_free_event_list);
dllFree(&ca_temp->ca_free_event_list);
/* remove any pending read blocks */
ellFree(&ca_temp->ca_pend_read_list);
dllFree(&ca_temp->ca_pend_read_list);
/*
* force this macro to use ca_temp
@@ -859,7 +854,9 @@ ca_process_exit()
semDelete(ca_temp->ca_io_done_sem);
# endif
# endif
free((char *)ca_temp);
ca_static = (struct ca_static *) NULL;
/*
* Only remove task variable if user is calling this from
@@ -874,8 +871,6 @@ ca_process_exit()
if (tid == taskIdSelf()) {
int status;
ca_static = (struct ca_static *) NULL;
status = taskVarDelete(tid, &ca_static);
if (status == ERROR)
ca_signal(
@@ -901,17 +896,17 @@ int ca_build_and_connect
(
char *name_str,
chtype get_type,
unsigned int get_count,
unsigned long get_count,
chid * chixptr,
void *pvalue,
void (*conn_func) (),
void (*conn_func) (struct connection_handler_args),
void *puser
)
#else
(name_str, get_type, get_count, chixptr, pvalue, conn_func, puser)
char *name_str;
chtype get_type;
unsigned int get_count;
chtype get_type;
unsigned long get_count;
chid *chixptr;
void *pvalue;
void (*conn_func) ();
@@ -977,7 +972,7 @@ int ca_build_and_connect
chix->paddr)->no_elements;
chix->iocix = LOCAL_IIU;
chix->state = cs_conn;
ellInit(&chix->eventq);
dllInit(&chix->eventq);
strncpy(chix + 1, name_str, strcnt);
/* check for just a search */
@@ -995,7 +990,7 @@ int ca_build_and_connect
}
}
LOCK;
ellAdd(&local_chidlist, chix);
dllAdd(&local_chidlist, chix);
UNLOCK;
if (chix->connection_func) {
@@ -1044,12 +1039,12 @@ int ca_build_and_connect
chix->build_value = (void *) pvalue;
chix->name_length = strcnt;
chix->state = cs_never_conn;
ellInit(&chix->eventq);
dllInit(&chix->eventq);
/* Save this channels name for retry if required */
strncpy(chix + 1, name_str, strcnt);
ellAdd(&iiu[BROADCAST_IIU].chidlist, (ELLNODE *)chix);
dllAdd(&iiu[BROADCAST_IIU].chidlist, chix);
/*
* set the conn tries back to zero so this channel's location
* can be found
@@ -1144,17 +1139,17 @@ void build_msg(chix, reply_type)
ca_array_get
#ifdef __STDC__
(
chtype type,
unsigned int count,
chid chix,
register void *pvalue
chtype type,
unsigned long count,
chid chix,
void *pvalue
)
#else
(type, count, chix, pvalue)
chtype type;
unsigned int count;
unsigned long count;
chid chix;
register void *pvalue;
void *pvalue;
#endif
{
register struct extmsg *mptr;
@@ -1228,19 +1223,19 @@ ca_array_get
*
*
*/
int ca_array_get_callback
ca_array_get_callback
#ifdef __STDC__
(
chtype type,
unsigned int count,
unsigned long count,
chid chix,
void (*pfunc) (),
void (*pfunc) (struct event_handler_args),
void *arg
)
#else
(type, count, chix, pfunc, arg)
chtype type;
unsigned int count;
unsigned long count;
chid chix;
void (*pfunc) ();
void *arg;
@@ -1273,7 +1268,7 @@ int ca_array_get_callback
#endif
LOCK;
if (!(monix = (evid) ellGet(&free_event_list)))
if (!(monix = (evid) dllGet(&free_event_list)))
monix = (evid) malloc(sizeof *monix);
if (monix) {
@@ -1284,7 +1279,7 @@ int ca_array_get_callback
monix->type = type;
monix->count = count;
ellAdd(&pend_read_list, (ELLNODE *)monix);
dllAdd(&pend_read_list, monix);
issue_get_callback(monix);
@@ -1364,20 +1359,20 @@ issue_get_callback(monix)
*
*
*/
int ca_array_put
ca_array_put
#ifdef __STDC__
(
chtype type,
unsigned int count,
unsigned long count,
chid chix,
void *pvalue
)
#else
(type,count,chix,pvalue)
register chtype type;
unsigned int count;
chtype type;
unsigned long count;
chid chix;
register void *pvalue;
void *pvalue;
#endif
{
register struct extmsg *mptr;
@@ -1525,7 +1520,7 @@ ca_change_connection_event
#ifdef __STDC__
(
chid chix,
void (*pfunc)()
void (*pfunc)(struct connection_handler_args)
)
#else
(chix, pfunc)
@@ -1567,7 +1562,7 @@ void (*pfunc)();
ca_add_exception_event
#ifdef __STDC__
(
void (*pfunc)(),
void (*pfunc)(struct exception_handler_args),
void *arg
)
#else
@@ -1627,7 +1622,7 @@ void *astarg;
return ECA_ALLOCMEM;
pioe->io_done_arg = astarg;
pioe->io_done_sub = ast;
ellAdd(&ioeventlist,(ELLNODE *)pioe);
dllAdd(&ioeventlist,pioe);
UNLOCK;
}
@@ -1642,13 +1637,13 @@ void *astarg;
*
*
*/
int ca_add_masked_array_event
ca_add_masked_array_event
#ifdef __STDC__
(
chtype type,
unsigned int count,
unsigned long count,
chid chix,
void (*ast)(),
void (*ast)(struct event_handler_args),
void *astarg,
ca_real p_delta,
ca_real n_delta,
@@ -1659,7 +1654,7 @@ long mask
#else
(type,count,chix,ast,astarg,p_delta,n_delta,timeout,monixptr,mask)
chtype type;
unsigned int count;
unsigned long count;
chid chix;
void (*ast)();
void *astarg;
@@ -1667,7 +1662,7 @@ ca_real p_delta;
ca_real n_delta;
ca_real timeout;
evid *monixptr;
unsigned mask;
long mask;
#endif
{
register evid monix;
@@ -1697,15 +1692,15 @@ unsigned mask;
dbevsize = db_sizeof_event_block();
if(!(monix = (evid)ellGet(&dbfree_ev_list)))
if(!(monix = (evid)dllGet(&dbfree_ev_list)))
monix = (evid)malloc(sizeof(*monix)+dbevsize);
}
else
if(!(monix = (evid)ellGet(&free_event_list)))
if(!(monix = (evid)dllGet(&free_event_list)))
monix = (evid)malloc(sizeof *monix);
}
# else
if(!(monix = (evid)ellGet(&free_event_list)))
if(!(monix = (evid)dllGet(&free_event_list)))
monix = (evid) malloc(sizeof *monix);
# endif
@@ -1750,7 +1745,7 @@ unsigned mask;
is no chance that it will be deleted
at exit before it is completely created
*/
ellAdd(&chix->eventq, monix);
dllAdd(&chix->eventq, monix);
/*
force event to be called at least once
@@ -1771,7 +1766,7 @@ unsigned mask;
/* It can be added to the list any place if it is remote */
/* Place in the channel list */
ellAdd(&chix->eventq, (ELLNODE *)monix);
dllAdd(&chix->eventq, monix);
ca_request_event(monix);
@@ -1867,7 +1862,7 @@ void *pfl;
void *pval;
register unsigned size;
struct tmp_buff{
ELLNODE node;
NODE node;
unsigned size;
};
struct tmp_buff *pbuf = NULL;
@@ -1906,7 +1901,7 @@ void *pfl;
pbuf = (struct tmp_buff *)
lcl_buff_list.node.next;
if(pbuf->size >= size){
ellDelete(
dllDelete(
&lcl_buff_list,
pbuf);
}else
@@ -1986,7 +1981,7 @@ void *pfl;
if(ptbuf)
ptbuf = (struct tmp_buff *) ptbuf->node.previous;
ellInsert(
dllInsert(
&lcl_buff_list,
ptbuf,
pbuf);
@@ -2014,12 +2009,12 @@ void *pfl;
* after leaving this routine.
*
*/
ca_clear_event
int ca_clear_event
#ifdef __STDC__
(register evid monix)
(evid monix)
#else
(monix)
register evid monix;
evid monix;
#endif
{
register chid chix = monix->chan;
@@ -2038,16 +2033,16 @@ ca_clear_event
* dont allow two threads to delete the same moniitor at once
*/
LOCK;
status = ellFind(&chix->eventq, monix);
status = dllFind(&chix->eventq, monix);
if (status != ERROR) {
ellDelete(&chix->eventq, monix);
dllDelete(&chix->eventq, monix);
status = db_cancel_event(monix + 1);
}
UNLOCK;
if (status == ERROR)
return ECA_BADMONID;
ellAdd(&dbfree_ev_list, monix);
dllAdd(&dbfree_ev_list, monix);
return ECA_NORMAL;
}
@@ -2091,7 +2086,7 @@ ca_clear_event
piiu->outstanding_ack_count++;
}
else{
ellDelete(&monix->chan->eventq, (ELLNODE *)monix);
dllDelete(&monix->chan->eventq, monix);
}
UNLOCK;
@@ -2115,10 +2110,10 @@ ca_clear_event
*/
ca_clear_channel
#ifdef __STDC__
(register chid chix)
(chid chix)
#else
(chix)
register chid chix;
chid chix;
#endif
{
register evid monix;
@@ -2155,17 +2150,17 @@ ca_clear_channel
/*
* clear out the events for this channel
*/
while (monix = (evid) ellGet(&chix->eventq)) {
while (monix = (evid) dllGet(&chix->eventq)) {
status = db_cancel_event(monix + 1);
if (status == ERROR)
abort();
ellAdd(&dbfree_ev_list, monix);
dllAdd(&dbfree_ev_list, monix);
}
/*
* clear out this channel
*/
ellDelete(&local_chidlist, chix);
dllDelete(&local_chidlist, chix);
free((char *) chix);
break; /* to unlock exit */
@@ -2179,8 +2174,8 @@ ca_clear_channel
* check for conn state while locked to avoid a race
*/
if(old_chan_state != cs_conn){
ellConcat(&free_event_list, &chix->eventq);
ellDelete(&piiu->chidlist, (ELLNODE *)chix);
dllConcat(&free_event_list, &chix->eventq);
dllDelete(&piiu->chidlist, chix);
if (chix->iocix != BROADCAST_IIU &&
!piiu->chidlist.count){
close_ioc(piiu);
@@ -2255,9 +2250,9 @@ ca_clear_channel
/* ca_flush_io() is called by this routine. */
/************************************************************************/
#ifdef __STDC__
int ca_pend(ca_real timeout, int early)
ca_pend(ca_real timeout, int early)
#else
int ca_pend(timeout, early)
ca_pend(timeout, early)
ca_real timeout;
int early;
#endif
@@ -2321,7 +2316,7 @@ int early;
beg_time = time(NULL);
while(TRUE){
#if defined(UNIX)
# if defined(UNIX)
{
struct timeval itimeout;
@@ -2331,18 +2326,16 @@ int early;
recv_msg_select(&itimeout);
UNLOCK;
}
#else
# if defined(vxWorks)
# ifdef V5_vxWorks
# elif defined(vxWorks)
#ifdef V5_vxWorks
semTake(io_done_sem, LOCALTICKS);
# else
#else
{
int dummy;
vrtxPend(&io_done_sem->count, LOCALTICKS, &dummy);
}
# endif
# else
# if defined(VMS)
#endif
# elif defined(VMS)
{
int status;
unsigned int systim[2]={-LOCALTICKS,~0};
@@ -2359,11 +2352,9 @@ int early;
if(status != SS$_NORMAL)
lib$signal(status);
}
# else
# else
@@@@ dont compile in this case @@@@
# endif
# endif
#endif
# endif
LOCK;
manage_conn(TRUE);
@@ -2436,7 +2427,7 @@ ca_pend_io_cleanup()
*
*
*/
ca_flush_io
int ca_flush_io
#ifdef __STDC__
(void)
#else
@@ -2502,7 +2493,7 @@ void ca_signal_with_file_and_lineno(ca_status,message,pfilenm,lineno)
int ca_status;
char *message;
char *pfilenm;
unsigned lineno;
int lineno;
#endif
{
static char *severity[] =
@@ -2579,7 +2570,7 @@ unsigned lineno;
*/
void
ca_busy_message(piiu)
register struct ioc_in_use *piiu;
struct ioc_in_use *piiu;
{
struct extmsg *mptr;
@@ -2610,7 +2601,7 @@ ca_busy_message(piiu)
*/
void
ca_ready_message(piiu)
register struct ioc_in_use *piiu;
struct ioc_in_use *piiu;
{
struct extmsg *mptr;
@@ -2759,3 +2750,62 @@ chid chix;
{
return iiu[chix->iocix].host_name_str;
}
/*
*
* CA_CHANNEL_STATUS
*
*/
#ifdef vxWorks
int ca_channel_status(tid)
int tid;
{
int i;
chid chix;
struct ca_static *pcas;
pcas = (struct ca_static *)
taskVarGet(tid, &ca_static);
if (pcas == (struct ca_static *) ERROR)
return ECA_NOCACTX;
for (i = 0; i < pcas->ca_nxtiiu; i++) {
# define ca_static pcas
LOCK
# undef ca_static
chix = (chid) &pcas->ca_iiu[i].chidlist.node;
while (chix = (chid) chix->node.next){
printf( "%s native type=%d ",
ca_name(chix),
ca_field_type(chix));
printf( "N elements=%d IOC=%s state=",
ca_element_count(chix),
pcas->ca_iiu[i].host_name_str);
switch(ca_state(chix)){
case cs_never_conn:
printf("never connected to an IOC");
break;
case cs_prev_conn:
printf("disconnected from IOC");
break;
case cs_conn:
printf("connected to an IOC");
break;
case cs_closed:
printf("invalid channel");
break;
default:
}
printf("\n");
}
# define ca_static pcas
UNLOCK
# undef ca_static
}
return ECA_NORMAL;
}
#endif vxWorks

View File

@@ -1,4 +1,4 @@
static char *sccsId = "$Id$\t$Date$";
static char *sccsId = "@(#)acctst.c 1.8\t2/19/93";
/*
* CA test/debug routine
@@ -20,11 +20,9 @@ static char *sccsId = "$Id$\t$Date$";
/* System includes */
#if defined(UNIX)
# include <stdio.h>
#else
# if defined(vxWorks)
#elif defined(vxWorks)
# include <vxWorks.h>
# include <taskLib.h>
# endif
#endif
#include <cadef.h>

View File

@@ -2,10 +2,8 @@ static char *sccsId = "@(#)ca_printf.c 1.2\t7/27/92";
#if defined(UNIX) || defined(VMS)
# include <stdio.h>
#else
# if defined(vxWorks)
#elif defined(vxWorks)
# include <vxWorks.h>
# endif
#endif
#include <varargs.h>
@@ -37,8 +35,7 @@ va_dcl
pformat,
args);
}
# else
# if defined(vxWorks)
# elif defined(vxWorks)
{
int logMsgArgs[6];
int i;
@@ -58,9 +55,8 @@ va_dcl
logMsgArgs[6]);
}
# else
# else
#### dont compile in this case ####
# endif
# endif
va_end(args);

View File

@@ -19,6 +19,7 @@
/* .05 072792 joh better messages */
/* .06 111892 joh tuned up cast retries */
/* .07 010493 joh print retry count when `<Trying>' */
/* .08 010493 joh removed `<Trying>' message */
/* */
/*_begin */
/************************************************************************/
@@ -37,15 +38,11 @@ static char *sccsId = "$Id$\t$Date$";
#if defined(UNIX)
# include <stdio.h>
#else
# if defined(VMS)
# else
# if defined(vxWorks)
#elif defined(VMS)
#elif defined(vxWorks)
#include <vxWorks.h>
# else
#else
@@@@ dont compile @@@@
# endif
# endif
#endif
#include <cadef.h>
@@ -139,10 +136,12 @@ char silent;
}
if(retry_cnt){
#ifdef TRYING_MESSAGE
ca_printf("<Trying %d> ", retry_cnt);
#ifdef UNIX
fflush(stdout);
#endif
#endif UNIX
#endif TRYING_MESSAGE
if(!silent && retry_cnt_no_handler){
sprintf(sprintf_buf, "%d channels outstanding", retry_cnt);

View File

@@ -33,7 +33,7 @@
/************************************************************************/
/*_end */
static char *sccsId = "$Id$\t$Date$";
static char *sccsId = "@(#)flow_control.c 1.7\t6/2/93";
#if defined(vxWorks)
# include <vxWorks.h>
@@ -43,8 +43,7 @@ static char *sccsId = "$Id$\t$Date$";
# ifndef V5_vxWorks
# include <types.h>
# endif
#else
# if defined(VMS)
#elif defined(VMS)
# include <sys/types.h>
# include <sys/socket.h>
# if defined(UCX) /* GeG 09-DEC-1992 */
@@ -53,15 +52,12 @@ static char *sccsId = "$Id$\t$Date$";
# else
# include <sys/ioctl.h>
# endif
# else
# if defined(UNIX)
#elif defined(UNIX)
# include <sys/types.h>
# include <sys/socket.h>
# include <sys/ioctl.h>
# else
#else
@@@@ dont compile @@@@
# endif
# endif
#endif
#include <os_depen.h>

View File

@@ -88,22 +88,20 @@ static char *sccsId = "@(#)gsd_sync_subr.c 1.8\t11/5/92";
# include <stdio.h>
# include <sys/time.h>
# include <time.h>
#else
# if defined(vxWorks)
#elif defined(vxWorks)
# define abort(A) taskSuspend(taskIdSelf())
# ifdef V5vxWorks
#ifdef V5vxWorks
# include <Vxtypes.h>
# else
#else
# include <types.h>
# endif
#endif
# if 0 /* needed ?? */
# include <stdioLib.h>
# include <sys/time.h>
# include <time.h>
# endif
# else
#else
@@@@ dont compile in this case @@@@
# endif
#endif
#include <cadef.h>

View File

@@ -69,7 +69,6 @@ static char *sccsId = "$Id$\t$Date$";
/* Allocate storage for global variables in this module */
#define CA_GLBLSOURCE
#if defined(VMS)
# include <iodef.h>
# include <stsdef.h>
@@ -80,23 +79,21 @@ static char *sccsId = "$Id$\t$Date$";
# include <sys/socket.h>
# include <netinet/in.h>
# include <netinet/tcp.h>
# if defined(UCX) /* GeG 09-DEC-1992 */
#if defined(UCX) /* GeG 09-DEC-1992 */
# include <sys/ucx$inetdef.h>
# include <ucx.h>
# else
#else
# include <vms/inetiodef.h>
# include <sys/ioctl.h>
# endif
#else
# if defined(UNIX)
#endif
#elif defined(UNIX)
# include <sys/types.h>
# include <sys/errno.h>
# include <sys/socket.h>
# include <netinet/in.h>
# include <netinet/tcp.h>
# include <sys/ioctl.h>
# else
# if defined(vxWorks)
#elif defined(vxWorks)
# include <vxWorks.h>
# ifdef V5_vxWorks
# include <systime.h>
@@ -110,11 +107,8 @@ static char *sccsId = "$Id$\t$Date$";
# include <tcp.h>
# include <ioctl.h>
# include <task_params.h>
# endif
# endif
#endif
#include <cadef.h>
#include <net_convert.h>
#include <iocmsg.h>
@@ -128,7 +122,6 @@ static void tcp_recv_msg();
static void udp_recv_msg();
static void notify_ca_repeater();
static int cac_send_msg_piiu();
static int create_net_chan();
#ifdef VMS
void vms_recv_msg_ast();
#endif
@@ -137,16 +130,16 @@ void vms_recv_msg_ast();
/*
* used to be that some TCP/IPs did not include this
*/
#ifndef NBBY
# define NBBY 8 /* number of bits per byte */
#endif
#ifdef JUNKYARD
typedef long fd_mask;
typedef struct fd_set {
fd_mask fds_bits[64];
} fd_set;
#ifndef NBBY
# define NBBY 8 /* number of bits per byte */
#endif
#ifndef NFDBITS
#define NFDBITS (sizeof(int) * NBBY) /* bits per mask */
#endif
@@ -526,7 +519,7 @@ struct ioc_in_use *piiu;
/* Set up recv thread for VMS */
#if defined(VMS)
# if defined(VMS)
{
/*
* request to be informed of future IO
@@ -549,8 +542,7 @@ struct ioc_in_use *piiu;
exit();
}
}
#else
# if defined(vxWorks)
# elif defined(vxWorks)
{
static void recv_task();
int pri;
@@ -580,8 +572,7 @@ struct ioc_in_use *piiu;
piiu->recv_tid = status;
}
# endif
#endif
# endif
return ECA_NORMAL;
}
@@ -676,14 +667,12 @@ void cac_send_msg()
* frees up push pull deadlock only
* if recv not already in progress
*/
#if defined(UNIX)
# if defined(UNIX)
if(post_msg_active==0){
recv_msg_select(&notimeout);
}
#else
# if defined(vxWorks)
# endif
#endif
# elif defined(vxWorks)
# endif
done = TRUE;
for(piiu=iiu; piiu<&iiu[nxtiiu]; piiu++){
@@ -875,7 +864,7 @@ void
recv_msg_select(ptimeout)
struct timeval *ptimeout;
{
int status;
long status;
register struct ioc_in_use *piiu;
struct timeval *ptmptimeout;
@@ -1189,6 +1178,8 @@ int moms_tid;
{
int status;
taskwdInsert((int) taskIdCurrent, NULL, NULL);
status = taskVarAdd(VXTHISTASKID, &ca_static);
if(status == ERROR)
abort();
@@ -1216,6 +1207,8 @@ int moms_tid;
if(status == ERROR)
abort();
taskwdRemove((int) taskIdCurrent, NULL, NULL);
exit();
}
#endif

View File

@@ -52,33 +52,31 @@
#ifndef INCiocinfh
#define INCiocinfh
static char *iocinfhSccsId = "$Id$\t$Date$";
static char *iocinfhSccsId = "@(#)iocinf.h 1.15\t6/2/93";
#define DONT_COMPILE @@@@ dont compile in this case @@@@
#if defined(UNIX)
# include <sys/types.h>
# include <netinet/in.h>
#else
# if defined(VMS)
#elif defined(VMS)
# include <ssdef>
# include <sys/types.h>
# include <netinet/in.h>
# else
# if defined(vxWorks)
#elif defined(vxWorks)
# ifdef V5_vxWorks
# include <vxWorks.h>
# else
# include <types.h>
# endif
# include <in.h>
# else
#else
DONT_COMPILE
# endif
# endif
#endif
# include <ellLib.h>
#ifndef INCdllLibh
# include <dllLib.h>
#endif
#ifndef INCos_depenh
# include <os_depen.h>
@@ -116,7 +114,7 @@ struct buffer{
#define BROADCAST_IIU 0
struct pending_io_event{
ELLNODE node;
NODE node;
void (*io_done_sub)();
void *io_done_arg;
};
@@ -152,8 +150,7 @@ typedef unsigned long ca_time;
# define readch (ca_static->ca_readch)
# define writech (ca_static->ca_writech)
# define excepch (ca_static->ca_excepch)
#else
# if defined(vxWorks)
#elif defined(vxWorks)
# define io_done_sem (ca_static->ca_io_done_sem)
# define evuser (ca_static->ca_evuser)
# define client_lock (ca_static->ca_client_lock)
@@ -162,22 +159,19 @@ typedef unsigned long ca_time;
# define dbfree_ev_list (ca_static->ca_dbfree_ev_list)
# define lcl_buff_list (ca_static->ca_lcl_buff_list)
# define event_tid (ca_static->ca_event_tid)
# else
# if defined(VMS)
#elif defined(VMS)
# define io_done_flag (ca_static->ca_io_done_flag)
# define peek_ast_buf (ca_static->ca_peek_ast_buf)
# define ast_lock_count (ca_static->ca_ast_lock_count)
# else
#else
DONT_COMPILE
# endif
# endif
#endif
struct ca_static{
unsigned short ca_nxtiiu;
long ca_pndrecvcnt;
ELLLIST ca_ioeventlist;
LIST ca_ioeventlist;
void (*ca_exception_func)();
void *ca_exception_arg;
void (*ca_connection_func)();
@@ -186,8 +180,8 @@ struct ca_static{
void *ca_fd_register_arg;
short ca_exit_in_progress;
unsigned short ca_post_msg_active;
ELLLIST ca_free_event_list;
ELLLIST ca_pend_read_list;
LIST ca_free_event_list;
LIST ca_pend_read_list;
short ca_repeater_contacted;
unsigned short ca_send_msg_active;
short ca_cast_available;
@@ -196,27 +190,23 @@ struct ca_static{
#if defined(UNIX)
fd_set ca_readch;
fd_set ca_excepch;
#else
# if defined(VMS)
#elif defined(VMS)
int ca_io_done_flag;
char ca_peek_ast_buf;
long ca_ast_lock_count;
# else
# if defined(vxWorks)
#elif defined(vxWorks)
SEM_ID ca_io_done_sem;
void *ca_evuser;
FAST_LOCK ca_client_lock;
FAST_LOCK ca_event_lock; /* dont allow events to preempt */
int ca_tid;
ELLLIST ca_local_chidlist;
ELLLIST ca_dbfree_ev_list;
ELLLIST ca_lcl_buff_list;
LIST ca_local_chidlist;
LIST ca_dbfree_ev_list;
LIST ca_lcl_buff_list;
int ca_event_tid;
unsigned ca_local_ticks;
# else
#else
DONT_COMPILE
# endif
# endif
#endif
struct ioc_in_use{
unsigned outstanding_ack_count;
@@ -233,7 +223,7 @@ struct ca_static{
struct buffer *recv;
unsigned read_seq;
unsigned cur_read_seq;
ELLLIST chidlist; /* chans on this connection */
LIST chidlist; /* chans on this connection */
short conn_up; /* boolean: T-conn /F-disconn */
short send_needed; /* CA needs a send */
char host_name_str[32];
@@ -244,15 +234,11 @@ struct ca_static{
#if defined(VMS) /* for qio ASTs */
struct sockaddr_in recvfrom;
struct iosb iosb;
#else
# if defined(vxWorks)
#elif defined(vxWorks)
int recv_tid;
# else
# if defined(UNIX)
# else
#elif defined(UNIX)
#else
DONT_COMPILE
# endif
# endif
#endif
} ca_iiu[MAXIIU];
};

View File

@@ -29,7 +29,7 @@
#ifndef INCos_depenh
#define INCos_depenh
static char *os_depenhSccsId = "$Id$\t$Date$";
static char *os_depenhSccsId = "@(#)os_depen.h 1.12\t2/19/93";
#if defined(UNIX)
# ifndef _sys_time_h
@@ -38,8 +38,7 @@ static char *os_depenhSccsId = "$Id$\t$Date$";
# ifndef _sys_errno_h
# include <sys/errno.h>
# endif
#else
# if defined(vxWorks)
#elif defined(vxWorks)
# ifndef INCvxWorksh
# include <vxWorks.h>
# endif
@@ -52,12 +51,9 @@ static char *os_depenhSccsId = "$Id$\t$Date$";
# ifndef V5_vxWorks
IMPORT ULONG taskIdCurrent;
# endif
# else
# if defined(VMS)
# else
#elif defined(VMS)
#else
@@@@ dont compile in this case @@@@
# endif
# endif
#endif
@@ -113,8 +109,7 @@ static char *os_depenhSccsId = "$Id$\t$Date$";
# define UNLOCKEVENTS
# define EVENTLOCKTEST (post_msg_active!=0)
# define RECV_ACTIVE(PIIU) (piiu->active)
#else
# if defined(vxWorks)
#elif defined(vxWorks)
# define VXTASKIDNONE 0
# define LOCK FASTLOCK(&client_lock);
# define UNLOCK FASTUNLOCK(&client_lock);
@@ -122,18 +117,15 @@ static char *os_depenhSccsId = "$Id$\t$Date$";
# define UNLOCKEVENTS {event_tid=VXTASKIDNONE; FASTUNLOCK(&event_lock);}
# define EVENTLOCKTEST (FASTLOCKTEST(&event_lock)&&taskIdCurrent==event_tid)
# define RECV_ACTIVE(PIIU) (piiu->recv_tid == taskIdCurrent)
# else
# if defined(UNIX)
#elif defined(UNIX)
# define LOCK
# define UNLOCK
# define LOCKEVENTS
# define UNLOCKEVENTS
# define EVENTLOCKTEST (post_msg_active!=0)
# define RECV_ACTIVE(PIIU) (piiu->active)
# else
#else
@@@@ dont compile in this case @@@@
# endif
# endif
#endif
#ifdef vxWorks
@@ -145,29 +137,23 @@ static char *os_depenhSccsId = "$Id$\t$Date$";
#if defined(VMS)
# if defined(WINTCP) /* Wallangong */
# if defined(WINTCP) /* Wallangong */
/* (the VAXC runtime lib has its own close */
# define socket_close(S) netclose(S)
# define socket_ioctl(A,B,C) ioctl(A,B,C)
# else
# if defined(UCX) /* GeG 09-DEC-1992 */
# elif defined(UCX) /* GeG 09-DEC-1992 */
# define socket_close(S) close(S)
# define socket_ioctl(A,B,C) ioctl(A,B,C)
# else
# endif
# endif
# else
# endif
#elif defined(UNIX)
# define socket_close(S) close(S)
# define socket_ioctl(A,B,C) ioctl(A,B,C)
#elif defined(vxWorks)
# define socket_close(S) close(S)
# define socket_ioctl(A,B,C) ioctl(A,B,C)
#else
# if defined(UNIX)
# define socket_close(S) close(S)
# define socket_ioctl(A,B,C) ioctl(A,B,C)
# else
# if defined(vxWorks)
# define socket_close(S) close(S)
# define socket_ioctl(A,B,C) ioctl(A,B,C)
# else
@@@@ dont compile in this case @@@@
# endif
# endif
#endif
#if defined(VMS)
@@ -178,15 +164,11 @@ static char *os_depenhSccsId = "$Id$\t$Date$";
extern volatile int noshare socket_errno;
# define MYERRNO socket_errno
# endif
#else
# if defined(vxWorks)
#elif defined(vxWorks)
# define MYERRNO (errnoGet()&0xffff)
# else
# if defined(UNIX)
#elif defined(UNIX)
extern int errno;
# define MYERRNO errno
# endif
# endif
#endif
#ifdef VMS
@@ -201,19 +183,15 @@ static char *os_depenhSccsId = "$Id$\t$Date$";
#if defined(vxWorks)
# ifdef V5_vxWorks
#ifdef V5_vxWorks
# define POST_IO_EV semGive(io_done_sem)
# else
# define POST_IO_EV vrtxPost(&io_done_sem->count, TRUE)
# endif
#else
# if defined(VMS)
# define POST_IO_EV vrtxPost(&io_done_sem->count, TRUE)
#endif
#elif defined(VMS)
# define POST_IO_EV sys$setef(io_done_flag)
# else
# if defined(UNIX)
#elif defined(UNIX)
# define POST_IO_EV
# endif
# endif
#endif
/* delay for when a poll is used */
@@ -241,13 +219,11 @@ static char *os_depenhSccsId = "$Id$\t$Date$";
status = sys$waitfr(ef); \
if(~status&STS$M_SUCCESS)lib$signal(status); \
};
#else
# if defined(vxWorks)
#elif defined(vxWorks)
# define SYSFREQ ((long) sysClkRateGet()) /* usually 60 Hz */
# define TCPDELAY taskDelay(ca_static->ca_local_ticks);
# define time(A) (tickGet()/SYSFREQ)
# else
# if defined(UNIX)
#elif defined(UNIX)
# define SYSFREQ 1000000L /* 1 MHz */
/*
* this version of TCPDELAY copies tcpdelayval into temporary storage
@@ -269,8 +245,6 @@ static char *os_depenhSccsId = "$Id$\t$Date$";
# else
extern struct timeval tcpdelayval;
# endif
# endif
# endif
#endif
#endif

View File

@@ -67,26 +67,22 @@ static char *sccsId = "$Id$\t$Date$";
# include <sys/types.h>
# include <sys/socket.h>
# include <netinet/in.h>
#else
# if defined(UNIX)
#elif defined(UNIX)
# include <errno.h>
# include <sys/types.h>
# include <sys/socket.h>
# include <netinet/in.h>
# else
# if defined(vxWorks)
#elif defined(vxWorks)
# include <vxWorks.h>
# include <errno.h>
# include <types.h>
# include <socket.h>
# include <in.h>
# else
#else
@@@@ dont compile @@@@
# endif
# endif
#endif
#include <ellLib.h>
#include <dllLib.h>
#include <iocmsg.h>
#include <os_depen.h>
@@ -95,12 +91,12 @@ static char *sccsId = "$Id$\t$Date$";
* per machine so we dont care about reentrancy
*/
struct one_client{
ELLNODE node;
NODE node;
struct sockaddr_in from;
};
static
ELLLIST client_list;
LIST client_list;
static
char buf[MAX_UDP];
@@ -176,7 +172,7 @@ ca_repeater()
struct one_client *pclient;
struct one_client *pnxtclient;
ellInit(&client_list);
dllInit(&client_list);
/* allocate a socket */
sock = socket( AF_INET, /* domain */
@@ -215,6 +211,10 @@ ca_repeater()
return FALSE;
}
# ifdef vxWorks
taskwdInsert((int)taskIdCurrent, NULL, NULL);
# endif
#ifdef DEBUG
ca_printf("CA Repeater: Attached and initialized\n");
#endif
@@ -274,7 +274,7 @@ ca_repeater()
malloc(sizeof *pclient);
if(pclient){
pclient->from = from;
ellAdd(&client_list, (ELLNODE *)pclient);
dllAdd(&client_list, pclient);
#ifdef DEBUG
ca_printf("Added %x %d\n", from.sin_port, size);
#endif
@@ -356,7 +356,7 @@ struct one_client *pclient;
socket_close(sock);
if(!present){
ellDelete(&client_list, (ELLNODE *)pclient);
dllDelete(&client_list, pclient);
free(pclient);
#ifdef DEBUG
ca_printf("Deleted\n");

View File

@@ -68,25 +68,21 @@
/************************************************************************/
/*_end */
static char *sccsId = "$Id$\t$Date$";
static char *sccsId = "@(#)service.c 1.17\t6/2/93";
#if defined(VMS)
# include <sys/types.h>
# include <stsdef.h>
#else
# if defined(UNIX)
#elif defined(UNIX)
# include <sys/types.h>
# include <stdio.h>
# else
# if defined(vxWorks)
#elif defined(vxWorks)
# include <vxWorks.h>
# ifndef V5_vxWorks
# include <types.h>
# endif
# else
#else
@@@@ dont compile @@@@
# endif
# endif
#endif
#include <os_depen.h>
@@ -204,8 +200,8 @@ post_msg(hdrptr, pbufcnt, pnet_addr, piiu)
UNLOCKEVENTS;
}
LOCK;
ellDelete(&pend_read_list, (ELLNODE *)monix);
ellAdd(&free_event_list, (ELLNODE *)monix);
dllDelete(&pend_read_list, monix);
dllAdd(&free_event_list, monix);
UNLOCK;
piiu->outstanding_ack_count--;
@@ -229,8 +225,8 @@ post_msg(hdrptr, pbufcnt, pnet_addr, piiu)
*/
if (!t_postsize) {
LOCK;
ellDelete(&monix->chan->eventq, (ELLNODE *)monix);
ellAdd(&free_event_list, (ELLNODE *)monix);
dllDelete(&monix->chan->eventq, monix);
dllAdd(&free_event_list, monix);
UNLOCK;
piiu->outstanding_ack_count--;
@@ -442,8 +438,8 @@ post_msg(hdrptr, pbufcnt, pnet_addr, piiu)
struct ioc_in_use *piiu = &iiu[chix->iocix];
LOCK;
ellDelete(&piiu->chidlist, (ELLNODE *)chix);
ellAdd(&iiu[BROADCAST_IIU].chidlist, (ELLNODE *)chix);
dllDelete(&piiu->chidlist, chix);
dllAdd(&iiu[BROADCAST_IIU].chidlist, chix);
chix->iocix = BROADCAST_IIU;
if (!piiu->chidlist.count)
close_ioc(piiu);
@@ -475,11 +471,11 @@ post_msg(hdrptr, pbufcnt, pnet_addr, piiu)
monix;
monix = (evid) monix->node.next)
if (monix->chan == chix) {
ellDelete(&pend_read_list, (ELLNODE *)monix);
ellAdd(&free_event_list, (ELLNODE *)monix);
dllDelete(&pend_read_list, monix);
dllAdd(&free_event_list, monix);
}
ellConcat(&free_event_list, &chix->eventq);
ellDelete(&piiu->chidlist, (ELLNODE *)chix);
dllConcat(&free_event_list, &chix->eventq);
dllDelete(&piiu->chidlist, chix);
free(chix);
piiu->outstanding_ack_count--;
if (!piiu->chidlist.count)
@@ -629,9 +625,9 @@ struct in_addr *pnet_addr;
if(chan->iocix != BROADCAST_IIU)
ca_signal(ECA_NEWADDR, (char *)(chan+1));
chpiiu = &iiu[chan->iocix];
ellDelete(&chpiiu->chidlist, (ELLNODE *)chan);
dllDelete(&chpiiu->chidlist, chan);
chan->iocix = newiocix;
ellAdd(&iiu[newiocix].chidlist, (ELLNODE *)chan);
dllAdd(&iiu[newiocix].chidlist, chan);
}
/*
@@ -712,7 +708,7 @@ int lock;
LOCK;
}
while(pioe = (struct pending_io_event *) ellGet(&ioeventlist)){
while(pioe = (struct pending_io_event *) dllGet(&ioeventlist)){
(*pioe->io_done_sub)(pioe->io_done_arg);
free(pioe);
}
@@ -744,9 +740,9 @@ client_channel_exists(chan)
for (piiu = iiu; piiu < pnext_iiu; piiu++) {
/*
* ellFind returns the node number or ERROR
* dllFind returns the node number or ERROR
*/
status = ellFind(&piiu->chidlist, (ELLNODE *)chan);
status = dllFind(&piiu->chidlist, chan);
if (status != ERROR) {
return TRUE;
}