usinged long -> uint32_t. Sergey.
authorhadaq <hadaq>
Mon, 26 Jul 2010 15:51:02 +0000 (15:51 +0000)
committerhadaq <hadaq>
Mon, 26 Jul 2010 15:51:02 +0000 (15:51 +0000)
ebctrl/ioc/ebctrlApp/src/netmem.c

index 3b126f274322f9fcc8bf5887c425c419c458fbc2..5708309954c56fc216631e48b686a8b236dcb940 100644 (file)
@@ -1,5 +1,6 @@
 #include <stdio.h>
 #include <stdlib.h>
+#include <stdint.h>
 
 #include <dbDefs.h>
 #include <registryFunction.h>
@@ -19,17 +20,18 @@ long netmem_init( struct genSubRecord *pgsub )
 long netmem_proc( struct genSubRecord *pgsub )
 {
 
-  unsigned long *out[8];
+  uint32_t *out[8];
+  unsigned long tmp;
   int i;
 
-  out[0] = (unsigned long *)pgsub->vala;  /* nrOfMsgs */
-  out[1] = (unsigned long *)pgsub->valb;  /* buff = netmem buffer*/
-  out[2] = (unsigned long *)pgsub->valc;  /* pktsRcv = packets received */
-  out[3] = (unsigned long *)pgsub->vald;  /* msgsRcv = messages received */
-  out[4] = (unsigned long *)pgsub->vale;  /* pktsDis = packets discarded */
-  out[5] = (unsigned long *)pgsub->valf;  /* msgsDis = messages discarded */
-  out[6] = (unsigned long *)pgsub->valg;  /* bytercv = bytes received */
-  out[7] = (unsigned long *)pgsub->valh;  /* byteRRate = bytes received rate */
+  out[0] = (uint32_t *)pgsub->vala;  /* nrOfMsgs */
+  out[1] = (uint32_t *)pgsub->valb;  /* buff = netmem buffer*/
+  out[2] = (uint32_t *)pgsub->valc;  /* pktsRcv = packets received */
+  out[3] = (uint32_t *)pgsub->vald;  /* msgsRcv = messages received */
+  out[4] = (uint32_t *)pgsub->vale;  /* pktsDis = packets discarded */
+  out[5] = (uint32_t *)pgsub->valf;  /* msgsDis = messages discarded */
+  out[6] = (uint32_t *)pgsub->valg;  /* bytercv = bytes received */
+  out[7] = (uint32_t *)pgsub->valh;  /* byteRRate = bytes received rate */
 
   for( i=0; i<8; i++ )
     *out[i] = 0;
@@ -37,13 +39,15 @@ long netmem_proc( struct genSubRecord *pgsub )
   char bufmem[_POSIX_PATH_MAX];
   sprintf( bufmem, "%s%s", "daq_netmem", getenv("EBNUM") );
 
-  if( Worker_getStatistic( bufmem, "nrOfMsgs", out[0] ) == -1) {
+  if( Worker_getStatistic( bufmem, "nrOfMsgs", &tmp ) == -1) {
     if(netmemDebug)
       printf("<E> netmem.c: Worker_getStatistic failed for nrOfMsgs!\n");
   }
   else {
+    *out[0] = (uint32_t)tmp;
+
     if(netmemDebug)
-      printf("<D> netmem.c: Worker_getStatistic::nrOfMsgs = %lu\n", (*out[0]));
+      printf("<D> netmem.c: Worker_getStatistic::nrOfMsgs = %lu\n", tmp);
   }
 
   char buf[100];
@@ -52,13 +56,15 @@ long netmem_proc( struct genSubRecord *pgsub )
 
     sprintf( buf, "%s%d", "netmemBuff", i );
 
-    if( Worker_getStatistic( bufmem, buf, out[1] ) == -1) {
+    if( Worker_getStatistic( bufmem, buf, &tmp ) == -1) {
       if(netmemDebug)
         printf("<E> netmem.c: Worker_getStatistic failed for %s!\n", buf);
     }
     else {
+      *out[1] = (uint32_t)tmp;
+
       if(netmemDebug)
-        printf("<D> netmem.c: %s = %lu\n", buf, *out[1]);
+        printf("<D> netmem.c: %s = %lu\n", buf, tmp);
 
       out[1]++;
     }
@@ -68,13 +74,15 @@ long netmem_proc( struct genSubRecord *pgsub )
 
     sprintf( buf, "%s%d", "pktsReceived", i );
 
-    if( Worker_getStatistic( bufmem, buf, out[2] ) == -1) {
+    if( Worker_getStatistic( bufmem, buf, &tmp ) == -1) {
       if(netmemDebug)
         printf("<E> netmem.c: Worker_getStatistic failed for %s!\n", buf);
     }
     else {
+      *out[2] = (uint32_t)tmp;
+
       if(netmemDebug)
-        printf("<D> netmem.c: %s = %lu\n", buf, *out[2]);
+        printf("<D> netmem.c: %s = %lu\n", buf, tmp);
 
       out[2]++;
     }
@@ -84,13 +92,15 @@ long netmem_proc( struct genSubRecord *pgsub )
 
     sprintf( buf, "%s%d", "msgsReceived", i );
 
-    if( Worker_getStatistic( bufmem, buf, out[3] ) == -1) {
+    if( Worker_getStatistic( bufmem, buf, &tmp ) == -1) {
       if(netmemDebug)
         printf("<E> netmem.c: Worker_getStatistic failed for %s!\n", buf);
     }
     else {
+      *out[3] = (uint32_t)tmp;
+
       if(netmemDebug)
-        printf("<D> netmem.c: %s = %lu\n", buf, *out[3]);
+        printf("<D> netmem.c: %s = %lu\n", buf, tmp);
 
       out[3]++;
     }
@@ -100,13 +110,15 @@ long netmem_proc( struct genSubRecord *pgsub )
 
     sprintf( buf, "%s%d", "pktsDiscarded", i );
 
-    if( Worker_getStatistic( bufmem, buf, out[4] ) == -1) {
+    if( Worker_getStatistic( bufmem, buf, &tmp ) == -1) {
       if(netmemDebug)
         printf("<E> netmem.c: Worker_getStatistic failed for %s!\n", buf);
     }
     else {
+      *out[4] = (uint32_t)tmp;
+
       if(netmemDebug)
-        printf("<D> netmem.c: %s = %lu\n", buf, *out[4]);
+        printf("<D> netmem.c: %s = %lu\n", buf, tmp);
 
       out[4]++;
     }
@@ -116,13 +128,15 @@ long netmem_proc( struct genSubRecord *pgsub )
 
     sprintf( buf, "%s%d", "msgsDiscarded", i );
 
-    if( Worker_getStatistic( bufmem, buf, out[5] ) == -1) {
+    if( Worker_getStatistic( bufmem, buf, &tmp ) == -1) {
       if(netmemDebug)
         printf("<E> netmem.c: Worker_getStatistic failed for %s!\n", buf);
     }
     else {
+      *out[5] = (uint32_t)tmp;
+
       if(netmemDebug)
-        printf("<D> netmem.c: %s = %lu\n", buf, *out[5]);
+        printf("<D> netmem.c: %s = %lu\n", buf, tmp);
 
       out[5]++;
     }
@@ -132,13 +146,15 @@ long netmem_proc( struct genSubRecord *pgsub )
 
     sprintf( buf, "%s%d", "bytesReceived", i );
 
-    if( Worker_getStatistic( bufmem, buf, out[6] ) == -1) {
+    if( Worker_getStatistic( bufmem, buf, &tmp ) == -1) {
       if(netmemDebug)
         printf("<E> netmem.c: Worker_getStatistic failed for %s!\n", buf);
     }
     else {
+      *out[6] = (uint32_t)tmp;
+
       if(netmemDebug)
-        printf("<D> netmem.c: %s = %lu\n", buf, *out[6]);
+        printf("<D> netmem.c: %s = %lu\n", buf, tmp);
 
       *out[6] = (int)((*out[6])/1024/1024UL + 0.5); /* convert from Bytes to MB */
       out[6]++;
@@ -149,13 +165,15 @@ long netmem_proc( struct genSubRecord *pgsub )
 
     sprintf( buf, "%s%d", "bytesReceivedRate", i );
 
-    if( Worker_getStatistic( bufmem, buf, out[7] ) == -1) {
+    if( Worker_getStatistic( bufmem, buf, &tmp ) == -1) {
       if(netmemDebug)
         printf("<E> netmem.c: Worker_getStatistic failed for %s!\n", buf);
     }
     else {
+      *out[7] = (uint32_t)tmp;
+
       if(netmemDebug)
-        printf("<D> netmem.c: %s = %lu\n", buf, *out[7]);
+        printf("<D> netmem.c: %s = %lu\n", buf, tmp);
 
       *out[7] = (int)((*out[7])/1024UL + 0.5); /* convert from Bytes to kB */
       out[7]++;