Do not use __attribute__((constructor))
[lttv.git] / lttv / lttv / sync / event_processing_lttng_standard.c
index e6457fa4e96a0278b6457834e5639b7b87928e36..55806dfa8922826c814a4c6ed5c6eee2e265e606 100644 (file)
@@ -22,7 +22,6 @@
 #include <config.h>
 #endif
 
-#include <linux/if_ether.h>
 #include <math.h>
 #include <netinet/in.h>
 #include <stdarg.h>
 
 #include "event_processing_lttng_standard.h"
 
+/* IPv4 Ethertype, taken from <linux/if_ether.h>, unlikely to change as it's
+ * defined by IANA: http://www.iana.org/assignments/ethernet-numbers
+ */
+#define ETH_P_IP    0x0800
+
 
 // Functions common to all processing modules
 static void initProcessingLTTVStandard(SyncState* const syncState, ...);
@@ -50,7 +54,6 @@ static void writeProcessingTraceTimeOptionsLTTVStandard(SyncState* const
        syncState, const unsigned int i, const unsigned int j);
 
 // Functions specific to this module
-static void registerProcessingLTTVStandard() __attribute__((constructor (102)));
 static gboolean processEventLTTVStandard(void* hookData, void* callData);
 static void partialDestroyProcessingLTTVStandard(SyncState* const syncState);
 
@@ -72,7 +75,7 @@ static ProcessingModule processingModuleLTTVStandard = {
 /*
  * Processing Module registering function
  */
-static void registerProcessingLTTVStandard()
+void registerProcessingLTTVStandard()
 {
        g_queue_push_tail(&processingModules, &processingModuleLTTVStandard);
 
@@ -113,7 +116,8 @@ static void initProcessingLTTVStandard(SyncState* const syncState, ...)
        for(i= 0; i < syncState->traceNb; i++)
        {
                g_hash_table_insert(processingData->traceNumTable,
-                       processingData->traceSetContext->traces[i]->t, (gpointer) i);
+                       processingData->traceSetContext->traces[i]->t,
+                       GUINT_TO_POINTER(i));
        }
 
        processingData->pendingRecv= malloc(sizeof(GHashTable*) *
@@ -384,6 +388,7 @@ static gboolean processEventLTTVStandard(void* hookData, void* callData)
        struct marker_info* info;
        SyncState* syncState;
        ProcessingDataLTTVStandard* processingData;
+       gpointer traceNumP;
 
        traceHook= (LttvTraceHook*) hookData;
        tfc= (LttvTracefileContext*) callData;
@@ -398,7 +403,8 @@ static gboolean processEventLTTVStandard(void* hookData, void* callData)
        wTime.nanosec= time.tv_nsec;
 
        g_assert(g_hash_table_lookup_extended(processingData->traceNumTable,
-                       trace, NULL, (gpointer*) &traceNum));
+                       trace, NULL, &traceNumP));
+       traceNum= GPOINTER_TO_INT(traceNumP);
 
        g_debug("Process event: time: %ld.%09ld trace: %ld (%p) name: %s ",
                time.tv_sec, time.tv_nsec, traceNum, trace,
@@ -700,14 +706,6 @@ static void writeProcessingGraphVariablesLTTVStandard(SyncState* const
 static void writeProcessingTraceTraceOptionsLTTVStandard(SyncState* const
        syncState, const unsigned int i, const unsigned int j)
 {
-       ProcessingDataLTTVStandard* processingData;
-       ProcessingGraphsLTTVStandard* traceI, * traceJ;
-
-       processingData= (ProcessingDataLTTVStandard*) syncState->processingData;
-
-       traceI= &processingData->graphs[i];
-       traceJ= &processingData->graphs[j];
-
        fprintf(syncState->graphsStream,
         "set key inside right bottom\n"
         "set xlabel \"Clock %1$u\"\n"
@@ -734,14 +732,6 @@ static void writeProcessingTraceTraceOptionsLTTVStandard(SyncState* const
 static void writeProcessingTraceTimeOptionsLTTVStandard(SyncState* const
        syncState, const unsigned int i, const unsigned int j)
 {
-       ProcessingDataLTTVStandard* processingData;
-       ProcessingGraphsLTTVStandard* traceI, * traceJ;
-
-       processingData= (ProcessingDataLTTVStandard*) syncState->processingData;
-
-       traceI= &processingData->graphs[i];
-       traceJ= &processingData->graphs[j];
-
        fprintf(syncState->graphsStream,
         "set key inside right bottom\n"
         "set xlabel \"Clock %1$u\"\n"
This page took 0.023641 seconds and 4 git commands to generate.