summaryrefslogtreecommitdiff
path: root/vxi11_svc.c
diff options
context:
space:
mode:
Diffstat (limited to 'vxi11_svc.c')
-rw-r--r--vxi11_svc.c217
1 files changed, 111 insertions, 106 deletions
diff --git a/vxi11_svc.c b/vxi11_svc.c
index e5c4b38..3ead3b1 100644
--- a/vxi11_svc.c
+++ b/vxi11_svc.c
@@ -17,7 +17,8 @@
#define SIG_PF void(*)(int)
#endif
-static void device_async_1(struct svc_req *rqstp, register SVCXPRT *transp) {
+static void device_async_1(struct svc_req *rqstp, register SVCXPRT *transp)
+{
union {
Device_Link device_abort_1_arg;
} argument;
@@ -26,19 +27,19 @@ static void device_async_1(struct svc_req *rqstp, register SVCXPRT *transp) {
char *(*local)(char *, struct svc_req *);
switch (rqstp->rq_proc) {
- case NULLPROC:
- (void) svc_sendreply(transp, (xdrproc_t) xdr_void, (char *) NULL);
- return;
-
- case device_abort:
- _xdr_argument = (xdrproc_t) xdr_Device_Link;
- _xdr_result = (xdrproc_t) xdr_Device_Error;
- local = (char *(*)(char *, struct svc_req *)) device_abort_1_svc;
- break;
+ case NULLPROC:
+ (void) svc_sendreply(transp, (xdrproc_t) xdr_void, (char *) NULL);
+ return;
- default:
- svcerr_noproc(transp);
- return;
+ case device_abort:
+ _xdr_argument = (xdrproc_t) xdr_Device_Link;
+ _xdr_result = (xdrproc_t) xdr_Device_Error;
+ local = (char *(*)(char *, struct svc_req *)) device_abort_1_svc;
+ break;
+
+ default:
+ svcerr_noproc(transp);
+ return;
}
memset((char *) &argument, 0, sizeof(argument));
if (!svc_getargs(transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
@@ -56,7 +57,8 @@ static void device_async_1(struct svc_req *rqstp, register SVCXPRT *transp) {
return;
}
-static void device_core_1(struct svc_req *rqstp, register SVCXPRT *transp) {
+static void device_core_1(struct svc_req *rqstp, register SVCXPRT *transp)
+{
union {
Create_LinkParms create_link_1_arg;
Device_WriteParms device_write_1_arg;
@@ -78,103 +80,103 @@ static void device_core_1(struct svc_req *rqstp, register SVCXPRT *transp) {
char *(*local)(char *, struct svc_req *);
switch (rqstp->rq_proc) {
- case NULLPROC:
- (void) svc_sendreply(transp, (xdrproc_t) xdr_void, (char *) NULL);
- return;
-
- case create_link:
- _xdr_argument = (xdrproc_t) xdr_Create_LinkParms;
- _xdr_result = (xdrproc_t) xdr_Create_LinkResp;
- local = (char *(*)(char *, struct svc_req *)) create_link_1_svc;
- break;
+ case NULLPROC:
+ (void) svc_sendreply(transp, (xdrproc_t) xdr_void, (char *) NULL);
+ return;
- case device_write:
- _xdr_argument = (xdrproc_t) xdr_Device_WriteParms;
- _xdr_result = (xdrproc_t) xdr_Device_WriteResp;
- local = (char *(*)(char *, struct svc_req *)) device_write_1_svc;
- break;
+ case create_link:
+ _xdr_argument = (xdrproc_t) xdr_Create_LinkParms;
+ _xdr_result = (xdrproc_t) xdr_Create_LinkResp;
+ local = (char *(*)(char *, struct svc_req *)) create_link_1_svc;
+ break;
- case device_read:
- _xdr_argument = (xdrproc_t) xdr_Device_ReadParms;
- _xdr_result = (xdrproc_t) xdr_Device_ReadResp;
- local = (char *(*)(char *, struct svc_req *)) device_read_1_svc;
- break;
+ case device_write:
+ _xdr_argument = (xdrproc_t) xdr_Device_WriteParms;
+ _xdr_result = (xdrproc_t) xdr_Device_WriteResp;
+ local = (char *(*)(char *, struct svc_req *)) device_write_1_svc;
+ break;
- case device_readstb:
- _xdr_argument = (xdrproc_t) xdr_Device_GenericParms;
- _xdr_result = (xdrproc_t) xdr_Device_ReadStbResp;
- local = (char *(*)(char *, struct svc_req *)) device_readstb_1_svc;
- break;
+ case device_read:
+ _xdr_argument = (xdrproc_t) xdr_Device_ReadParms;
+ _xdr_result = (xdrproc_t) xdr_Device_ReadResp;
+ local = (char *(*)(char *, struct svc_req *)) device_read_1_svc;
+ break;
- case device_trigger:
- _xdr_argument = (xdrproc_t) xdr_Device_GenericParms;
- _xdr_result = (xdrproc_t) xdr_Device_Error;
- local = (char *(*)(char *, struct svc_req *)) device_trigger_1_svc;
- break;
+ case device_readstb:
+ _xdr_argument = (xdrproc_t) xdr_Device_GenericParms;
+ _xdr_result = (xdrproc_t) xdr_Device_ReadStbResp;
+ local = (char *(*)(char *, struct svc_req *)) device_readstb_1_svc;
+ break;
- case device_clear:
- _xdr_argument = (xdrproc_t) xdr_Device_GenericParms;
- _xdr_result = (xdrproc_t) xdr_Device_Error;
- local = (char *(*)(char *, struct svc_req *)) device_clear_1_svc;
- break;
+ case device_trigger:
+ _xdr_argument = (xdrproc_t) xdr_Device_GenericParms;
+ _xdr_result = (xdrproc_t) xdr_Device_Error;
+ local = (char *(*)(char *, struct svc_req *)) device_trigger_1_svc;
+ break;
- case device_remote:
- _xdr_argument = (xdrproc_t) xdr_Device_GenericParms;
- _xdr_result = (xdrproc_t) xdr_Device_Error;
- local = (char *(*)(char *, struct svc_req *)) device_remote_1_svc;
- break;
+ case device_clear:
+ _xdr_argument = (xdrproc_t) xdr_Device_GenericParms;
+ _xdr_result = (xdrproc_t) xdr_Device_Error;
+ local = (char *(*)(char *, struct svc_req *)) device_clear_1_svc;
+ break;
- case device_local:
- _xdr_argument = (xdrproc_t) xdr_Device_GenericParms;
- _xdr_result = (xdrproc_t) xdr_Device_Error;
- local = (char *(*)(char *, struct svc_req *)) device_local_1_svc;
- break;
+ case device_remote:
+ _xdr_argument = (xdrproc_t) xdr_Device_GenericParms;
+ _xdr_result = (xdrproc_t) xdr_Device_Error;
+ local = (char *(*)(char *, struct svc_req *)) device_remote_1_svc;
+ break;
- case device_lock:
- _xdr_argument = (xdrproc_t) xdr_Device_LockParms;
- _xdr_result = (xdrproc_t) xdr_Device_Error;
- local = (char *(*)(char *, struct svc_req *)) device_lock_1_svc;
- break;
+ case device_local:
+ _xdr_argument = (xdrproc_t) xdr_Device_GenericParms;
+ _xdr_result = (xdrproc_t) xdr_Device_Error;
+ local = (char *(*)(char *, struct svc_req *)) device_local_1_svc;
+ break;
- case device_unlock:
- _xdr_argument = (xdrproc_t) xdr_Device_Link;
- _xdr_result = (xdrproc_t) xdr_Device_Error;
- local = (char *(*)(char *, struct svc_req *)) device_unlock_1_svc;
- break;
+ case device_lock:
+ _xdr_argument = (xdrproc_t) xdr_Device_LockParms;
+ _xdr_result = (xdrproc_t) xdr_Device_Error;
+ local = (char *(*)(char *, struct svc_req *)) device_lock_1_svc;
+ break;
- case device_enable_srq:
- _xdr_argument = (xdrproc_t) xdr_Device_EnableSrqParms;
- _xdr_result = (xdrproc_t) xdr_Device_Error;
- local = (char *(*)(char *, struct svc_req *)) device_enable_srq_1_svc;
- break;
+ case device_unlock:
+ _xdr_argument = (xdrproc_t) xdr_Device_Link;
+ _xdr_result = (xdrproc_t) xdr_Device_Error;
+ local = (char *(*)(char *, struct svc_req *)) device_unlock_1_svc;
+ break;
- case device_docmd:
- _xdr_argument = (xdrproc_t) xdr_Device_DocmdParms;
- _xdr_result = (xdrproc_t) xdr_Device_DocmdResp;
- local = (char *(*)(char *, struct svc_req *)) device_docmd_1_svc;
- break;
+ case device_enable_srq:
+ _xdr_argument = (xdrproc_t) xdr_Device_EnableSrqParms;
+ _xdr_result = (xdrproc_t) xdr_Device_Error;
+ local = (char *(*)(char *, struct svc_req *)) device_enable_srq_1_svc;
+ break;
- case destroy_link:
- _xdr_argument = (xdrproc_t) xdr_Device_Link;
- _xdr_result = (xdrproc_t) xdr_Device_Error;
- local = (char *(*)(char *, struct svc_req *)) destroy_link_1_svc;
- break;
+ case device_docmd:
+ _xdr_argument = (xdrproc_t) xdr_Device_DocmdParms;
+ _xdr_result = (xdrproc_t) xdr_Device_DocmdResp;
+ local = (char *(*)(char *, struct svc_req *)) device_docmd_1_svc;
+ break;
- case create_intr_chan:
- _xdr_argument = (xdrproc_t) xdr_Device_RemoteFunc;
- _xdr_result = (xdrproc_t) xdr_Device_Error;
- local = (char *(*)(char *, struct svc_req *)) create_intr_chan_1_svc;
- break;
+ case destroy_link:
+ _xdr_argument = (xdrproc_t) xdr_Device_Link;
+ _xdr_result = (xdrproc_t) xdr_Device_Error;
+ local = (char *(*)(char *, struct svc_req *)) destroy_link_1_svc;
+ break;
- case destroy_intr_chan:
- _xdr_argument = (xdrproc_t) xdr_void;
- _xdr_result = (xdrproc_t) xdr_Device_Error;
- local = (char *(*)(char *, struct svc_req *)) destroy_intr_chan_1_svc;
- break;
+ case create_intr_chan:
+ _xdr_argument = (xdrproc_t) xdr_Device_RemoteFunc;
+ _xdr_result = (xdrproc_t) xdr_Device_Error;
+ local = (char *(*)(char *, struct svc_req *)) create_intr_chan_1_svc;
+ break;
- default:
- svcerr_noproc(transp);
- return;
+ case destroy_intr_chan:
+ _xdr_argument = (xdrproc_t) xdr_void;
+ _xdr_result = (xdrproc_t) xdr_Device_Error;
+ local = (char *(*)(char *, struct svc_req *)) destroy_intr_chan_1_svc;
+ break;
+
+ default:
+ svcerr_noproc(transp);
+ return;
}
memset((char *) &argument, 0, sizeof(argument));
if (!svc_getargs(transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
@@ -192,7 +194,8 @@ static void device_core_1(struct svc_req *rqstp, register SVCXPRT *transp) {
return;
}
-void vxi_main() {
+void vxi_main()
+{
printf("VXI service started\n");
@@ -235,8 +238,9 @@ void vxi_main() {
while (1) {
int max_pollfd = svc_max_pollfd;
- if (max_pollfd == 0 && svc_pollfd == NULL)
+ if (max_pollfd == 0 && svc_pollfd == NULL) {
break;
+ }
if (last_max_pollfd != max_pollfd) {
struct pollfd *new_pollfd = realloc(my_pollfd, sizeof(struct pollfd) * max_pollfd);
@@ -258,18 +262,19 @@ void vxi_main() {
j = poll(my_pollfd, max_pollfd, VXI11_DEFAULT_TIMEOUT);
for (i = 0; i < max_pollfd; i++) {
- if (my_pollfd[i].revents & POLLRDHUP)
+ if (my_pollfd[i].revents & POLLRDHUP) {
vxi11_deadsocketcallback(my_pollfd[i].fd);
+ }
}
switch (j) {
- case -1:
- break;
- case 0:
- continue;
- default:
- svc_getreq_poll(my_pollfd, i);
- continue;
+ case -1:
+ break;
+ case 0:
+ continue;
+ default:
+ svc_getreq_poll(my_pollfd, i);
+ continue;
}
break;
}