diff options
author | daniel <daniel@roi> | 2013-01-30 12:15:53 +0900 |
---|---|---|
committer | daniel <daniel@roi> | 2013-01-30 12:15:53 +0900 |
commit | c4957e4c650008698226c9b4b236222280f16396 (patch) | |
tree | 4e3f7498554f0e3d0ef916d684072a808ef02092 /vxi11_server.c | |
parent | 0cda537acf1ac6652ca8d2f3d0bfa1bd2725b2bd (diff) |
Make interrupt timeout configurable
Diffstat (limited to 'vxi11_server.c')
-rw-r--r-- | vxi11_server.c | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/vxi11_server.c b/vxi11_server.c index d374f3a..34e2919 100644 --- a/vxi11_server.c +++ b/vxi11_server.c @@ -67,7 +67,7 @@ static bool isValidLink(int linkid) { #endif return false; } - return links[linkid] != NULL; + return links[linkid] != NULL ; } // test if a link has expired, this is to avoid dead locks @@ -126,7 +126,7 @@ static void freelink(ActiveLink* link) { if (globals.Remote.vxi_connections == 0) { // cancel any remaining panel locks - globals.Remote.vxi_panel_lock = 0; + globals.Remote.vxi_panel_lock = 0; } #ifdef DEBUG @@ -145,7 +145,7 @@ static void freelink(ActiveLink* link) { void vxi11_deadsocketcallback(int socket) { int linkid; for (linkid = 0; linkid < SIZEOFARRAY(links); linkid++) { - if (links[linkid] != NULL) { + if (links[linkid] != NULL ) { if (links[linkid]->sock == socket) { #ifdef DEBUG printf("Freeing link %d, socket died\n", linkid); @@ -199,15 +199,15 @@ create_link_1_svc(Create_LinkParms *argp, struct svc_req *rqstp) { } else { ActiveLink* link = g_malloc(sizeof(ActiveLink)); - if (link == NULL) { + if (link == NULL ) { result.error = ERR_OUTOFRESOURCES; } else { int linkid; for (linkid = 0; linkid < SIZEOFARRAY(links); linkid++) { - if (links[linkid] != NULL) // clean up any dead links + if (links[linkid] != NULL ) // clean up any dead links linkexpired(links[linkid]); - if (links[linkid] == NULL) { + if (links[linkid] == NULL ) { links[linkid] = link; break; } @@ -262,7 +262,7 @@ device_write_1_svc(Device_WriteParms *argp, struct svc_req *rqstp) { printf("\n"); printf("got <<%s>> (reported length %d)on link %d.\n", str, (int) argp->data.data_len, (int) argp->lid); #endif - Parser_main(str, 0, GPIB_and_VXI_start_query_response, NULL); + Parser_main(str, 0, GPIB_and_VXI_start_query_response, NULL ); g_free(str); result.size = argp->data.data_len; } @@ -278,7 +278,7 @@ device_read_1_svc(Device_ReadParms *argp, struct svc_req *rqstp) { #endif // this free's the data from the last call - if (result.data.data_val != NULL) + if (result.data.data_val != NULL ) g_free(result.data.data_val); memset(&result, 0, sizeof(result)); @@ -292,7 +292,7 @@ device_read_1_svc(Device_ReadParms *argp, struct svc_req *rqstp) { } else { touchlink(argp->lid); - if (globals.Registers.pending_output_message != NULL) { + if (globals.Registers.pending_output_message != NULL ) { result.data.data_len = strlen(globals.Registers.pending_output_message); result.data.data_val = globals.Registers.pending_output_message; globals.Registers.pending_output_message = NULL; @@ -456,9 +456,9 @@ device_unlock_1_svc(Device_Link *argp, struct svc_req *rqstp) { void vxi11_fireinterrupt() { #ifdef DEBUG - printf("vxi11_fireinterrupt()\n"); + printf("vxi11_fireinterrupt()\n"); #endif - if (intclient != NULL) { + if (intclient != NULL ) { Device_SrqParms params; params.handle.handle_val = inthandler; params.handle.handle_len = strlen(inthandler); @@ -476,18 +476,23 @@ device_enable_srq_1_svc(Device_EnableSrqParms *argp, struct svc_req *rqstp) { result.error = ERR_INVALIDLINKINDENTIFIER; else { touchlink(argp->lid); - if (inthandler != NULL) { + if (inthandler != NULL ) { g_free(inthandler); inthandler = NULL; } if (argp->enable) { - if (argp->handle.handle_val != NULL) { + if (argp->handle.handle_val != NULL ) { inthandler = g_strdup(argp->handle.handle_val); #ifdef DEBUG printf("Interrupt handle set to %s\n", inthandler); #endif } } +#ifdef DEBUG + else { + printf("Interrupts disabled\n"); + } +#endif result.error = 0; intenabled = argp->enable; } @@ -546,7 +551,7 @@ create_intr_chan_1_svc(Device_RemoteFunc *argp, struct svc_req *rqstp) { // if a client had an interrupt channel and died without closing it // we need to clean it up to avoid a deadlock static struct rpc_err err; - if (intclient != NULL) { + if (intclient != NULL ) { clnt_geterr(intclient, &err); if (err.re_errno != 0) { #ifdef DEBUG @@ -559,7 +564,7 @@ create_intr_chan_1_svc(Device_RemoteFunc *argp, struct svc_req *rqstp) { if (argp->progFamily != DEVICE_TCP || argp->progNum != DEVICE_INTR || argp->progVers != DEVICE_INTR_VERSION) result.error = ERR_OPERATIONNOTSUPPORTED; - else if (intclient != NULL) { + else if (intclient != NULL ) { result.error = ERR_CHANNELALREADYESTABLISHED; } else { @@ -569,7 +574,7 @@ create_intr_chan_1_svc(Device_RemoteFunc *argp, struct svc_req *rqstp) { clientaddr.sin_addr.s_addr = addr; int sock = RPC_ANYSOCK; CLIENT* clnt = clnttcp_create(&clientaddr, DEVICE_INTR, DEVICE_INTR_VERSION, &sock, 0, 0); - if (clnt == NULL) { + if (clnt == NULL ) { #ifdef DEBUG printf("Couldn't create interrupt channel client\n"); #endif @@ -592,7 +597,7 @@ destroy_intr_chan_1_svc(void *argp, struct svc_req *rqstp) { #ifdef DEBUG printf("destroy_intr_chan_1_svc()\n"); #endif - if (intclient == NULL) { + if (intclient == NULL ) { result.error = ERR_CHANNELNOTESTABLISHED; } else { |