From 4196c441870e4733eb921885fbec6d78a93069c0 Mon Sep 17 00:00:00 2001 From: Steven Dake Date: Sun, 27 Feb 2005 06:27:31 +0000 Subject: [PATCH] em64t support (Logical change 1.141) git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@505 fd59a12c-fef9-0310-b244-a6a79926bd2f --- exec/Makefile | 36 +++++++++++++++++++++++++++--------- exec/totemsrp.c | 3 --- include/evs.h | 2 +- lib/Makefile | 4 ++-- lib/clm.c | 1 - test/ckptstress.c | 24 +++++++++++++++++------- test/evtbench.c | 8 ++++---- test/publish.c | 8 ++++---- test/sa_error.c | 4 ++-- test/subscription.c | 10 +++++----- test/testamf.c | 1 - test/testckpt.c | 4 ++-- test/testclm.c | 2 +- test/testevt.c | 36 ++++++++++++++++++++++++------------ test/testparse.c | 6 +++--- 15 files changed, 92 insertions(+), 57 deletions(-) diff --git a/exec/Makefile b/exec/Makefile index da09822a..4e80f984 100644 --- a/exec/Makefile +++ b/exec/Makefile @@ -1,4 +1,4 @@ -# Copyright (c) 2002-2004 MontaVista Software, Inc. +# Copyright (c) 2002-2005 MontaVista Software, Inc. # # All rights reserved. # @@ -29,16 +29,16 @@ # THE POSSIBILITY OF SUCH DAMAGE. # Production mode flags -CFLAGS = -O3 -Wall -fomit-frame-pointer -fPIC +CFLAGS = -O3 -Wall -fomit-frame-pointer LDFLAGS = # Debug mode flags -#CFLAGS = -g -Wall -fPIC +#CFLAGS = -g -Wall ##-DDEBUG -#LDFLAGS = -g -fPIC +#LDFLAGS = -g # Profile mode flags -#CFLAGS = -O2 -pg -fPIC +#CFLAGS = -O2 -pg #LDFLAGS = -pg # Code Coverage with lcov flgs @@ -51,14 +51,15 @@ TOTEM_OBJS = aispoll.o totemsrp.o totempg.o tlist.o hdb.o crypto.o EXEC_SRC = main.c clm.c amf.c ckpt.c evt.c evs.c parse.c print.c mempool.c \ util.c EXEC_OBJS = main.o clm.o amf.o ckpt.o evt.o evs.o parse.o print.o mempool.o \ - util.o libtotem.a + util.o +EXEC_LIBS = libtotem.a OBJS = $(TOTEM_OBJS) $(EXEC_OBJS) all:libtotem.a libtotem.so.1.0 aisexec keygen aisexec: $(EXEC_OBJS) - $(CC) $(LDFLAGS) $(EXEC_OBJS) $(LIBS) -o aisexec + $(CC) $(LDFLAGS) $(EXEC_OBJS) $(EXEC_LIBS) -o aisexec libtotem.a: $(TOTEM_OBJS) $(AR) -rc libtotem.a $(TOTEM_OBJS) @@ -78,8 +79,25 @@ clean: depend: makedepend -Y -- $(CFLAGS) $(EXEC_SRC) $(TOTEM_SRC) > /dev/null 2>&1 -%.o: %.c - $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $< +# -fPIC rules required for lib totem +aispoll.o: aispoll.c + $(CC) $(CFLAGS) -fPIC -c -o $@ $(*F).c + +totemsrp.o: totemsrp.c + $(CC) $(CFLAGS) -fPIC -c -o $@ $(*F).c + +totempg.o: totempg.c + $(CC) $(CFLAGS) -fPIC -c -o $@ $(*F).c + +tlist.o: tlist.c + $(CC) $(CFLAGS) -fPIC -c -o $@ $(*F).c + +hdb.o: hdb.c + $(CC) $(CFLAGS) -fPIC -c -o $@ $(*F).c + +crypto.o: crypto.c + $(CC) $(CFLAGS) -fPIC -c -o $@ $(*F).c + # DO NOT DELETE main.o: ../include/ais_types.h ../include/ais_msg.h ../include/ais_types.h diff --git a/exec/totemsrp.c b/exec/totemsrp.c index 241d1749..68745462 100644 --- a/exec/totemsrp.c +++ b/exec/totemsrp.c @@ -2846,9 +2846,6 @@ static void messages_deliver_to_app (int skip, int *start_point, int end_point) sort_queue_item_p = ptr; mcast = sort_queue_item_p->iovec[0].iov_base; - if (mcast == (struct mcast *)0xdeadbeef) { - printf ("seq %d\n", sort_queue_item_p->iovec[0].iov_len); - } assert (mcast != (struct mcast *)0xdeadbeef); /* diff --git a/include/evs.h b/include/evs.h index a203555f..ca794c52 100644 --- a/include/evs.h +++ b/include/evs.h @@ -36,7 +36,7 @@ #include -typedef unsigned long long evs_handle_t; +typedef uint64_t evs_handle_t; typedef enum { EVS_DISPATCH_ONE, diff --git a/lib/Makefile b/lib/Makefile index 73a95abd..981d5378 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -1,4 +1,4 @@ -# Copyright (c) 2002-2004 MontaVista Software, Inc. +# Copyright (c) 2002-2005 MontaVista Software, Inc. # # All rights reserved. # @@ -62,7 +62,7 @@ libais.so.1.0: util.o amf.o clm.o ckpt.o evt.o ln -s libais.so.1.0 libais.so.1 ln -s libais.so.1.0 libais.so -libevs.a: util.o amf.o evs.o +libevs.a: util.o evs.o $(AR) -rc libevs.a util.o evs.o libevs.so.1.0: util.o evs.o diff --git a/lib/clm.c b/lib/clm.c index 9b034e8e..4ce73834 100644 --- a/lib/clm.c +++ b/lib/clm.c @@ -358,7 +358,6 @@ error_unlock: pthread_mutex_unlock (&clmInstance->mutex); error_put: saHandleInstancePut (&clmHandleDatabase, clmHandle); -error_nounlock: return (error); } diff --git a/test/ckptstress.c b/test/ckptstress.c index 74527cc1..54c646da 100644 --- a/test/ckptstress.c +++ b/test/ckptstress.c @@ -46,6 +46,11 @@ #include "saCkpt.h" int ckptinv; + +struct thread_data { + int thread_no; +}; + void printSaNameT (SaNameT *name) { int i; @@ -148,14 +153,14 @@ SaCkptIOVectorElementT WriteVectorElements[] = { void *th_dispatch (void *arg) { - int th = (int)arg; + struct thread_data *td = (struct thread_data *)arg; SaCkptHandleT ckptHandle; SaCkptCheckpointHandleT handle; SaErrorT error; int i; SaUint32T erroroneousVectorIndex = 0; - error = saCkptInitialize (&ckptHandle, &callbacks, &version); + error = saCkptInitialize (&ckptHandle, &callbacks, &version); error = saCkptCheckpointOpen (ckptHandle, &checkpointName, @@ -166,11 +171,12 @@ void *th_dispatch (void *arg) for (i = 0; i < 1000; i++) { error = saCkptCheckpointWrite (handle, WriteVectorElements, - 1,/* placing two here with only one vector element causes an assertion failure !! */ + 1, &erroroneousVectorIndex); - printf ("Thread %d: Attempt %d: error %d\n", th, i, error); + printf ("Thread %d: Attempt %d: error %d\n", + td->thread_no, i, error); if (error != SA_OK) { - printf ("Thread %d: Error from write.\n", th); + printf ("Thread %d: Error from write.\n", td->thread_no); } } @@ -186,7 +192,7 @@ int main (void) { int i; pthread_t dispatch_thread; - error = saCkptInitialize (&ckptHandle, &callbacks, &version); + error = saCkptInitialize (&ckptHandle, &callbacks, &version); error = saCkptCheckpointOpen (ckptHandle, &checkpointName, @@ -209,7 +215,11 @@ printf ("create2 error is %d\n", error); printf ("create2 error is %d\n", error); for (i = 0; i < 40; i++) { - pthread_create (&dispatch_thread, NULL, th_dispatch, (void *)i); + struct thread_data *td; + + td = malloc (sizeof (struct thread_data)); + td->thread_no = i; + pthread_create (&dispatch_thread, NULL, th_dispatch, td); } pthread_join (dispatch_thread, NULL); diff --git a/test/evtbench.c b/test/evtbench.c index ed701fa2..e38570f6 100644 --- a/test/evtbench.c +++ b/test/evtbench.c @@ -217,7 +217,7 @@ test_pub() tv_elapsed.tv_usec / 1000000.0)) * 1000000.0)); exit (1); - printf("Published event ID: 0x%llx\n", event_id); + printf("Published event ID: %llx\n", (unsigned long long)event_id); /* * See if we got the event @@ -289,7 +289,7 @@ event_callback( SaEvtSubscriptionIdT subscription_id, printf("event_callback called\n"); printf("sub ID: %x\n", subscription_id); - printf("event_handle %llx\n", event_handle); + printf("event_handle %llx\n", (unsigned long long)event_handle); printf("event data size %d\n", event_data_size); evt_pat_get_array.patternsNumber = 4; @@ -312,9 +312,9 @@ event_callback( SaEvtSubscriptionIdT subscription_id, } printf("priority: 0x%x\n", priority); - printf("retention: 0x%llx\n", retention_time); + printf("retention: %llx\n", (unsigned long long)retention_time); printf("publisher name content: \"%s\"\n", publisher_name.value); - printf("event id: 0x%llx\n", event_id); + printf("event id: %llx\n", (unsigned long long)event_id); evt_free: result = saEvtEventFree(event_handle); printf("event free result: %d\n", result); diff --git a/test/publish.c b/test/publish.c index cdf1219c..ba302170 100644 --- a/test/publish.c +++ b/test/publish.c @@ -205,7 +205,7 @@ test_pub() exit(result); } - printf("Published event ID: 0x%llx\n", event_id); + printf("Published event ID: 0x%llx\n", (unsigned long long)event_id); } /* @@ -287,7 +287,7 @@ event_callback( SaEvtSubscriptionIdT subscription_id, printf("event_callback called\n"); printf("sub ID: %x\n", subscription_id); - printf("event_handle %llx\n", event_handle); + printf("event_handle %llx\n", (unsigned long long)event_handle); printf("event data size %d\n", event_data_size); evt_pat_get_array.patternsNumber = 4; @@ -311,9 +311,9 @@ event_callback( SaEvtSubscriptionIdT subscription_id, } printf("priority: 0x%x\n", priority); - printf("retention: 0x%llx\n", retention_time); + printf("retention: 0x%llx\n", (unsigned long long)retention_time); printf("publisher name content: \"%s\"\n", publisher_name.value); - printf("event id: 0x%llx\n", event_id); + printf("event id: 0x%llx\n", (unsigned long long)event_id); evt_free: result = saEvtEventFree(event_handle); get_sa_error(result, result_buf, result_buf_len); diff --git a/test/sa_error.c b/test/sa_error.c index 3183aa26..72f22c82 100644 --- a/test/sa_error.c +++ b/test/sa_error.c @@ -48,11 +48,11 @@ int get_sa_error(SaErrorT error, char *str, int len) } char *get_sa_error_b (SaAisErrorT error) { - return (sa_error_list[error]); + return ((char *)sa_error_list[error]); } char *get_test_output (SaAisErrorT result, SaAisErrorT expected) { - static *test_result[256]; +static char test_result[256]; if (result == expected) { return ("PASSED"); diff --git a/test/subscription.c b/test/subscription.c index 40b382b7..80a84895 100644 --- a/test/subscription.c +++ b/test/subscription.c @@ -235,7 +235,7 @@ event_callback( SaEvtSubscriptionIdT subscription_id, if (!quiet) dprintf("sub ID: %x\n", subscription_id); if (!quiet) - dprintf("event_handle %llx\n", event_handle); + dprintf("event_handle %llx\n", (unsigned long long)event_handle); if (!quiet) dprintf("event data size %d\n", event_data_size); @@ -266,7 +266,7 @@ event_callback( SaEvtSubscriptionIdT subscription_id, } dprintf("priority: 0x%x\n", priority); - dprintf("retention: 0x%llx\n", retention_time); + dprintf("retention: 0x%llx\n", (unsigned long long)retention_time); dprintf("publisher name content: \"%s\"\n", publisher_name.value); } @@ -282,7 +282,7 @@ event_callback( SaEvtSubscriptionIdT subscription_id, } } if (quiet < 2) { - dprintf("event id: 0x%016llx\n", event_id); + dprintf("event id: 0x%016llx\n", (unsigned long long)event_id); } if (quiet == 2) { if ((++evt_count % EVT_FREQ) == 0) { @@ -305,8 +305,8 @@ event_callback( SaEvtSubscriptionIdT subscription_id, last_event_id[idx]++; if (last_event_id[idx] != event_id) { dprintf("*** expected %016llx got %016llx event_id\n", - last_event_id[idx], - event_id); + (unsigned long long)last_event_id[idx], + (unsigned long long)event_id); last_event_id[idx] = event_id; } break; diff --git a/test/testamf.c b/test/testamf.c index fffc26d2..1cc71e83 100644 --- a/test/testamf.c +++ b/test/testamf.c @@ -253,7 +253,6 @@ int main (int argc, char **argv) { int select_fd; fd_set read_fds; SaNameT compName; - SaNameT proxyCompName; SaNameT csiName; SaNameT compname_get_name; SaAmfReadinessStateT readinessState; diff --git a/test/testckpt.c b/test/testckpt.c index c0af7a12..bc541281 100644 --- a/test/testckpt.c +++ b/test/testckpt.c @@ -391,10 +391,10 @@ printf ("Please wait, testing expiry of checkpoint sections.\n"); if (error == SA_OK) { printf ("Section '%s' expires %llx size %d state %x update %llx\n", sectionDescriptor.sectionId.id, - sectionDescriptor.expirationTime, + (unsigned long long)sectionDescriptor.expirationTime, sectionDescriptor.sectionSize, sectionDescriptor.sectionState, - sectionDescriptor.lastUpdate); + (unsigned long long)sectionDescriptor.lastUpdate); } } while (error == SA_OK); printf ("The last iteration should fail\n"); diff --git a/test/testclm.c b/test/testclm.c index 1ead7386..3cb62c61 100644 --- a/test/testclm.c +++ b/test/testclm.c @@ -77,7 +77,7 @@ void printSaClmClusterNodeT (char *description, SaClmClusterNodeT *clusterNode) printf ("\tMember is %d\n", clusterNode->member); - printf ("\tTimestamp is %llx nanoseconds\n", clusterNode->bootTimestamp); + printf ("\tTimestamp is %llx nanoseconds\n", (unsigned long long)clusterNode->bootTimestamp); } void NodeGetCallback ( diff --git a/test/testevt.c b/test/testevt.c index 71d0599b..0e510733 100644 --- a/test/testevt.c +++ b/test/testevt.c @@ -689,7 +689,7 @@ event_callback(SaEvtSubscriptionIdT my_subscription_id, if (my_event_id != event_id) { printf("ERROR: Call back event ID error: e=%llx, a=%llx\n", - event_id, my_event_id); + (unsigned long long)event_id, (unsigned long long)my_event_id); } if (evt_pat_get_array.patternsNumber != 4) { @@ -726,7 +726,8 @@ event_callback(SaEvtSubscriptionIdT my_subscription_id, } if (retention_time != my_retention_time) { printf("ERROR: retention: e=0x%llx a=0x%llx\n", - retention_time, my_retention_time); + (unsigned long long)retention_time, + (unsigned long long)my_retention_time); } if (publisher_name.length != my_publisher_name.length) { printf("ERROR: publisher name length: e=%d, a=%d\n", @@ -867,13 +868,15 @@ test_event() printf("ERROR: priority not lowest: 0x%x\n", priority); } if (retention_time != 0) { - printf("ERROR: retention time not zero: %0llx\n", retention_time); + printf("ERROR: retention time not zero: %0llx\n", + (unsigned long long)retention_time); } if (publisher_name.length != 0) { printf("ERROR: publisher name not null: %s\n", publisher_name.value); } if (event_id != 0) { - printf("ERROR: event id not zero: 0x%llx\n", event_id); + printf("ERROR: event id not zero: 0x%llx\n", + (unsigned long long)event_id); } @@ -940,7 +943,8 @@ test_event() } if (retention_time != test_ret_time) { printf("ERROR: retention: e=0x%llx a=0x%llx\n", - test_ret_time, retention_time); + (unsigned long long)test_ret_time, + (unsigned long long)retention_time); } if (publisher_name.length != test_pub_name.length) { printf("ERROR: publisher name length: e=%d, a=%d\n", @@ -956,7 +960,8 @@ test_event() } if (event_id != 0) { - printf("ERROR: event id not zero: 0x%llx\n", event_id); + printf("ERROR: event id not zero: 0x%llx\n", + (unsigned long long)event_id); } /* @@ -1190,7 +1195,8 @@ multi_test_callback1(SaEvtSubscriptionIdT my_subscription_id, printf("ERROR: Received event 3 but not subscribed\n"); goto evt_free; } else { - printf("ERROR: Received event %llx but not sent\n", my_event_id); + printf("ERROR: Received event %llx but not sent\n", + (unsigned long long)my_event_id); goto evt_free; } @@ -1764,8 +1770,11 @@ multi_test_callback3(SaEvtSubscriptionIdT my_subscription_id, } if ((my_event_id != event_id1) && (my_event_id != event_id2)) { - printf("ERROR: Received wrong event ID %llx\n", my_event_id); - printf(" id1 %llx, id2 %llx\n", event_id1, event_id2); + printf("ERROR: Received wrong event ID %llx\n", + (unsigned long long)my_event_id); + printf(" id1 %llx, id2 %llx\n", + (unsigned long long)event_id1, + (unsigned long long)event_id2); goto evt_free; } @@ -2193,7 +2202,8 @@ test_retention() } if (retained_id != event_id) { printf("ERROR: received the wrong event: e=%llx, a=%llx\n", - event_id, retained_id); + (unsigned long long)event_id, + (unsigned long long)retained_id); goto evt_free; } @@ -2316,7 +2326,8 @@ test_retention() } if (retained_id != event_id) { printf("ERROR: received the wrong event: e=%llx, a=%llx\n", - event_id, retained_id); + (unsigned long long)event_id, + (unsigned long long)retained_id); goto evt_free; } @@ -2418,7 +2429,8 @@ unlink_chan_callback(SaEvtSubscriptionIdT my_subscription_id, } else if (my_event_id == event_id2) { exp_sub_id = sub2; } else { - printf("ERROR: Received event %llx but not sent\n", my_event_id); + printf("ERROR: Received event %llx but not sent\n", + (unsigned long long)my_event_id); goto evt_free; } diff --git a/test/testparse.c b/test/testparse.c index 990a3942..a6bd86db 100644 --- a/test/testparse.c +++ b/test/testparse.c @@ -39,10 +39,10 @@ int main (void) { - char *error; - int result; - #ifdef CODE_COVERAGE_COMPILE_OUT + int result; + int error; + result = amfReadGroups (&error); if (result == -1) { printf ("Parse Error: %s\n", error);