[Openais] latest defect-188 fix

Steven Dake sdake at mvista.com
Fri Feb 18 11:31:15 PST 2005


Folks,

Here is the latest defect-188 patch.  This patch fixes the pthreads out
of order problems we were having when using the dispatch routines.

In this patch, EVT, CLM, CKPT, EVS are tested and working.  AMF has not
been completed yet.  This includes all of Mark Haverkamps EVT changes
required for proper operation.

Please give me feedback if you see any problems with any of these other
services.

Mark
can you have a look at the patch and make sure I'm not missing anything
for EVT?  It was a little difficult to make the patch.

Thanks folks
-steve

-------------- next part --------------
Binary files d188.fixed.orig/exec/aisexec and d188.fixed/exec/aisexec differ
diff -uNr d188.fixed.orig/exec/aispoll.c d188.fixed/exec/aispoll.c
--- d188.fixed.orig/exec/aispoll.c	2005-02-18 12:23:11.000000000 -0700
+++ d188.fixed/exec/aispoll.c	2005-02-16 17:58:09.000000000 -0700
@@ -265,11 +265,23 @@
 
 	if (found) {
 		poll_instance->poll_entries[i].ufd.fd = -1;
-		saHandleInstancePut (&poll_instance_database, handle);
-		return (0);
+		poll_instance->poll_entries[i].ufd.revents = 0;
+	}
+
+	for (i = 0; i < poll_instance->poll_entry_count; i++) {
+		if (poll_instance->ufds[i].fd == fd) {
+			found = 1;
+			break;
+		}
+	}
+
+	if (found) {
+		poll_instance->ufds[i].fd = -1;
+		poll_instance->ufds[i].revents = 0;
 	}
 
 	saHandleInstancePut (&poll_instance_database, handle);
+	return (0);
 
 error_exit:
 	errno = EBADF;
Binary files d188.fixed.orig/exec/aispoll.o and d188.fixed/exec/aispoll.o differ
diff -uNr d188.fixed.orig/exec/amf.c d188.fixed/exec/amf.c
--- d188.fixed.orig/exec/amf.c	2005-02-18 12:23:11.000000000 -0700
+++ d188.fixed/exec/amf.c	2005-02-16 17:58:09.000000000 -0700
@@ -255,6 +255,8 @@
 
 static int amf_exec_init_fn (void);
 
+static int amf_init_two_fn (struct conn_info *conn_info);
+
 static void amf_synchronize (void *message, struct in_addr source_addr);
 
 static int message_handler_req_exec_amf_componentregister (void *message, struct in_addr source_addr, int endian_conversion_required);
@@ -269,10 +271,6 @@
 
 static int message_handler_req_exec_amf_hastateset (void *message, struct in_addr source_addr, int endian_conversion_required);
 
-static int message_handler_req_amf_init (struct conn_info *conn_info, void *message);
-
-static int message_handler_req_lib_activatepoll (struct conn_info *conn_info, void *message);
-
 static int message_handler_req_amf_componentregister (struct conn_info *conn_info, void *message);
 
 static int message_handler_req_amf_componentunregister (struct conn_info *conn_info, void *message);
@@ -295,81 +293,59 @@
 
 static int message_handler_req_amf_componentcapabilitymodelget (struct conn_info *conn_info, void *message);
 
-/*
-int (*amf_libais_handler_fns[]) (struct conn_info *conn_info, void *) = {
-	message_handler_req_lib_activatepoll,
-	message_handler_req_amf_componentregister,
-	message_handler_req_amf_componentunregister,
-	message_handler_req_amf_readinessstateget,
-	message_handler_req_amf_hastateget,
-	message_handler_req_amf_protectiongrouptrackstart,
-	message_handler_req_amf_protectiongrouptrackstop,
-	message_handler_req_amf_errorreport,
-	message_handler_req_amf_errorcancelall,
-	message_handler_req_amf_stoppingcomplete,
-	message_handler_req_amf_response,
-	message_handler_req_amf_componentcapabilitymodelget
-};
-*/
-
 struct libais_handler amf_libais_handlers[] =
 {
 	{ /* 0 */
-		.libais_handler_fn	= message_handler_req_lib_activatepoll,
-		.response_size		= sizeof (struct res_lib_activatepoll),
-		.response_id		= MESSAGE_RES_LIB_ACTIVATEPOLL, // TODO RESPONSE
-	},
-	{ /* 1 */
 		.libais_handler_fn	= message_handler_req_amf_componentregister,
 		.response_size		= sizeof (struct res_lib_amf_componentregister),
 		.response_id		= MESSAGE_RES_AMF_COMPONENTREGISTER,
 	},
-	{ /* 2 */
+	{ /* 1 */
 		.libais_handler_fn	= message_handler_req_amf_componentunregister,
 		.response_size		= sizeof (struct res_lib_amf_componentunregister),
 		.response_id		= MESSAGE_RES_AMF_COMPONENTUNREGISTER,
 	},
-	{ /* 3 */
+	{ /* 2 */
 		.libais_handler_fn	= message_handler_req_amf_readinessstateget,
 		.response_size		= sizeof (struct res_lib_amf_readinessstateget),
 		.response_id		= MESSAGE_RES_AMF_READINESSSTATEGET,
 	},
-	{ /* 4 */
+	{ /* 3 */
 		.libais_handler_fn	= message_handler_req_amf_hastateget,
 		.response_size		= sizeof (struct res_lib_amf_hastateget),
 		.response_id		= MESSAGE_RES_AMF_READINESSSTATEGET,
 	},
-	{ /* 5 */
+	{ /* 4 */
 		.libais_handler_fn	= message_handler_req_amf_protectiongrouptrackstart,
 		.response_size		= sizeof (struct res_lib_amf_protectiongrouptrackstart),
 		.response_id		= MESSAGE_RES_AMF_PROTECTIONGROUPTRACKSTART,
 	},
-	{ /* 6 */
+	{ /* 5 */
 		.libais_handler_fn	= message_handler_req_amf_protectiongrouptrackstop,
 		.response_size		= sizeof (struct res_lib_amf_protectiongrouptrackstop),
 		.response_id		= MESSAGE_RES_AMF_PROTECTIONGROUPTRACKSTOP,
 	},
-	{ /* 7 */
+	{ /* 6 */
 		.libais_handler_fn	= message_handler_req_amf_errorreport,
 		.response_size		= sizeof (struct res_lib_amf_errorreport),
 		.response_id		= MESSAGE_RES_AMF_ERRORREPORT,
 	},
-	{ /* 8 */
+	{ /* 7 */
 		.libais_handler_fn	= message_handler_req_amf_errorcancelall,
 		.response_size		= sizeof (struct res_lib_amf_errorcancelall),
 		.response_id		= MESSAGE_RES_AMF_ERRORCANCELALL,
 	},
-	{ /* 9 */
+	{ /* 8 */
 		.libais_handler_fn	= message_handler_req_amf_stoppingcomplete,
 		.response_size		= sizeof (struct res_lib_amf_stoppingcomplete),
 		.response_id		= MESSAGE_RES_AMF_STOPPINGCOMPLETE, // TODO 
 	},
-	{ /* 10 */
+	{ /* 9 */
 		.libais_handler_fn	= message_handler_req_amf_response,
 		.response_size		= sizeof (struct res_lib_amf_response),
 		.response_id		= MESSAGE_RES_AMF_RESPONSE, // TODO
 	},
-	{ /* 11 */
+	{ /* 10 */
 		.libais_handler_fn	= message_handler_req_amf_componentcapabilitymodelget,
 		.response_size		= sizeof (struct res_lib_amf_componentcapabilitymodelget),
 		.response_id		= MESSAGE_RES_AMF_COMPONENTCAPABILITYMODELGET,
@@ -394,7 +370,7 @@
 	.aisexec_handler_fns		= amf_aisexec_handler_fns,
 	.aisexec_handler_fns_count	= sizeof (amf_aisexec_handler_fns) / sizeof (int (*)),
 	.confchg_fn					= amf_confchg_fn,
-	.libais_init_fn				= message_handler_req_amf_init,
+	.libais_init_two_fn			= amf_init_two_fn,
 	.libais_exit_fn				= amf_exit_fn,
 	.exec_init_fn				= amf_exec_init_fn,
 	.exec_dump_fn				= amf_dump
@@ -647,7 +623,7 @@
 	struct res_lib_amf_csiremovecallback res_lib_amf_csiremovecallback;
 		
 	if (conn_info->active == 0 ||
-		conn_info->service != SOCKET_SERVICE_AMF) {
+		conn_info->service != AMF_SERVICE) {
 
 		return;
 	}
@@ -691,7 +667,7 @@
 	 * this should be an assertion
 	 */
 	if (component->conn_info->state != CONN_STATE_ACTIVE ||
-		component->conn_info->service != SOCKET_SERVICE_AMF) {
+		component->conn_info->service != AMF_SERVICE) {
 		return;
 	}
 
@@ -764,7 +740,7 @@
 	 * this should be an assertion
 	 */
 	if (component->conn_info->state != CONN_STATE_ACTIVE ||
-		component->conn_info->service != SOCKET_SERVICE_AMF) {
+		component->conn_info->service != AMF_SERVICE) {
 
 		return;
 	}
@@ -1939,7 +1915,7 @@
 	/*
 	 * Unregister all components registered to this file descriptor
 	 */
-	if (conn_info->service == SOCKET_SERVICE_AMF) {
+	if (conn_info->service == AMF_SERVICE) {
 
 		component_unregister (conn_info->component);
 
@@ -2342,46 +2318,16 @@
 	return (0);
 }
 
-static int message_handler_req_amf_init (struct conn_info *conn_info, void *message)
+static int amf_init_two_fn (struct conn_info *conn_info)
 {
-	struct res_lib_init res_lib_init;
-	SaErrorT error = SA_ERR_SECURITY;
-
-	log_printf (LOG_LEVEL_DEBUG, "Got AMF request to initalize availability management framework service.\n");
-
-	if (conn_info->authenticated) {
-		conn_info->service = SOCKET_SERVICE_AMF;
-		error = SA_OK;
-	}
-
-	res_lib_init.header.size = sizeof (struct res_lib_init);
-	res_lib_init.header.id = MESSAGE_RES_INIT;
-	res_lib_init.header.error = error;
-
-	libais_send_response (conn_info, &res_lib_init, sizeof (res_lib_init));
+	log_printf (LOG_LEVEL_DEBUG, "Got request to initalize availability management framework service.\n"); 
 
 	list_init (&conn_info->conn_list);
 
-	if (conn_info->authenticated) {
-		return (0);
-	}
-	return (-1);
-}
-
-static int message_handler_req_lib_activatepoll (struct conn_info *conn_info, void *message)
-{
-	struct res_lib_activatepoll res_lib_activatepoll;
-
-	log_printf (LOG_LEVEL_FROM_LIB, "Handle : message_handler_req_lib_activatepoll()\n");
-
-	memset (&res_lib_activatepoll,0,sizeof(res_lib_activatepoll));
-	res_lib_activatepoll.header.size = sizeof (struct res_lib_activatepoll);
-	res_lib_activatepoll.header.id = MESSAGE_RES_LIB_ACTIVATEPOLL;
-	libais_send_response (conn_info, &res_lib_activatepoll, sizeof (struct res_lib_activatepoll));
-
 	return (0);
 }
 
+
 static int message_handler_req_amf_componentregister (struct conn_info *conn_info, void *message)
 {
 	struct req_amf_componentregister *req_lib_amf_componentregister = (struct req_amf_componentregister *)message;
Binary files d188.fixed.orig/exec/amf.o and d188.fixed/exec/amf.o differ
diff -uNr d188.fixed.orig/exec/ckpt.c d188.fixed/exec/ckpt.c
--- d188.fixed.orig/exec/ckpt.c	2005-02-18 12:23:11.000000000 -0700
+++ d188.fixed/exec/ckpt.c	2005-02-17 14:00:40.000000000 -0700
@@ -74,7 +74,7 @@
 
 static int ckpt_exit_fn (struct conn_info *conn_info);
 
-static int message_handler_req_lib_activatepoll (struct conn_info *, void *message);
+static int ckpt_init_two_fn (struct conn_info *conn_info);
 
 static int message_handler_req_exec_ckpt_checkpointopen (void *message, struct in_addr source_addr, int endian_conversion_required);
 
@@ -98,8 +98,6 @@
 
 static int message_handler_req_exec_ckpt_sectionread (void *message, struct in_addr source_addr, int endian_conversion_required);
 
-static int message_handler_req_lib_ckpt_init (struct conn_info *conn_info, void *message);
-
 static int message_handler_req_lib_ckpt_checkpointopen (struct conn_info *conn_info, void *message);
 
 static int message_handler_req_lib_ckpt_checkpointopenasync (struct conn_info *conn_info, void *message);
@@ -155,91 +153,86 @@
 struct libais_handler ckpt_libais_handlers[] =
 {
 	{ /* 0 */
-		.libais_handler_fn	= message_handler_req_lib_activatepoll,
-		.response_size		= sizeof (struct res_lib_activatepoll),
-		.response_id		= MESSAGE_RES_LIB_ACTIVATEPOLL,
-	},
-	{ /* 1 */
 		.libais_handler_fn	= message_handler_req_lib_ckpt_checkpointopen,
 		.response_size		= sizeof (struct res_lib_ckpt_checkpointopen),
 		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTOPEN,
 	},
-	{ /* 2 */
+	{ /* 1 */
 		.libais_handler_fn	= message_handler_req_lib_ckpt_checkpointopenasync,
 		.response_size		= sizeof (struct res_lib_ckpt_checkpointopenasync),
 		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTOPENASYNC,
 	},
-	{ /* 3 */
+	{ /* 2 */
 		.libais_handler_fn	= message_handler_req_lib_ckpt_checkpointclose,
 		.response_size		= sizeof (struct res_lib_ckpt_checkpointclose),
 		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTCLOSE,
 	},
-	{ /* 4 */
+	{ /* 3 */
 		.libais_handler_fn	= message_handler_req_lib_ckpt_checkpointunlink,
 		.response_size		= sizeof (struct res_lib_ckpt_checkpointunlink),
 		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTUNLINK,
 	},
-	{ /* 5 */
+	{ /* 4 */
 		.libais_handler_fn	= message_handler_req_lib_ckpt_checkpointretentiondurationset,
 		.response_size		= sizeof (struct res_lib_ckpt_checkpointretentiondurationset),
 		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTRETENTIONDURATIONSET,
 	},
-	{ /* 6 */
+	{ /* 5 */
 		.libais_handler_fn	= message_handler_req_lib_ckpt_activereplicaset,
 		.response_size		= sizeof (struct res_lib_ckpt_activereplicaset),
 		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_ACTIVEREPLICASET,
 	},
-	{ /* 7 */
+	{ /* 6 */
 		.libais_handler_fn	= message_handler_req_lib_ckpt_checkpointstatusget,
 		.response_size		= sizeof (struct res_lib_ckpt_checkpointstatusget),
 		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTSTATUSGET,
 	},
-	{ /* 8 */
+	{ /* 7 */
 		.libais_handler_fn	= message_handler_req_lib_ckpt_sectioncreate,
 		.response_size		= sizeof (struct res_lib_ckpt_sectioncreate),
 		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_SECTIONCREATE,
 	},
-	{ /* 9 */
+	{ /* 8 */
 		.libais_handler_fn	= message_handler_req_lib_ckpt_sectiondelete,
 		.response_size		= sizeof (struct res_lib_ckpt_sectiondelete),
 		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_SECTIONDELETE,
 	},
-	{ /* 10 */
+	{ /* 9 */
 		.libais_handler_fn	= message_handler_req_lib_ckpt_sectionexpirationtimeset,
 		.response_size		= sizeof (struct res_lib_ckpt_sectionexpirationtimeset),
 		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_SECTIONEXPIRATIONTIMESET,
 	},
-	{ /* 11 */
+	{ /* 10 */
 		.libais_handler_fn	= message_handler_req_lib_ckpt_sectionwrite,
 		.response_size		= sizeof (struct res_lib_ckpt_sectionwrite),
 		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_SECTIONWRITE,
 	},
-	{ /* 12 */
+	{ /* 11 */
 		.libais_handler_fn	= message_handler_req_lib_ckpt_sectionoverwrite,
 		.response_size		= sizeof (struct res_lib_ckpt_sectionoverwrite),
 		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_SECTIONOVERWRITE,
 	},
-	{ /* 13 */
+	{ /* 12 */
 		.libais_handler_fn	= message_handler_req_lib_ckpt_sectionread,
 		.response_size		= sizeof (struct res_lib_ckpt_sectionread),
 		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_SECTIONREAD,
 	},
-	{ /* 14 */
+	{ /* 13 */
 		.libais_handler_fn	= message_handler_req_lib_ckpt_checkpointsynchronize,
 		.response_size		= sizeof (struct res_lib_ckpt_checkpointsynchronize),
 		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTSYNCHRONIZE,
 	},
-	{ /* 15 */
+	{ /* 14 */
 		.libais_handler_fn	= message_handler_req_lib_ckpt_checkpointsynchronizeasync,
 		.response_size		= sizeof (struct res_lib_ckpt_checkpointsynchronizeasync), // TODO RESPONSE
 		.response_id		= MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTSYNCHRONIZEASYNC,
 	},
-	{ /* 16 */
+	{ /* 15 */
 		.libais_handler_fn	= message_handler_req_lib_ckpt_sectioniteratorinitialize,
 		.response_size		= sizeof (struct res_lib_ckpt_sectioniteratorinitialize),
 		.response_id		= MESSAGE_RES_CKPT_SECTIONITERATOR_SECTIONITERATORINITIALIZE,
 	},
-	{ /* 17 */
+	{ /* 16 */
 		.libais_handler_fn	= message_handler_req_lib_ckpt_sectioniteratornext,
 		.response_size		= sizeof (struct res_lib_ckpt_sectioniteratornext),
 		.response_id		= MESSAGE_RES_CKPT_SECTIONITERATOR_SECTIONITERATORNEXT,
@@ -267,7 +260,7 @@
 	.aisexec_handler_fns		= ckpt_aisexec_handler_fns,
 	.aisexec_handler_fns_count	= sizeof (ckpt_aisexec_handler_fns) / sizeof (int (*)),
 	.confchg_fn					= ckpt_confchg_fn,
-	.libais_init_fn				= message_handler_req_lib_ckpt_init,
+	.libais_init_two_fn			= ckpt_init_two_fn,
 	.libais_exit_fn				= ckpt_exit_fn,
 	.exec_init_fn				= ckpt_exec_init_fn,
 	.exec_dump_fn				= 0
@@ -424,15 +417,15 @@
 	struct checkpoint_cleanup *checkpoint_cleanup;
 	struct list_head *list;
 	
-	if (conn_info->service != SOCKET_SERVICE_CKPT) {
+	if (conn_info->conn_info_partner->service != CKPT_SERVICE) {
 		return 0;
 	}
 	
 	/*
 	 * close all checkpoints opened on this fd
 	 */
-	for (list = conn_info->ais_ci.u.libckpt_ci.checkpoint_list.next;
-		list != &conn_info->ais_ci.u.libckpt_ci.checkpoint_list;) {
+	for (list = conn_info->conn_info_partner->ais_ci.u.libckpt_ci.checkpoint_list.next;
+		list != &conn_info->conn_info_partner->ais_ci.u.libckpt_ci.checkpoint_list;) {
 
 		checkpoint_cleanup = list_entry (list,
 			struct checkpoint_cleanup, list);
@@ -457,19 +450,6 @@
 	return (0);
 }
 
-static int message_handler_req_lib_activatepoll (struct conn_info *conn_info, void *message)
-{
-	struct res_lib_activatepoll res_lib_activatepoll;
-
-	res_lib_activatepoll.header.size = sizeof (struct res_lib_activatepoll);
-	res_lib_activatepoll.header.id = MESSAGE_RES_LIB_ACTIVATEPOLL;
-	res_lib_activatepoll.header.error = SA_AIS_OK;
-	libais_send_response (conn_info, &res_lib_activatepoll,
-		sizeof (struct res_lib_activatepoll));
-
-	return (0);
-}
-
 static int message_handler_req_exec_ckpt_checkpointopen (void *message, struct in_addr source_addr, int endian_conversion_required)
 {
 	struct req_exec_ckpt_checkpointopen *req_exec_ckpt_checkpointopen = (struct req_exec_ckpt_checkpointopen *)message;
@@ -1244,35 +1224,17 @@
 	return (0);
 }
 
-static int message_handler_req_lib_ckpt_init (struct conn_info *conn_info, void *message)
+static int ckpt_init_two_fn (struct conn_info *conn_info)
 {
-	struct res_lib_init res_lib_init;
-	SaErrorT error = SA_AIS_ERR_ACCESS;
-
-	log_printf (LOG_LEVEL_DEBUG, "Got request to initialize CKPT checkpoint.\n");
-
-	if (conn_info->authenticated) {
-    	conn_info->service = SOCKET_SERVICE_CKPT;
-		list_init (&conn_info->ais_ci.u.libckpt_ci.sectionIterator.list);
-		conn_info->ais_ci.u.libckpt_ci.sectionIterator.sectionIteratorEntries = 0;
-		conn_info->ais_ci.u.libckpt_ci.sectionIterator.iteratorCount = 0;
-		conn_info->ais_ci.u.libckpt_ci.sectionIterator.iteratorPos = 0;
-		list_add (&conn_info->ais_ci.u.libckpt_ci.sectionIterator.list,
-			&checkpointIteratorListHead);
-		list_init (&conn_info->ais_ci.u.libckpt_ci.checkpoint_list);
-		error = SA_AIS_OK;
-	}
+	list_init (&conn_info->conn_info_partner->ais_ci.u.libckpt_ci.sectionIterator.list);
+	conn_info->conn_info_partner->ais_ci.u.libckpt_ci.sectionIterator.sectionIteratorEntries = 0;
+	conn_info->conn_info_partner->ais_ci.u.libckpt_ci.sectionIterator.iteratorCount = 0;
+	conn_info->conn_info_partner->ais_ci.u.libckpt_ci.sectionIterator.iteratorPos = 0;
+	list_add (&conn_info->conn_info_partner->ais_ci.u.libckpt_ci.sectionIterator.list,
+		&checkpointIteratorListHead);
+	list_init (&conn_info->conn_info_partner->ais_ci.u.libckpt_ci.checkpoint_list);
 
-	res_lib_init.header.size = sizeof (struct res_lib_init);
-	res_lib_init.header.id = MESSAGE_RES_INIT;
-	res_lib_init.header.error = error;
-
-	libais_send_response (conn_info, &res_lib_init, sizeof (res_lib_init));
-
-	if (conn_info->authenticated) {
-		return (0);
-	}
-	return (-1);
+	return (0);
 }
 
 static int message_handler_req_lib_ckpt_checkpointopen (struct conn_info *conn_info, void *message)
Binary files d188.fixed.orig/exec/ckpt.o and d188.fixed/exec/ckpt.o differ
diff -uNr d188.fixed.orig/exec/clm.c d188.fixed/exec/clm.c
--- d188.fixed.orig/exec/clm.c	2005-02-18 12:23:11.000000000 -0700
+++ d188.fixed/exec/clm.c	2005-02-16 17:58:09.000000000 -0700
@@ -1,4 +1,6 @@
 /*
+ * vi: set autoindent tabstop=4 shiftwidth=4 :
+ *
  * Copyright (c) 2002-2005 MontaVista Software, Inc.
  *
  * All rights reserved.
@@ -98,8 +100,6 @@
 /*
  * Service Interfaces required by service_message_handler struct
  */
-static int clm_exec_init_fn (void);
-
 static int clm_confchg_fn (
 	enum totempg_configuration_type configuration_type,
     struct in_addr *member_list, void *member_list_private,
@@ -110,13 +110,16 @@
 		int joined_list_entries,
 	struct memb_ring_id *ring_id);
 
-static int message_handler_req_exec_clm_nodejoin (void *message, struct in_addr source_addr, int endian_conversion_required);
+static int clm_exit_fn (struct conn_info *conn_info);
+
+static int clm_exec_init_fn (void);
 
-static int message_handler_req_clm_init (struct conn_info *conn_info,
-	void *message);
+static int clm_init_two_fn (struct conn_info *conn_info);
 
-static int message_handler_req_lib_activatepoll (struct conn_info *conn_info,
-	void *message);
+static int clm_exit_fn (struct conn_info *conn_info);
+
+static int message_handler_req_exec_clm_nodejoin (void *message, struct in_addr source_addr,
+	int endian_conversion_required);
 
 static int message_handler_req_clm_clustertrack (struct conn_info *conn_info,
 	void *message);
@@ -130,31 +133,24 @@
 static int message_handler_req_clm_nodegetasync (struct conn_info *conn_info,
 	void *message);
 
-static int clm_exit_fn (struct conn_info *conn_info);
-
 struct libais_handler clm_libais_handlers[] =
 {
 	{ /* 0 */
-		.libais_handler_fn			= message_handler_req_lib_activatepoll,
-		.response_size				= sizeof (struct res_lib_activatepoll),
-		.response_id				= MESSAGE_RES_LIB_ACTIVATEPOLL, // TODO RESPONSE
-	},
-	{ /* 1 */
 		.libais_handler_fn			= message_handler_req_clm_clustertrack,
 		.response_size				= sizeof (struct res_clm_clustertrack),
 		.response_id				= MESSAGE_RES_CLM_TRACKSTART, // TODO RESPONSE
 	},
-	{ /* 2 */
+	{ /* 1 */
 		.libais_handler_fn			= message_handler_req_clm_trackstop,
 		.response_size				= sizeof (struct res_clm_trackstop),
 		.response_id				= MESSAGE_RES_CLM_TRACKSTOP, // TODO RESPONSE
 	},
-	{ /* 3 */
+	{ /* 2 */
 		.libais_handler_fn			= message_handler_req_clm_nodeget,
 		.response_size				= sizeof (struct res_clm_nodeget),
 		.response_id				= MESSAGE_RES_CLM_NODEGET, // TODO RESPONSE
 	},
-	{ /* 4 */
+	{ /* 3 */
 		.libais_handler_fn			= message_handler_req_clm_nodegetasync,
 		.response_size				= sizeof (struct res_clm_nodegetasync),
 		.response_id				= MESSAGE_RES_CLM_NODEGETCALLBACK, // TODO RESPONSE
@@ -171,7 +167,7 @@
 	.aisexec_handler_fns		= clm_aisexec_handler_fns,
 	.aisexec_handler_fns_count	= sizeof (clm_aisexec_handler_fns) / sizeof (int (*)),
 	.confchg_fn					= clm_confchg_fn,
-	.libais_init_fn				= message_handler_req_clm_init,
+	.libais_init_two_fn			= clm_init_two_fn,
 	.libais_exit_fn				= clm_exit_fn,
 	.exec_init_fn				= clm_exec_init_fn,
 	.exec_dump_fn				= 0
@@ -302,7 +298,6 @@
     }
 }
 
-
 static void libraryNotificationJoin (SaClmNodeIdT node)
 {
 	SaClmClusterNotificationT clusterNotification;
@@ -447,7 +442,8 @@
 		SA_MAX_NAME_LENGTH);
 }
 
-static int message_handler_req_exec_clm_nodejoin (void *message, struct in_addr source_addr, int endian_conversion_required)
+static int message_handler_req_exec_clm_nodejoin (void *message, struct in_addr source_addr,
+	int endian_conversion_required)
 {
 	struct req_exec_clm_nodejoin *req_exec_clm_nodejoin = (struct req_exec_clm_nodejoin *)message;
 	struct req_exec_clm_nodejoin req_exec_clm_nodejoin_storage;
@@ -490,42 +486,12 @@
 	return (0);
 }
 
-static int message_handler_req_clm_init (struct conn_info *conn_info, void *message)
+static int clm_init_two_fn (struct conn_info *conn_info)
 {
-	SaErrorT error = SA_ERR_SECURITY;
-	struct res_lib_init res_lib_init;
-
 	log_printf (LOG_LEVEL_DEBUG, "Got request to initalize cluster membership service.\n");
-	if (conn_info->authenticated) {
-		conn_info->service = SOCKET_SERVICE_CLM;
-		error = SA_OK;
-	}
-
-	res_lib_init.header.size = sizeof (struct res_lib_init);
-	res_lib_init.header.id = MESSAGE_RES_INIT;
-	res_lib_init.header.error = error;
-
-	libais_send_response (conn_info, &res_lib_init, sizeof (res_lib_init));
 
 	list_init (&conn_info->conn_list);
 
-	if (conn_info->authenticated) {
-		return (0);
-	}
-
-	return (-1);
-}
-
-static int message_handler_req_lib_activatepoll (struct conn_info *conn_info, void *message)
-{
-	struct res_lib_activatepoll res_lib_activatepoll;
-
-	res_lib_activatepoll.header.size = sizeof (struct res_lib_activatepoll);
-	res_lib_activatepoll.header.id = MESSAGE_RES_LIB_ACTIVATEPOLL;
-	res_lib_activatepoll.header.error = SA_OK;
-	libais_send_response (conn_info, &res_lib_activatepoll,
-		sizeof (struct res_lib_activatepoll));
-
 	return (0);
 }
 
@@ -534,11 +500,11 @@
 	struct req_clm_clustertrack *req_clm_clustertrack = (struct req_clm_clustertrack *)message;
 
 
-	conn_info->ais_ci.u.libclm_ci.trackFlags = req_clm_clustertrack->trackFlags;
+	conn_info->conn_info_partner->ais_ci.u.libclm_ci.trackFlags = req_clm_clustertrack->trackFlags;
 
-	list_add (&conn_info->conn_list, &library_notification_send_listhead);
+	list_add (&conn_info->conn_info_partner->conn_list, &library_notification_send_listhead);
 
-	libraryNotificationCurrentState (conn_info);
+	libraryNotificationCurrentState (conn_info->conn_info_partner);
 
 	return (0);
 }
@@ -548,7 +514,7 @@
 {
 	conn_info->ais_ci.u.libclm_ci.trackFlags = 0;
 
-	list_del (&conn_info->conn_list);
+	list_del (&conn_info->conn_info_partner->conn_list);
 
 	return (0);
 }
@@ -581,6 +547,7 @@
 	res_clm_nodeget.header.error = SA_OK;
 	res_clm_nodeget.invocation = req_clm_nodeget->invocation;
 	res_clm_nodeget.valid = valid;
+	printf ("valid is %d\n", res_clm_nodeget.valid);
 	if (valid) {
 		memcpy (&res_clm_nodeget.clusterNode, clusterNode, sizeof (SaClmClusterNodeT));
 	}
Binary files d188.fixed.orig/exec/clm.o and d188.fixed/exec/clm.o differ
Binary files d188.fixed.orig/exec/crypto.o and d188.fixed/exec/crypto.o differ
diff -uNr d188.fixed.orig/exec/evs.c d188.fixed/exec/evs.c
--- d188.fixed.orig/exec/evs.c	2005-02-18 12:23:11.000000000 -0700
+++ d188.fixed/exec/evs.c	2005-02-16 17:58:09.000000000 -0700
@@ -1,4 +1,6 @@
 /*
+ * vi: set autoindent tabstop=4 shiftwidth=4 :
+ *
  * Copyright (c) 2004 MontaVista Software, Inc.
  *
  * All rights reserved.
@@ -79,13 +81,9 @@
 		int joined_list_entries,
 	struct memb_ring_id *ring_id);
 
-static int message_handler_req_exec_mcast (void *message, struct in_addr source_addr, int endian_conversion_required);
-
-static int message_handler_req_evs_init (struct conn_info *conn_info,
-	void *message);
+static int evs_init_two_fn (struct conn_info *conn_info);
 
-static int message_handler_req_lib_activatepoll (struct conn_info *conn_info,
-	void *message);
+static int message_handler_req_exec_mcast (void *message, struct in_addr source_addr, int endian_conversion_required);
 
 static int message_handler_req_evs_join (struct conn_info *conn_info, void *message);
 static int message_handler_req_evs_leave (struct conn_info *conn_info, void *message);
@@ -97,26 +95,21 @@
 struct libais_handler evs_libais_handlers[] =
 {
 	{ /* 0 */
-		.libais_handler_fn			= message_handler_req_lib_activatepoll,
-		.response_size				= sizeof (struct res_lib_activatepoll),
-		.response_id				= MESSAGE_RES_LIB_ACTIVATEPOLL, // TODO RESPONSE
-	},
-	{ /* 1 */
 		.libais_handler_fn			= message_handler_req_evs_join,
 		.response_size				= sizeof (struct res_lib_evs_join),
 		.response_id				= MESSAGE_RES_EVS_JOIN,
 	},
-	{ /* 2 */
+	{ /* 1 */
 		.libais_handler_fn			= message_handler_req_evs_leave,
 		.response_size				= sizeof (struct res_lib_evs_leave),
 		.response_id				= MESSAGE_RES_EVS_LEAVE,
 	},
-	{ /* 3 */
+	{ /* 2 */
 		.libais_handler_fn			= message_handler_req_evs_mcast_joined,
 		.response_size				= sizeof (struct res_lib_evs_mcast_joined),
 		.response_id				= MESSAGE_RES_EVS_MCAST_JOINED,
 	},
-	{ /* 4 */
+	{ /* 3 */
 		.libais_handler_fn			= message_handler_req_evs_mcast_groups,
 		.response_size				= sizeof (struct res_lib_evs_mcast_groups),
 		.response_id				= MESSAGE_RES_EVS_MCAST_GROUPS,
@@ -133,7 +126,7 @@
 	.aisexec_handler_fns		= evs_aisexec_handler_fns,
 	.aisexec_handler_fns_count	= sizeof (evs_aisexec_handler_fns) / sizeof (int (*)),
 	.confchg_fn					= evs_confchg_fn,
-	.libais_init_fn				= message_handler_req_evs_init,
+	.libais_init_two_fn			= evs_init_two_fn,
 	.libais_exit_fn				= evs_exit_fn,
 	.exec_init_fn				= evs_executive_initialize,
 	.exec_dump_fn				= 0
@@ -146,6 +139,7 @@
 
 static int evs_exit_fn (struct conn_info *conn_info)
 {
+
 	list_del (&conn_info->conn_list);
 	return (0);
 }
@@ -198,43 +192,12 @@
 	return (0);
 }
 
-static int message_handler_req_evs_init (struct conn_info *conn_info, void *message)
+static int evs_init_two_fn (struct conn_info *conn_info)
 {
-	SaErrorT error = SA_ERR_SECURITY;
-	struct res_lib_init res_lib_init;
-
 	log_printf (LOG_LEVEL_DEBUG, "Got request to initalize evs service.\n");
-	if (conn_info->authenticated) {
-		conn_info->service = SOCKET_SERVICE_EVS;
-		error = SA_OK;
-	}
-
-	res_lib_init.header.size = sizeof (struct res_lib_init);
-	res_lib_init.header.id = MESSAGE_RES_INIT;
-	res_lib_init.header.error = error;
-
-	libais_send_response (conn_info, &res_lib_init, sizeof (res_lib_init));
-
-
+	list_init (&conn_info->conn_list);
 	list_add (&conn_info->conn_list, &confchg_notify);
 
-	if (conn_info->authenticated) {
-		return (0);
-	}
-
-	return (-1);
-}
-
-static int message_handler_req_lib_activatepoll (struct conn_info *conn_info, void *message)
-{
-	struct res_lib_activatepoll res_lib_activatepoll;
-
-	res_lib_activatepoll.header.size = sizeof (struct res_lib_activatepoll);
-	res_lib_activatepoll.header.id = MESSAGE_RES_LIB_ACTIVATEPOLL;
-	res_lib_activatepoll.header.error = SA_OK;
-	libais_send_response (conn_info, &res_lib_activatepoll,
-		sizeof (struct res_lib_activatepoll));
-
 	return (0);
 }
 
@@ -257,20 +220,21 @@
 	}
 }
 #endif
-	addr = realloc (conn_info->ais_ci.u.libevs_ci.groups,
+	addr = realloc (conn_info->conn_info_partner->ais_ci.u.libevs_ci.groups,
 		sizeof (struct evs_group) * 
-		(conn_info->ais_ci.u.libevs_ci.group_entries + req_lib_evs_join->group_entries));
+		(conn_info->conn_info_partner->ais_ci.u.libevs_ci.group_entries +
+		req_lib_evs_join->group_entries));
 	if (addr == 0) {
 		error = SA_ERR_NO_MEMORY;
 		goto exit_error;
 	}
-	conn_info->ais_ci.u.libevs_ci.groups = addr;
+	conn_info->conn_info_partner->ais_ci.u.libevs_ci.groups = addr;
 
-	memcpy (&conn_info->ais_ci.u.libevs_ci.groups[conn_info->ais_ci.u.libevs_ci.group_entries],
+	memcpy (&conn_info->conn_info_partner->ais_ci.u.libevs_ci.groups[conn_info->conn_info_partner->ais_ci.u.libevs_ci.group_entries],
 		req_lib_evs_join->groups,
 		sizeof (struct evs_group) * req_lib_evs_join->group_entries);
 
-	conn_info->ais_ci.u.libevs_ci.group_entries += req_lib_evs_join->group_entries;
+	conn_info->conn_info_partner->ais_ci.u.libevs_ci.group_entries += req_lib_evs_join->group_entries;
 
 exit_error:
 	res_lib_evs_join.header.size = sizeof (struct res_lib_evs_join);
@@ -294,20 +258,20 @@
 
 	for (i = 0; i < req_lib_evs_leave->group_entries; i++) {
 		found = 0;
-		for (j = 0; j < conn_info->ais_ci.u.libevs_ci.group_entries;) {
+		for (j = 0; j < conn_info->conn_info_partner->ais_ci.u.libevs_ci.group_entries;) {
 			if (memcmp (&req_lib_evs_leave->groups[i],
-				&conn_info->ais_ci.u.libevs_ci.groups[j],
+				&conn_info->conn_info_partner->ais_ci.u.libevs_ci.groups[j],
 				sizeof (struct evs_group)) == 0) {
 
 				/*
 				 * Delete entry
 				 */
-				memmove (&conn_info->ais_ci.u.libevs_ci.groups[j],
-					&conn_info->ais_ci.u.libevs_ci.groups[j + 1],
-					(conn_info->ais_ci.u.libevs_ci.group_entries - j - 1) * 
+				memmove (&conn_info->conn_info_partner->ais_ci.u.libevs_ci.groups[j],
+					&conn_info->conn_info_partner->ais_ci.u.libevs_ci.groups[j + 1],
+					(conn_info->conn_info_partner->ais_ci.u.libevs_ci.group_entries - j - 1) * 
 					sizeof (struct evs_group));
 
-				conn_info->ais_ci.u.libevs_ci.group_entries -= 1;
+				conn_info->conn_info_partner->ais_ci.u.libevs_ci.group_entries -= 1;
 
 				found = 1;
 				break;
@@ -323,9 +287,9 @@
 	}
 
 #ifdef DEBUG
-	for (i = 0; i < conn_info->ais_ci.u.libevs_ci.group_entries; i++) {
+	for (i = 0; i < conn_info->conn_info_partner->ais_ci.u.libevs_ci.group_entries; i++) {
 		printf ("Groups Left %s\n", 
-					&conn_info->ais_ci.u.libevs_ci.groups[i].key);
+					&conn_info->conn_info_partner->ais_ci.u.libevs_ci.groups[i].key);
 	}
 #endif
 	res_lib_evs_leave.header.size = sizeof (struct res_lib_evs_leave);
@@ -351,12 +315,12 @@
 	req_exec_evs_mcast.header.size = sizeof (struct req_exec_evs_mcast);
 	req_exec_evs_mcast.header.id = MESSAGE_REQ_EXEC_EVS_MCAST;
 	req_exec_evs_mcast.msg_len = req_lib_evs_mcast_joined->msg_len;
-	req_exec_evs_mcast.group_entries = conn_info->ais_ci.u.libevs_ci.group_entries;
+	req_exec_evs_mcast.group_entries = conn_info->conn_info_partner->ais_ci.u.libevs_ci.group_entries;
 
 	req_exec_evs_mcast_iovec[0].iov_base = &req_exec_evs_mcast;
 	req_exec_evs_mcast_iovec[0].iov_len = sizeof (req_exec_evs_mcast);
-	req_exec_evs_mcast_iovec[1].iov_base = conn_info->ais_ci.u.libevs_ci.groups;
-	req_exec_evs_mcast_iovec[1].iov_len = conn_info->ais_ci.u.libevs_ci.group_entries * sizeof (struct evs_group);
+	req_exec_evs_mcast_iovec[1].iov_base = conn_info->conn_info_partner->ais_ci.u.libevs_ci.groups;
+	req_exec_evs_mcast_iovec[1].iov_len = conn_info->conn_info_partner->ais_ci.u.libevs_ci.group_entries * sizeof (struct evs_group);
 	req_exec_evs_mcast_iovec[2].iov_base = &req_lib_evs_mcast_joined->msg;
 	req_exec_evs_mcast_iovec[2].iov_len = req_lib_evs_mcast_joined->msg_len;
 // TODO this doesn't seem to work for some reason	
Binary files d188.fixed.orig/exec/evs.o and d188.fixed/exec/evs.o differ
diff -uNr d188.fixed.orig/exec/evt.c d188.fixed/exec/evt.c
--- d188.fixed.orig/exec/evt.c	2005-02-18 12:23:11.000000000 -0700
+++ d188.fixed/exec/evt.c	2005-02-16 18:02:50.000000000 -0700
@@ -63,8 +63,6 @@
 #define LOG_SERVICE LOG_SERVICE_EVT
 #include "print.h"
 
-static int message_handler_req_lib_activatepoll (struct conn_info *conn_info, 
-		void *message);
 static int lib_evt_open_channel(struct conn_info *conn_info, void *message);
 static int lib_evt_open_channel_async(struct conn_info *conn_info, 
 		void *message);
@@ -90,17 +88,12 @@
 			int joined_list_entries,
 		struct memb_ring_id *ring_id);
 
-static int evt_initialize(struct conn_info *conn_info, void *msg);
+static int evt_initialize(struct conn_info *conn_info);
 static int evt_finalize(struct conn_info *conn_info);
 static int evt_exec_init(void);
 
 static struct libais_handler evt_libais_handlers[] = {
 	{
-	.libais_handler_fn = 	message_handler_req_lib_activatepoll,
-	.response_size = 		sizeof(struct res_lib_activatepoll),
-	.response_id = 			MESSAGE_RES_LIB_ACTIVATEPOLL,
-	},
-	{
 	.libais_handler_fn = 	lib_evt_open_channel,
 	.response_size = 		sizeof(struct res_evt_channel_open),
 	.response_id = 			MESSAGE_RES_EVT_OPEN_CHANNEL,
@@ -170,7 +163,7 @@
 	.aisexec_handler_fns_count	= sizeof(evt_exec_handler_fns) /
 									sizeof(int (*)),
 	.confchg_fn					= evt_conf_change,
-	.libais_init_fn				= evt_initialize,
+	.libais_init_two_fn			= evt_initialize,
 	.libais_exit_fn				= evt_finalize,
 	.exec_init_fn				= evt_exec_init,
 	.exec_dump_fn				= 0
@@ -1361,22 +1354,6 @@
 }
 
 /*
- * Send a message to the app to wake it up if it is polling
- */
-static int message_handler_req_lib_activatepoll(struct conn_info *conn_info, 
-		void *message)
-{
-	struct res_lib_activatepoll res;
-
-	res.header.error = SA_AIS_OK;
-	res.header.size = sizeof (struct res_lib_activatepoll);
-	res.header.id = MESSAGE_RES_LIB_ACTIVATEPOLL;
-	libais_send_response(conn_info, &res, sizeof(res));
-
-	return (0);
-}
-
-/*
  * event id generating code.  We use the node ID for this node for the
  * upper 32 bits of the event ID to make sure that we can generate a cluster
  * wide unique event ID for a given event.
@@ -1754,7 +1731,7 @@
 		res.evd_head.size = sizeof(res);
 		res.evd_head.id = MESSAGE_RES_EVT_AVAILABLE;
 		res.evd_head.error = SA_AIS_OK;
-		libais_send_response(conn_info, &res, sizeof(res));
+		libais_send_response(conn_info->conn_info_partner, &res, sizeof(res));
 	}
 
 }
@@ -2056,34 +2033,42 @@
 /*
  * Handler for saEvtInitialize
  */
-static int evt_initialize(struct conn_info *conn_info, void *msg)
+static int evt_initialize(struct conn_info *conn_info)
 {
-	struct res_lib_init res;
-	struct libevt_ci *libevt_ci = &conn_info->ais_ci.u.libevt_ci;
+	struct libevt_ci *libevt_ci;
+	struct conn_info *resp_conn_info;
 	int i;
 
-	
-	res.header.size = sizeof (struct res_lib_init);
-	res.header.id = MESSAGE_RES_INIT;
-	res.header.error = SA_AIS_OK;
 
 	log_printf(LOG_LEVEL_DEBUG, "saEvtInitialize request.\n");
-	if (!conn_info->authenticated) {
-		log_printf(LOG_LEVEL_ERROR, "event service: Not authenticated\n");
-		res.header.error = SA_AIS_ERR_LIBRARY;
-		libais_send_response(conn_info, &res, sizeof(res));
-		return -1;
-	}
+	list_init (&conn_info->conn_list);
+	resp_conn_info = conn_info->conn_info_partner;
+	list_init (&resp_conn_info->conn_list);
+
+	libevt_ci = &resp_conn_info->ais_ci.u.libevt_ci;
+
+	/*
+	 * Initailze event instance data
+	 */
 
 	memset(libevt_ci, 0, sizeof(*libevt_ci));
+
+	/*
+	 * list of channels open on this instance
+	 */
 	list_init(&libevt_ci->esi_open_chans);
+
+	/*
+	 * pending event lists for each piriority
+	 */
 	for (i = SA_EVT_HIGHEST_PRIORITY; i <= SA_EVT_LOWEST_PRIORITY; i++) {
 		list_init(&libevt_ci->esi_events[i]);
 	}
-	conn_info->service = SOCKET_SERVICE_EVT;
-	list_init (&conn_info->conn_list);
-	list_add_tail(&conn_info->conn_list, &ci_head);
-	libais_send_response (conn_info, &res, sizeof(res));
+
+	/*
+	 * Keep track of all event service connections
+	 */
+	list_add_tail(&resp_conn_info->conn_list, &ci_head);
 
 	return 0;
 }
@@ -2944,7 +2929,7 @@
 static int evt_finalize(struct conn_info *conn_info)
 {
 
-	struct libevt_ci *esip = &conn_info->ais_ci.u.libevt_ci;
+	struct libevt_ci *esip = &conn_info->conn_info_partner->ais_ci.u.libevt_ci;
 	struct event_svr_channel_open	*eco;
 	struct list_head *l, *nxt;
 
@@ -2966,7 +2951,7 @@
 	/*
 	 * Delete track entry if there is one
 	 */
-	list_del (&conn_info->conn_list);
+	list_del (&conn_info->conn_info_partner->conn_list);
 
 	return 0;
 }
@@ -3352,7 +3337,8 @@
 		resa.ica_channel_handle = handle;
 		resa.ica_c_handle = ocp->ocp_c_handle;
 		resa.ica_invocation = ocp->ocp_invocation;
-		libais_send_response (ocp->ocp_conn_info, &resa, sizeof(resa));
+		libais_send_response (ocp->ocp_conn_info->conn_info_partner, 
+				&resa, sizeof(resa));
 	} else {
 		struct res_evt_channel_open res;
 		res.ico_head.size = sizeof(res);
Binary files d188.fixed.orig/exec/evt.o and d188.fixed/exec/evt.o differ
diff -uNr d188.fixed.orig/exec/handlers.h d188.fixed/exec/handlers.h
--- d188.fixed.orig/exec/handlers.h	2005-02-18 12:23:11.000000000 -0700
+++ d188.fixed/exec/handlers.h	2005-02-16 17:58:09.000000000 -0700
@@ -60,6 +60,7 @@
 			int joined_list_entries,
 		struct memb_ring_id *ring_id);
 	int (*libais_init_fn) (struct conn_info *conn_info, void *msg);
+	int (*libais_init_two_fn) (struct conn_info *conn_info);
 	int (*libais_exit_fn) (struct conn_info *conn_info);
 	int (*exec_init_fn) (void);
 	void (*exec_dump_fn) (void);
Binary files d188.fixed.orig/exec/hdb.o and d188.fixed/exec/hdb.o differ
Binary files d188.fixed.orig/exec/keygen and d188.fixed/exec/keygen differ
Binary files d188.fixed.orig/exec/keygen.o and d188.fixed/exec/keygen.o differ
Binary files d188.fixed.orig/exec/libtotem.a and d188.fixed/exec/libtotem.a differ
Binary files d188.fixed.orig/exec/libtotem.so and d188.fixed/exec/libtotem.so differ
Binary files d188.fixed.orig/exec/libtotem.so.1 and d188.fixed/exec/libtotem.so.1 differ
Binary files d188.fixed.orig/exec/libtotem.so.1.0 and d188.fixed/exec/libtotem.so.1.0 differ
diff -uNr d188.fixed.orig/exec/main.c d188.fixed/exec/main.c
--- d188.fixed.orig/exec/main.c	2005-02-18 12:23:11.000000000 -0700
+++ d188.fixed/exec/main.c	2005-02-17 14:07:47.000000000 -0700
@@ -1,4 +1,6 @@
 /*
+ * vi: set autoindent tabstop=4 shiftwidth=4 :
+ *
  * Copyright (c) 2002-2004 MontaVista Software, Inc.
  *
  * All rights reserved.
@@ -94,6 +96,18 @@
 #define AIS_SERVICE_HANDLERS_COUNT 5
 #define AIS_SERVICE_HANDLER_AISEXEC_FUNCTIONS_MAX 40
 
+ /*
+  * IPC Initializers
+  */
+static int dispatch_init_send_response (struct conn_info *conn_info, void *message);
+
+static int response_init_send_response (struct conn_info *conn_info, void *message);
+
+static int (*ais_init_handlers[]) (struct conn_info *conn_info, void *message) = {
+	response_init_send_response,
+	dispatch_init_send_response
+};
+
 static int poll_handler_libais_deliver (poll_handle handle, int fd, int revent, void *data, unsigned int *prio);
 
 enum e_ais_done {
@@ -173,6 +187,7 @@
 static void libais_disconnect_delayed (struct conn_info *conn_info)
 {
 	conn_info->state = CONN_STATE_DISCONNECTING_DELAYED;
+	conn_info->conn_info_partner->state = CONN_STATE_DISCONNECTING_DELAYED;
 }
 
 static int libais_disconnect (struct conn_info *conn_info)
@@ -180,8 +195,17 @@
 	int res = 0;
 	struct outq_item *outq_item;
 
-	if (ais_service_handlers[conn_info->service - 1]->libais_exit_fn) {
-		res = ais_service_handlers[conn_info->service - 1]->libais_exit_fn (conn_info);
+	if (conn_info->should_exit_fn &&
+		ais_service_handlers[conn_info->service]->libais_exit_fn) {
+
+		res = ais_service_handlers[conn_info->service]->libais_exit_fn (conn_info);
+	}
+
+	if (conn_info->conn_info_partner && 
+		conn_info->conn_info_partner->should_exit_fn &&
+		ais_service_handlers[conn_info->conn_info_partner->service]->libais_exit_fn) {
+
+		res = ais_service_handlers[conn_info->conn_info_partner->service]->libais_exit_fn (conn_info->conn_info_partner);
 	}
 
 	/*
@@ -192,6 +216,7 @@
 		conn_info->state = CONN_STATE_DISCONNECTING;
 
 		close (conn_info->fd);
+
 		/*
 		 * Free the outq queued items
 		 */
@@ -206,10 +231,43 @@
 	}
 
 	/*
+	 * Close the library connection and free its
+	 * data if it hasn't already been freed
+	 */
+	if (conn_info->conn_info_partner &&
+		conn_info->conn_info_partner->state != CONN_STATE_DISCONNECTING) {
+
+		conn_info->conn_info_partner->state = CONN_STATE_DISCONNECTING;
+
+		close (conn_info->conn_info_partner->fd);
+
+		/*
+		 * Free the outq queued items
+		 */
+		while (!queue_is_empty (&conn_info->conn_info_partner->outq)) {
+			outq_item = queue_item_get (&conn_info->conn_info_partner->outq);
+			free (outq_item->msg);
+			queue_item_remove (&conn_info->conn_info_partner->outq);
+		}
+
+		queue_free (&conn_info->conn_info_partner->outq);
+		if (conn_info->conn_info_partner->inb) {
+			free (conn_info->conn_info_partner->inb);
+		}
+	}
+
+	/*
 	 * If exit_fn didn't request a retry,
 	 * free the conn_info structure
 	 */
 	if (res != -1) {
+		if (conn_info->conn_info_partner) {
+			poll_dispatch_delete (aisexec_poll_handle,
+				conn_info->conn_info_partner->fd);
+		}
+		poll_dispatch_delete (aisexec_poll_handle, conn_info->fd);
+
+		free (conn_info->conn_info_partner);
 		free (conn_info);
 	}
 
@@ -358,7 +416,6 @@
 		iov_send.iov_len = mlen;
 retry_sendmsg_two:
 		res = sendmsg (conn_info->fd, &msg_send, MSG_DONTWAIT | MSG_NOSIGNAL);
-
 		if (res == -1 && errno == EINTR) {
 			goto retry_sendmsg_two;
 		}
@@ -451,7 +508,65 @@
 	return (0);
 }
 
-struct message_overlay {
+static int dispatch_init_send_response (struct conn_info *conn_info, void *message)
+{
+	SaErrorT error = SA_ERR_ACCESS;
+	struct req_lib_dispatch_init *req_lib_dispatch_init = (struct req_lib_dispatch_init *)message;
+	struct res_lib_dispatch_init res_lib_dispatch_init;
+	struct conn_info *msg_conn_info;
+
+	if (conn_info->authenticated) {
+		conn_info->service = req_lib_dispatch_init->resdis_header.service;
+		error = SA_OK;
+
+		conn_info->conn_info_partner = (struct conn_info *)req_lib_dispatch_init->conn_info;
+
+		msg_conn_info = (struct conn_info *)req_lib_dispatch_init->conn_info;
+		msg_conn_info->conn_info_partner = conn_info;
+	}
+
+	res_lib_dispatch_init.header.size = sizeof (struct res_lib_dispatch_init);
+	res_lib_dispatch_init.header.id = MESSAGE_RES_INIT;
+	res_lib_dispatch_init.header.error = error;
+	
+	libais_send_response (conn_info, &res_lib_dispatch_init,
+		sizeof (res_lib_dispatch_init));
+
+	if (error == SA_ERR_ACCESS) {
+		return (-1);
+	}
+
+	conn_info->should_exit_fn = 1;
+	ais_service_handlers[req_lib_dispatch_init->resdis_header.service]->libais_init_two_fn (conn_info);
+	return (0);
+}
+
+static int response_init_send_response (struct conn_info *conn_info, void *message)
+{
+	SaErrorT error = SA_ERR_ACCESS;
+	struct req_lib_response_init *req_lib_response_init = (struct req_lib_response_init *)message;
+	struct res_lib_response_init res_lib_response_init;
+
+	if (conn_info->authenticated) {
+		conn_info->service = req_lib_response_init->resdis_header.service;
+		error = SA_OK;
+	}
+	res_lib_response_init.header.size = sizeof (struct res_lib_response_init);
+	res_lib_response_init.header.id = MESSAGE_RES_INIT;
+	res_lib_response_init.header.error = error;
+	res_lib_response_init.conn_info = (unsigned long)conn_info;
+
+	libais_send_response (conn_info, &res_lib_response_init,
+		sizeof (res_lib_response_init));
+
+	if (error == SA_ERR_ACCESS) {
+		return (-1);
+	}
+	conn_info->should_exit_fn = 0;
+	return (0);
+}
+
+struct res_overlay {
 	struct res_header header;
 	char buf[4096];
 };
@@ -469,29 +584,39 @@
 	struct ucred *cred;
 	int on = 0;
 	int send_ok = 0;
-	struct message_overlay msg_overlay;
+	struct res_overlay res_overlay;
 
-	msg_recv.msg_iov = &iov_recv;
-	msg_recv.msg_iovlen = 1;
-	msg_recv.msg_name = 0;
-	msg_recv.msg_namelen = 0;
-	msg_recv.msg_flags = 0;
-
-	if (revent & POLLOUT) {
-		cleanup_send_response (conn_info);
-	}
-	if ((revent & POLLIN) == 0) {
-		return (0);
+	if (revent & (POLLERR|POLLHUP)) {
+		res = libais_disconnect (conn_info);
+		return (res);
 	}
 
 	/*
 	 * Handle delayed disconnections
 	 */
-	if (conn_info->state != CONN_STATE_ACTIVE) {
+	if (conn_info->state == CONN_STATE_DISCONNECTING_DELAYED) {
 		res = libais_disconnect (conn_info);
 		return (res);
 	}
 
+	if (conn_info->state == CONN_STATE_DISCONNECTING) {
+		return (0);
+	}
+
+	if (revent & POLLOUT) {
+		cleanup_send_response (conn_info);
+	}
+
+	if ((revent & POLLIN) == 0) {
+		return (0);
+	}
+
+	msg_recv.msg_iov = &iov_recv;
+	msg_recv.msg_iovlen = 1;
+	msg_recv.msg_name = 0;
+	msg_recv.msg_namelen = 0;
+	msg_recv.msg_flags = 0;
+
 	if (conn_info->authenticated) {
 		msg_recv.msg_control = 0;
 		msg_recv.msg_controllen = 0;
@@ -553,17 +678,15 @@
 		 * else handle message using service handlers
 		 */
 		if (service == SOCKET_SERVICE_INIT) {
-			/*
-			 * Initializing service
-			 */
-			res = ais_service_handlers[header->id]->libais_init_fn (conn_info, header);
+			res = ais_init_handlers[header->id] (conn_info, header);
+// TODO error in init_two_fn needs to be handled
 		} else  {
 			/*
 			 * Not an init service, but a standard service
 			 */
-			if (header->id < 0 || header->id > ais_service_handlers[service - 1]->libais_handlers_count) {
+			if (header->id < 0 || header->id > ais_service_handlers[service]->libais_handlers_count) {
 				log_printf (LOG_LEVEL_SECURITY, "Invalid header id is %d min 0 max %d\n",
-				header->id, ais_service_handlers[service - 1]->libais_handlers_count);
+				header->id, ais_service_handlers[service]->libais_handlers_count);
 				res = -1;
 				goto error_disconnect;
 			}
@@ -576,20 +699,20 @@
 			send_ok = totempg_send_ok (1000 + header->size);
 			if (send_ok) {
 		//		*prio = 0;
-				res = ais_service_handlers[service - 1]->libais_handlers[header->id].libais_handler_fn(conn_info, header);
+				res = ais_service_handlers[service]->libais_handlers[header->id].libais_handler_fn(conn_info, header);
 			} else {
 		//		*prio = (*prio) + 1;
 
 				/*
 				 * Overload, tell library to retry
 				 */
-				msg_overlay.header.size = 
-					ais_service_handlers[service - 1]->libais_handlers[header->id].response_size;
-				msg_overlay.header.id = 
-					ais_service_handlers[service - 1]->libais_handlers[header->id].response_id;
-				msg_overlay.header.error = SA_ERR_TRY_AGAIN;
-				libais_send_response (conn_info, &msg_overlay,
-					msg_overlay.header.size);
+				res_overlay.header.size = 
+					ais_service_handlers[service]->libais_handlers[header->id].response_size;
+				res_overlay.header.id = 
+					ais_service_handlers[service]->libais_handlers[header->id].response_id;
+				res_overlay.header.error = SA_ERR_TRY_AGAIN;
+				libais_send_response (conn_info, &res_overlay,
+					res_overlay.header.size);
 			}
 		}
 		conn_info->inb_inuse -= header->size;
diff -uNr d188.fixed.orig/exec/main.h d188.fixed/exec/main.h
--- d188.fixed.orig/exec/main.h	2005-02-18 12:23:11.000000000 -0700
+++ d188.fixed/exec/main.h	2005-02-16 17:58:09.000000000 -0700
@@ -50,16 +50,9 @@
  * Size of the queue (entries) for I/O's to the API over socket IPC.
  */
 
-#define SIZEQUEUE 8192
+#define SIZEQUEUE 256
 
-enum socket_service_type {
-	SOCKET_SERVICE_INIT,
-	SOCKET_SERVICE_EVS,
-	SOCKET_SERVICE_CLM,
-	SOCKET_SERVICE_AMF,
-	SOCKET_SERVICE_CKPT,
-	SOCKET_SERVICE_EVT
-};
+#define SOCKET_SERVICE_INIT 254
 
 struct aisexec_ci {
 	struct sockaddr_in in_addr;	/* address of AF_INET socket, MUST BE FIRST IN STRUCTURE */
@@ -98,7 +91,7 @@
 };
 
 struct conn_info {
-	int fd;				/* File descriptor for this connection */
+	int fd;				/* File descriptor  */
 	enum conn_state state;			/* State of this connection */
 	char *inb;			/* Input buffer for non-blocking reads */
 	int inb_nextheader;	/* Next message header starts here */
@@ -106,11 +99,13 @@
 	int inb_inuse;		/* Bytes currently stored in input buffer */
 	struct queue outq;		/* Circular queue for outgoing requests */
 	int byte_start;			/* Byte to start sending from in head of queue */
-	enum socket_service_type service;/* Type of service so dispatch knows how to route message */
+	enum service_types service;/* Type of service so dispatch knows how to route message */
 	struct saAmfComponent *component;	/* Component for which this connection relates to  TODO shouldn't this be in the ci structure */
 	int authenticated;		/* Is this connection authenticated? */
 	struct list_head conn_list;
 	struct ais_ci ais_ci;	/* libais connection information */
+	struct conn_info *conn_info_partner;	/* partner connection dispatch<->response */
+	int should_exit_fn;			/* Should call the exit function when closing this ipc */
 };
 
 extern struct sockaddr_in this_ip;
Binary files d188.fixed.orig/exec/main.o and d188.fixed/exec/main.o differ
Binary files d188.fixed.orig/exec/mempool.o and d188.fixed/exec/mempool.o differ
Binary files d188.fixed.orig/exec/parse.o and d188.fixed/exec/parse.o differ
diff -uNr d188.fixed.orig/exec/print.c d188.fixed/exec/print.c
--- d188.fixed.orig/exec/print.c	2005-02-18 12:23:11.000000000 -0700
+++ d188.fixed/exec/print.c	2005-02-16 18:43:09.000000000 -0700
@@ -180,6 +180,7 @@
 	if (logmode & LOG_MODE_STDERR) {
 		fprintf (stderr, "%s", log_string);
 	}
+	fflush (stdout);
 
 	va_end(ap);
 }
Binary files d188.fixed.orig/exec/print.o and d188.fixed/exec/print.o differ
diff -uNr d188.fixed.orig/exec/profile d188.fixed/exec/profile
--- d188.fixed.orig/exec/profile	2005-02-18 12:23:11.000000000 -0700
+++ d188.fixed/exec/profile	1969-12-31 17:00:00.000000000 -0700
@@ -1,560 +0,0 @@
-Flat profile:
-
-Each sample counts as 0.01 seconds.
-  %   cumulative   self              self     total           
- time   seconds   seconds    calls  ms/call  ms/call  name    
- 21.95      0.09     0.09   274959     0.00     0.00  message_handler_mcast
- 19.51      0.17     0.08   274977     0.00     0.00  pending_queues_deliver
-  9.76      0.21     0.04     1655     0.02     0.05  user_deliver
-  9.76      0.25     0.04        1    40.00   409.61  poll_run
-  7.32      0.28     0.03   322067     0.00     0.00  timerlist_expire
-  7.32      0.31     0.03     1623     0.02     0.03  deliver_fn
-  4.88      0.33     0.02   322068     0.00     0.00  timerlist_timeout_msec
-  4.88      0.35     0.02   322046     0.00     0.00  recv_handler
-  2.44      0.36     0.01    47021     0.00     0.00  timerlist_add_future
-  2.44      0.37     0.01    46913     0.00     0.00  message_handler_orf_token
-  2.44      0.38     0.01    46913     0.00     0.00  orf_token_mcast
-  2.44      0.39     0.01    46878     0.00     0.00  messages_free
-  2.44      0.40     0.01     1632     0.01     0.01  SaNameTisNameT
-  2.44      0.41     0.01     1527     0.01     0.01  message_handler_req_exec_ckpt_sectionwrite
-  0.00      0.41     0.00    47304     0.00     0.00  poll_timer_delete
-  0.00      0.41     0.00    47021     0.00     0.00  poll_timer_add
-  0.00      0.41     0.00    47021     0.00     0.00  timerlist_add
-  0.00      0.41     0.00    47019     0.00     0.00  timerlist_del
-  0.00      0.41     0.00    46913     0.00     0.00  orf_token_evs
-  0.00      0.41     0.00    46913     0.00     0.00  orf_token_rtr
-  0.00      0.41     0.00    46878     0.00     0.00  sq_items_release
-  0.00      0.41     0.00     1655     0.00     0.00  pend_delv_next_delivery_find
-  0.00      0.41     0.00     1623     0.00     0.00  queue_reinit
-  0.00      0.41     0.00      726     0.00     0.00  internal_log_printf
-  0.00      0.41     0.00      125     0.00     0.00  mempool_free
-  0.00      0.41     0.00      125     0.00     0.00  mempool_strdup
-  0.00      0.41     0.00      125     0.00     0.00  strstr_rs
-  0.00      0.41     0.00       71     0.00     0.00  ckptConfChg
-  0.00      0.41     0.00       71     0.00     0.00  clmConfChg
-  0.00      0.41     0.00       71     0.00     0.00  confchg_fn
-  0.00      0.41     0.00       71     0.00     0.00  libraryNotificationLeave
-  0.00      0.41     0.00       70     0.00     0.00  message_handler_memb_form_token
-  0.00      0.41     0.00       53     0.00     0.00  message_handler_req_exec_clm_nodejoin
-  0.00      0.41     0.00       52     0.00     0.00  message_handler_memb_attempt_join
-  0.00      0.41     0.00       52     0.00     0.00  message_handler_memb_join
-  0.00      0.41     0.00       41     0.00     0.01  message_handler_req_exec_ckpt_checkpointopen
-  0.00      0.41     0.00       36     0.00     0.00  SaNameTisEqual
-  0.00      0.41     0.00       35     0.00     0.00  memb_form_token_conf_desc_build
-  0.00      0.41     0.00       35     0.00     0.00  queues_pend_delv_memb_new
-  0.00      0.41     0.00       35     0.00     0.00  sq_reinit
-  0.00      0.41     0.00       20     0.00     0.00  queue_init
-  0.00      0.41     0.00       19     0.00     0.00  memb_state_commit_enter
-  0.00      0.41     0.00       19     0.00     0.00  memb_state_gather_enter
-  0.00      0.41     0.00       18     0.00     0.02  findComponent
-  0.00      0.41     0.00       18     0.00     0.00  gmi_mcast
-  0.00      0.41     0.00       18     0.00     0.00  gmi_pend_trans_item_store
-  0.00      0.41     0.00       18     0.00     0.00  libraryNotificationJoin
-  0.00      0.41     0.00       18     0.00     0.00  memb_print_commit_set
-  0.00      0.41     0.00       18     0.00     0.00  memb_state_commit_consensus
-  0.00      0.41     0.00       15     0.00     0.00  orf_timer_function_token_timeout
-  0.00      0.41     0.00       12     0.00     0.00  mempool_malloc
-  0.00      0.41     0.00        5     0.00     0.00  memb_timer_function_state_gather
-  0.00      0.41     0.00        2     0.00     0.01  message_handler_req_exec_ckpt_sectioncreate
-  0.00      0.41     0.00        2     0.00     0.00  poll_dispatch_add
-  0.00      0.41     0.00        1     0.00     0.00  aisexec_libais_bind
-  0.00      0.41     0.00        1     0.00     0.00  amfExecutiveInitialize
-  0.00      0.41     0.00        1     0.00     0.39  amfReadGroups
-  0.00      0.41     0.00        1     0.00     0.00  clmExecutiveInitialize
-  0.00      0.41     0.00        1     0.00     0.00  determine_local_if
-  0.00      0.41     0.00        1     0.00     0.00  gmi_init
-  0.00      0.41     0.00        1     0.00     0.00  gmi_join
-  0.00      0.41     0.00        1     0.00     0.00  grow_connections_table
-  0.00      0.41     0.00        1     0.00     0.00  handle_create
-  0.00      0.41     0.00        1     0.00     0.00  memb_conf_id_build
-  0.00      0.41     0.00        1     0.00     0.00  memb_timer_function_state_commit_timeout
-  0.00      0.41     0.00        1     0.00     0.00  mempool_init
-  0.00      0.41     0.00        1     0.00     0.00  mempool_realloc
-  0.00      0.41     0.00        1     0.00     0.00  poll_create
-  0.00      0.41     0.00        1     0.00     0.00  sq_init
-  0.00      0.41     0.00        1     0.00     0.00  this_ip_set
-  0.00      0.41     0.00        1     0.00     0.00  timerlist_init
-
- %         the percentage of the total running time of the
-time       program used by this function.
-
-cumulative a running sum of the number of seconds accounted
- seconds   for by this function and those listed above it.
-
- self      the number of seconds accounted for by this
-seconds    function alone.  This is the major sort for this
-           listing.
-
-calls      the number of times this function was invoked, if
-           this function is profiled, else blank.
- 
- self      the average number of milliseconds spent in this
-ms/call    function per call, if this function is profiled,
-	   else blank.
-
- total     the average number of milliseconds spent in this
-ms/call    function and its descendents per call, if this 
-	   function is profiled, else blank.
-
-name       the name of the function.  This is the minor sort
-           for this listing. The index shows the location of
-	   the function in the gprof listing. If the index is
-	   in parenthesis it shows where it would appear in
-	   the gprof listing if it were to be printed.
-
-		     Call graph (explanation follows)
-
-
-granularity: each sample hit covers 4 byte(s) for 2.44% of 0.41 seconds
-
-index % time    self  children    called     name
-                                                 <spontaneous>
-[1]    100.0    0.00    0.41                 main [1]
-                0.04    0.37       1/1           poll_run [2]
-                0.00    0.00       1/1           amfReadGroups [18]
-                0.00    0.00       1/1           gmi_init [27]
-                0.00    0.00       2/726         internal_log_printf [36]
-                0.00    0.00       1/1           poll_create [69]
-                0.00    0.00       1/1           mempool_init [67]
-                0.00    0.00       1/1           aisexec_libais_bind [58]
-                0.00    0.00       1/1           grow_connections_table [63]
-                0.00    0.00       1/2           poll_dispatch_add [57]
-                0.00    0.00       1/1           gmi_join [62]
-                0.00    0.00       1/1           amfExecutiveInitialize [59]
-                0.00    0.00       1/1           clmExecutiveInitialize [60]
------------------------------------------------
-                0.04    0.37       1/1           main [1]
-[2]     99.9    0.04    0.37       1         poll_run [2]
-                0.02    0.30  322046/322046      recv_handler [3]
-                0.03    0.00  322067/322067      timerlist_expire [9]
-                0.02    0.00  322068/322068      timerlist_timeout_msec [10]
------------------------------------------------
-                0.02    0.30  322046/322046      poll_run [2]
-[3]     78.0    0.02    0.30  322046         recv_handler [3]
-                0.09    0.17  274959/274959      message_handler_mcast [4]
-                0.01    0.03   46913/46913       message_handler_orf_token [8]
-                0.00    0.00      70/70          message_handler_memb_form_token [20]
-                0.00    0.00      52/52          message_handler_memb_join [24]
-                0.00    0.00      52/52          message_handler_memb_attempt_join [26]
------------------------------------------------
-                0.09    0.17  274959/274959      recv_handler [3]
-[4]     63.3    0.09    0.17  274959         message_handler_mcast [4]
-                0.08    0.09  274959/274977      pending_queues_deliver [5]
------------------------------------------------
-                0.00    0.00      18/274977      orf_token_mcast [12]
-                0.08    0.09  274959/274977      message_handler_mcast [4]
-[5]     41.4    0.08    0.09  274977         pending_queues_deliver [5]
-                0.04    0.05    1655/1655        user_deliver [6]
------------------------------------------------
-                0.04    0.05    1655/1655        pending_queues_deliver [5]
-[6]     21.9    0.04    0.05    1655         user_deliver [6]
-                0.03    0.02    1623/1623        deliver_fn [7]
-                0.00    0.00    1655/1655        pend_delv_next_delivery_find [34]
-                0.00    0.00    1623/1623        queue_reinit [35]
------------------------------------------------
-                0.03    0.02    1623/1623        user_deliver [6]
-[7]     12.1    0.03    0.02    1623         deliver_fn [7]
-                0.01    0.01    1527/1527        message_handler_req_exec_ckpt_sectionwrite [11]
-                0.00    0.00      41/41          message_handler_req_exec_ckpt_checkpointopen [19]
-                0.00    0.00       2/2           message_handler_req_exec_ckpt_sectioncreate [21]
-                0.00    0.00      53/53          message_handler_req_exec_clm_nodejoin [44]
------------------------------------------------
-                0.01    0.03   46913/46913       recv_handler [3]
-[8]      9.8    0.01    0.03   46913         message_handler_orf_token [8]
-                0.01    0.00   46913/46913       orf_token_mcast [12]
-                0.01    0.00   46878/46878       messages_free [15]
-                0.00    0.01   46913/47021       poll_timer_add [13]
-                0.00    0.00   46913/46913       orf_token_rtr [32]
-                0.00    0.00   46913/46913       orf_token_evs [31]
-                0.00    0.00   46913/47304       poll_timer_delete [28]
------------------------------------------------
-                0.03    0.00  322067/322067      poll_run [2]
-[9]      7.3    0.03    0.00  322067         timerlist_expire [9]
-                0.00    0.00      15/19          memb_state_gather_enter [23]
-                0.00    0.00       5/5           memb_timer_function_state_gather [25]
-                0.00    0.00      15/15          orf_timer_function_token_timeout [55]
-                0.00    0.00       1/1           memb_timer_function_state_commit_timeout [66]
------------------------------------------------
-                0.02    0.00  322068/322068      poll_run [2]
-[10]     4.9    0.02    0.00  322068         timerlist_timeout_msec [10]
------------------------------------------------
-                0.01    0.01    1527/1527        deliver_fn [7]
-[11]     4.7    0.01    0.01    1527         message_handler_req_exec_ckpt_sectionwrite [11]
-                0.01    0.00    1527/1632        SaNameTisNameT [16]
------------------------------------------------
-                0.01    0.00   46913/46913       message_handler_orf_token [8]
-[12]     2.4    0.01    0.00   46913         orf_token_mcast [12]
-                0.00    0.00      18/274977      pending_queues_deliver [5]
------------------------------------------------
-                0.00    0.00      19/47021       memb_state_commit_enter [22]
-                0.00    0.00      19/47021       memb_state_gather_enter [23]
-                0.00    0.00      70/47021       message_handler_memb_form_token [20]
-                0.00    0.01   46913/47021       message_handler_orf_token [8]
-[13]     2.4    0.00    0.01   47021         poll_timer_add [13]
-                0.01    0.00   47021/47021       timerlist_add_future [14]
------------------------------------------------
-                0.01    0.00   47021/47021       poll_timer_add [13]
-[14]     2.4    0.01    0.00   47021         timerlist_add_future [14]
-                0.00    0.00   47021/47021       timerlist_add [29]
------------------------------------------------
-                0.01    0.00   46878/46878       message_handler_orf_token [8]
-[15]     2.4    0.01    0.00   46878         messages_free [15]
-                0.00    0.00   46878/46878       sq_items_release [33]
------------------------------------------------
-                0.00    0.00       2/1632        message_handler_req_exec_ckpt_sectioncreate [21]
-                0.00    0.00      40/1632        message_handler_req_exec_ckpt_checkpointopen [19]
-                0.00    0.00      63/1632        findComponent [17]
-                0.01    0.00    1527/1632        message_handler_req_exec_ckpt_sectionwrite [11]
-[16]     2.4    0.01    0.00    1632         SaNameTisNameT [16]
------------------------------------------------
-                0.00    0.00      18/18          amfReadGroups [18]
-[17]     0.1    0.00    0.00      18         findComponent [17]
-                0.00    0.00      63/1632        SaNameTisNameT [16]
------------------------------------------------
-                0.00    0.00       1/1           main [1]
-[18]     0.1    0.00    0.00       1         amfReadGroups [18]
-                0.00    0.00      18/18          findComponent [17]
-                0.00    0.00     125/125         strstr_rs [39]
-                0.00    0.00      36/36          SaNameTisEqual [45]
-                0.00    0.00      12/12          mempool_malloc [56]
------------------------------------------------
-                0.00    0.00      41/41          deliver_fn [7]
-[19]     0.1    0.00    0.00      41         message_handler_req_exec_ckpt_checkpointopen [19]
-                0.00    0.00      40/1632        SaNameTisNameT [16]
------------------------------------------------
-                0.00    0.00      70/70          recv_handler [3]
-[20]     0.0    0.00    0.00      70         message_handler_memb_form_token [20]
-                0.00    0.00      70/47021       poll_timer_add [13]
-                0.00    0.00     280/47304       poll_timer_delete [28]
-                0.00    0.00      35/35          memb_form_token_conf_desc_build [46]
------------------------------------------------
-                0.00    0.00       2/2           deliver_fn [7]
-[21]     0.0    0.00    0.00       2         message_handler_req_exec_ckpt_sectioncreate [21]
-                0.00    0.00       2/1632        SaNameTisNameT [16]
------------------------------------------------
-                0.00    0.00       5/19          memb_timer_function_state_gather [25]
-                0.00    0.00      14/19          message_handler_memb_join [24]
-[22]     0.0    0.00    0.00      19         memb_state_commit_enter [22]
-                0.00    0.00      19/47021       poll_timer_add [13]
-                0.00    0.00      19/47304       poll_timer_delete [28]
------------------------------------------------
-                0.00    0.00       1/19          gmi_init [27]
-                0.00    0.00       3/19          message_handler_memb_attempt_join [26]
-                0.00    0.00      15/19          timerlist_expire [9]
-[23]     0.0    0.00    0.00      19         memb_state_gather_enter [23]
-                0.00    0.00      19/47021       poll_timer_add [13]
-                0.00    0.00      38/726         internal_log_printf [36]
-                0.00    0.00      19/47304       poll_timer_delete [28]
------------------------------------------------
-                0.00    0.00      52/52          recv_handler [3]
-[24]     0.0    0.00    0.00      52         message_handler_memb_join [24]
-                0.00    0.00      14/19          memb_state_commit_enter [22]
-                0.00    0.00      18/18          memb_print_commit_set [53]
-                0.00    0.00      18/18          memb_state_commit_consensus [54]
-                0.00    0.00      18/726         internal_log_printf [36]
------------------------------------------------
-                0.00    0.00       5/5           timerlist_expire [9]
-[25]     0.0    0.00    0.00       5         memb_timer_function_state_gather [25]
-                0.00    0.00       5/19          memb_state_commit_enter [22]
------------------------------------------------
-                0.00    0.00      52/52          recv_handler [3]
-[26]     0.0    0.00    0.00      52         message_handler_memb_attempt_join [26]
-                0.00    0.00       3/19          memb_state_gather_enter [23]
-                0.00    0.00      86/726         internal_log_printf [36]
-                0.00    0.00       3/47304       poll_timer_delete [28]
------------------------------------------------
-                0.00    0.00       1/1           main [1]
-[27]     0.0    0.00    0.00       1         gmi_init [27]
-                0.00    0.00       1/19          memb_state_gather_enter [23]
-                0.00    0.00       1/20          queue_init [49]
-                0.00    0.00       1/1           sq_init [70]
-                0.00    0.00       1/1           determine_local_if [61]
-                0.00    0.00       1/1           memb_conf_id_build [65]
-                0.00    0.00       1/2           poll_dispatch_add [57]
------------------------------------------------
-                0.00    0.00       3/47304       message_handler_memb_attempt_join [26]
-                0.00    0.00      19/47304       memb_state_commit_enter [22]
-                0.00    0.00      19/47304       memb_state_gather_enter [23]
-                0.00    0.00      70/47304       orf_token_evs [31]
-                0.00    0.00     280/47304       message_handler_memb_form_token [20]
-                0.00    0.00   46913/47304       message_handler_orf_token [8]
-[28]     0.0    0.00    0.00   47304         poll_timer_delete [28]
-                0.00    0.00   47019/47019       timerlist_del [30]
------------------------------------------------
-                0.00    0.00   47021/47021       timerlist_add_future [14]
-[29]     0.0    0.00    0.00   47021         timerlist_add [29]
------------------------------------------------
-                0.00    0.00   47019/47019       poll_timer_delete [28]
-[30]     0.0    0.00    0.00   47019         timerlist_del [30]
------------------------------------------------
-                0.00    0.00   46913/46913       message_handler_orf_token [8]
-[31]     0.0    0.00    0.00   46913         orf_token_evs [31]
-                0.00    0.00      70/47304       poll_timer_delete [28]
-                0.00    0.00      70/71          confchg_fn [42]
-                0.00    0.00      35/726         internal_log_printf [36]
-                0.00    0.00      35/35          sq_reinit [48]
-                0.00    0.00      35/35          queues_pend_delv_memb_new [47]
------------------------------------------------
-                0.00    0.00   46913/46913       message_handler_orf_token [8]
-[32]     0.0    0.00    0.00   46913         orf_token_rtr [32]
------------------------------------------------
-                0.00    0.00   46878/46878       messages_free [15]
-[33]     0.0    0.00    0.00   46878         sq_items_release [33]
------------------------------------------------
-                0.00    0.00    1655/1655        user_deliver [6]
-[34]     0.0    0.00    0.00    1655         pend_delv_next_delivery_find [34]
------------------------------------------------
-                0.00    0.00    1623/1623        user_deliver [6]
-[35]     0.0    0.00    0.00    1623         queue_reinit [35]
------------------------------------------------
-                0.00    0.00       1/726         sigintr_handler [175]
-                0.00    0.00       1/726         memb_timer_function_state_commit_timeout [66]
-                0.00    0.00       2/726         main [1]
-                0.00    0.00      15/726         orf_timer_function_token_timeout [55]
-                0.00    0.00      18/726         message_handler_memb_join [24]
-                0.00    0.00      35/726         orf_token_evs [31]
-                0.00    0.00      38/726         memb_state_gather_enter [23]
-                0.00    0.00      53/726         message_handler_req_exec_clm_nodejoin [44]
-                0.00    0.00      86/726         message_handler_memb_attempt_join [26]
-                0.00    0.00     477/726         clmConfChg [41]
-[36]     0.0    0.00    0.00     726         internal_log_printf [36]
------------------------------------------------
-                0.00    0.00     125/125         strstr_rs [39]
-[37]     0.0    0.00    0.00     125         mempool_free [37]
------------------------------------------------
-                0.00    0.00     125/125         strstr_rs [39]
-[38]     0.0    0.00    0.00     125         mempool_strdup [38]
------------------------------------------------
-                0.00    0.00     125/125         amfReadGroups [18]
-[39]     0.0    0.00    0.00     125         strstr_rs [39]
-                0.00    0.00     125/125         mempool_strdup [38]
-                0.00    0.00     125/125         mempool_free [37]
------------------------------------------------
-                0.00    0.00      71/71          confchg_fn [42]
-[40]     0.0    0.00    0.00      71         ckptConfChg [40]
------------------------------------------------
-                0.00    0.00      71/71          confchg_fn [42]
-[41]     0.0    0.00    0.00      71         clmConfChg [41]
-                0.00    0.00     477/726         internal_log_printf [36]
-                0.00    0.00      71/71          libraryNotificationLeave [43]
-                0.00    0.00      18/18          gmi_mcast [50]
------------------------------------------------
-                0.00    0.00       1/71          memb_timer_function_state_commit_timeout [66]
-                0.00    0.00      70/71          orf_token_evs [31]
-[42]     0.0    0.00    0.00      71         confchg_fn [42]
-                0.00    0.00      71/71          ckptConfChg [40]
-                0.00    0.00      71/71          clmConfChg [41]
------------------------------------------------
-                0.00    0.00      71/71          clmConfChg [41]
-[43]     0.0    0.00    0.00      71         libraryNotificationLeave [43]
------------------------------------------------
-                0.00    0.00      53/53          deliver_fn [7]
-[44]     0.0    0.00    0.00      53         message_handler_req_exec_clm_nodejoin [44]
-                0.00    0.00      53/726         internal_log_printf [36]
-                0.00    0.00      18/18          libraryNotificationJoin [52]
------------------------------------------------
-                0.00    0.00      36/36          amfReadGroups [18]
-[45]     0.0    0.00    0.00      36         SaNameTisEqual [45]
------------------------------------------------
-                0.00    0.00      35/35          message_handler_memb_form_token [20]
-[46]     0.0    0.00    0.00      35         memb_form_token_conf_desc_build [46]
------------------------------------------------
-                0.00    0.00      35/35          orf_token_evs [31]
-[47]     0.0    0.00    0.00      35         queues_pend_delv_memb_new [47]
-                0.00    0.00      19/20          queue_init [49]
------------------------------------------------
-                0.00    0.00      35/35          orf_token_evs [31]
-[48]     0.0    0.00    0.00      35         sq_reinit [48]
------------------------------------------------
-                0.00    0.00       1/20          gmi_init [27]
-                0.00    0.00      19/20          queues_pend_delv_memb_new [47]
-[49]     0.0    0.00    0.00      20         queue_init [49]
------------------------------------------------
-                0.00    0.00      18/18          clmConfChg [41]
-[50]     0.0    0.00    0.00      18         gmi_mcast [50]
-                0.00    0.00      18/18          gmi_pend_trans_item_store [51]
------------------------------------------------
-                0.00    0.00      18/18          gmi_mcast [50]
-[51]     0.0    0.00    0.00      18         gmi_pend_trans_item_store [51]
------------------------------------------------
-                0.00    0.00      18/18          message_handler_req_exec_clm_nodejoin [44]
-[52]     0.0    0.00    0.00      18         libraryNotificationJoin [52]
------------------------------------------------
-                0.00    0.00      18/18          message_handler_memb_join [24]
-[53]     0.0    0.00    0.00      18         memb_print_commit_set [53]
------------------------------------------------
-                0.00    0.00      18/18          message_handler_memb_join [24]
-[54]     0.0    0.00    0.00      18         memb_state_commit_consensus [54]
------------------------------------------------
-                0.00    0.00      15/15          timerlist_expire [9]
-[55]     0.0    0.00    0.00      15         orf_timer_function_token_timeout [55]
-                0.00    0.00      15/726         internal_log_printf [36]
------------------------------------------------
-                0.00    0.00      12/12          amfReadGroups [18]
-[56]     0.0    0.00    0.00      12         mempool_malloc [56]
------------------------------------------------
-                0.00    0.00       1/2           main [1]
-                0.00    0.00       1/2           gmi_init [27]
-[57]     0.0    0.00    0.00       2         poll_dispatch_add [57]
------------------------------------------------
-                0.00    0.00       1/1           main [1]
-[58]     0.0    0.00    0.00       1         aisexec_libais_bind [58]
------------------------------------------------
-                0.00    0.00       1/1           main [1]
-[59]     0.0    0.00    0.00       1         amfExecutiveInitialize [59]
------------------------------------------------
-                0.00    0.00       1/1           main [1]
-[60]     0.0    0.00    0.00       1         clmExecutiveInitialize [60]
-                0.00    0.00       1/1           this_ip_set [71]
------------------------------------------------
-                0.00    0.00       1/1           gmi_init [27]
-[61]     0.0    0.00    0.00       1         determine_local_if [61]
------------------------------------------------
-                0.00    0.00       1/1           main [1]
-[62]     0.0    0.00    0.00       1         gmi_join [62]
------------------------------------------------
-                0.00    0.00       1/1           main [1]
-[63]     0.0    0.00    0.00       1         grow_connections_table [63]
-                0.00    0.00       1/1           mempool_realloc [68]
------------------------------------------------
-                0.00    0.00       1/1           poll_create [69]
-[64]     0.0    0.00    0.00       1         handle_create [64]
------------------------------------------------
-                0.00    0.00       1/1           gmi_init [27]
-[65]     0.0    0.00    0.00       1         memb_conf_id_build [65]
------------------------------------------------
-                0.00    0.00       1/1           timerlist_expire [9]
-[66]     0.0    0.00    0.00       1         memb_timer_function_state_commit_timeout [66]
-                0.00    0.00       1/726         internal_log_printf [36]
-                0.00    0.00       1/71          confchg_fn [42]
------------------------------------------------
-                0.00    0.00       1/1           main [1]
-[67]     0.0    0.00    0.00       1         mempool_init [67]
------------------------------------------------
-                0.00    0.00       1/1           grow_connections_table [63]
-[68]     0.0    0.00    0.00       1         mempool_realloc [68]
------------------------------------------------
-                0.00    0.00       1/1           main [1]
-[69]     0.0    0.00    0.00       1         poll_create [69]
-                0.00    0.00       1/1           handle_create [64]
-                0.00    0.00       1/1           timerlist_init [72]
------------------------------------------------
-                0.00    0.00       1/1           gmi_init [27]
-[70]     0.0    0.00    0.00       1         sq_init [70]
------------------------------------------------
-                0.00    0.00       1/1           clmExecutiveInitialize [60]
-[71]     0.0    0.00    0.00       1         this_ip_set [71]
------------------------------------------------
-                0.00    0.00       1/1           poll_create [69]
-[72]     0.0    0.00    0.00       1         timerlist_init [72]
------------------------------------------------
-
- This table describes the call tree of the program, and was sorted by
- the total amount of time spent in each function and its children.
-
- Each entry in this table consists of several lines.  The line with the
- index number at the left hand margin lists the current function.
- The lines above it list the functions that called this function,
- and the lines below it list the functions this one called.
- This line lists:
-     index	A unique number given to each element of the table.
-		Index numbers are sorted numerically.
-		The index number is printed next to every function name so
-		it is easier to look up where the function in the table.
-
-     % time	This is the percentage of the `total' time that was spent
-		in this function and its children.  Note that due to
-		different viewpoints, functions excluded by options, etc,
-		these numbers will NOT add up to 100%.
-
-     self	This is the total amount of time spent in this function.
-
-     children	This is the total amount of time propagated into this
-		function by its children.
-
-     called	This is the number of times the function was called.
-		If the function called itself recursively, the number
-		only includes non-recursive calls, and is followed by
-		a `+' and the number of recursive calls.
-
-     name	The name of the current function.  The index number is
-		printed after it.  If the function is a member of a
-		cycle, the cycle number is printed between the
-		function's name and the index number.
-
-
- For the function's parents, the fields have the following meanings:
-
-     self	This is the amount of time that was propagated directly
-		from the function into this parent.
-
-     children	This is the amount of time that was propagated from
-		the function's children into this parent.
-
-     called	This is the number of times this parent called the
-		function `/' the total number of times the function
-		was called.  Recursive calls to the function are not
-		included in the number after the `/'.
-
-     name	This is the name of the parent.  The parent's index
-		number is printed after it.  If the parent is a
-		member of a cycle, the cycle number is printed between
-		the name and the index number.
-
- If the parents of the function cannot be determined, the word
- `<spontaneous>' is printed in the `name' field, and all the other
- fields are blank.
-
- For the function's children, the fields have the following meanings:
-
-     self	This is the amount of time that was propagated directly
-		from the child into the function.
-
-     children	This is the amount of time that was propagated from the
-		child's children to the function.
-
-     called	This is the number of times the function called
-		this child `/' the total number of times the child
-		was called.  Recursive calls by the child are not
-		listed in the number after the `/'.
-
-     name	This is the name of the child.  The child's index
-		number is printed after it.  If the child is a
-		member of a cycle, the cycle number is printed
-		between the name and the index number.
-
- If there are any cycles (circles) in the call graph, there is an
- entry for the cycle-as-a-whole.  This entry shows who called the
- cycle (as parents) and the members of the cycle (as children.)
- The `+' recursive calls entry shows the number of function calls that
- were internal to the cycle, and the calls entry for each member shows,
- for that member, how many times it was called from other members of
- the cycle.
-
-
-Index by function name
-
-  [45] SaNameTisEqual         [54] memb_state_commit_consensus [34] pend_delv_next_delivery_find
-  [16] SaNameTisNameT         [22] memb_state_commit_enter [5] pending_queues_deliver
-  [58] aisexec_libais_bind    [23] memb_state_gather_enter [69] poll_create
-  [59] amfExecutiveInitialize [66] memb_timer_function_state_commit_timeout [57] poll_dispatch_add
-  [18] amfReadGroups          [25] memb_timer_function_state_gather [2] poll_run
-  [40] ckptConfChg            [37] mempool_free           [13] poll_timer_add
-  [41] clmConfChg             [67] mempool_init           [28] poll_timer_delete
-  [60] clmExecutiveInitialize [56] mempool_malloc         [49] queue_init
-  [42] confchg_fn             [68] mempool_realloc        [35] queue_reinit
-   [7] deliver_fn             [38] mempool_strdup         [47] queues_pend_delv_memb_new
-  [61] determine_local_if      [4] message_handler_mcast   [3] recv_handler
-  [17] findComponent          [26] message_handler_memb_attempt_join [70] sq_init
-  [27] gmi_init               [20] message_handler_memb_form_token [33] sq_items_release
-  [62] gmi_join               [24] message_handler_memb_join [48] sq_reinit
-  [50] gmi_mcast               [8] message_handler_orf_token [39] strstr_rs
-  [51] gmi_pend_trans_item_store [19] message_handler_req_exec_ckpt_checkpointopen [71] this_ip_set
-  [63] grow_connections_table [21] message_handler_req_exec_ckpt_sectioncreate [29] timerlist_add
-  [64] handle_create          [11] message_handler_req_exec_ckpt_sectionwrite [14] timerlist_add_future
-  [36] internal_log_printf    [44] message_handler_req_exec_clm_nodejoin [30] timerlist_del
-  [52] libraryNotificationJoin [15] messages_free          [9] timerlist_expire
-  [43] libraryNotificationLeave [55] orf_timer_function_token_timeout [72] timerlist_init
-  [65] memb_conf_id_build     [31] orf_token_evs          [10] timerlist_timeout_msec
-  [46] memb_form_token_conf_desc_build [12] orf_token_mcast [6] user_deliver
-  [53] memb_print_commit_set  [32] orf_token_rtr
Binary files d188.fixed.orig/exec/tlist.o and d188.fixed/exec/tlist.o differ
Binary files d188.fixed.orig/exec/totempg.o and d188.fixed/exec/totempg.o differ
Binary files d188.fixed.orig/exec/totemsrp.o and d188.fixed/exec/totemsrp.o differ
Binary files d188.fixed.orig/exec/util.o and d188.fixed/exec/util.o differ
diff -uNr d188.fixed.orig/include/ais_msg.h d188.fixed/include/ais_msg.h
--- d188.fixed.orig/include/ais_msg.h	2005-02-18 12:23:11.000000000 -0700
+++ d188.fixed/include/ais_msg.h	2005-02-16 17:58:09.000000000 -0700
@@ -52,19 +52,19 @@
 };
 
 enum req_lib_evs_types {
-	MESSAGE_REQ_EVS_JOIN = 1,
-	MESSAGE_REQ_EVS_LEAVE,
-	MESSAGE_REQ_EVS_MCAST_JOINED,
-	MESSAGE_REQ_EVS_MCAST_GROUPS
+	MESSAGE_REQ_EVS_JOIN = 0,
+	MESSAGE_REQ_EVS_LEAVE = 1,
+	MESSAGE_REQ_EVS_MCAST_JOINED = 2,
+	MESSAGE_REQ_EVS_MCAST_GROUPS = 3
 };
 
 enum res_lib_evs_types {
-	MESSAGE_RES_EVS_DELIVER_CALLBACK = 1,
-	MESSAGE_RES_EVS_CONFCHG_CALLBACK,
-	MESSAGE_RES_EVS_JOIN,
-	MESSAGE_RES_EVS_LEAVE,
-	MESSAGE_RES_EVS_MCAST_JOINED,
-	MESSAGE_RES_EVS_MCAST_GROUPS
+	MESSAGE_RES_EVS_DELIVER_CALLBACK = 0,
+	MESSAGE_RES_EVS_CONFCHG_CALLBACK = 1,
+	MESSAGE_RES_EVS_JOIN = 2,
+	MESSAGE_RES_EVS_LEAVE = 3,
+	MESSAGE_RES_EVS_MCAST_JOINED = 4,
+	MESSAGE_RES_EVS_MCAST_GROUPS = 5
 };
 
 enum req_amf_types {
@@ -170,14 +170,50 @@
 	/* data goes here */
 };
 
+struct req_lib_resdis_init {
+	int size;
+	int id;
+	int service;
+};
+
+// TODO REMOVE THIS
+enum req_init_types_a {
+    MESSAGE_REQ_EVS_INIT,
+    MESSAGE_REQ_CLM_INIT,
+    MESSAGE_REQ_AMF_INIT,
+    MESSAGE_REQ_CKPT_INIT,
+    MESSAGE_REQ_CKPT_CHECKPOINT_INIT,
+    MESSAGE_REQ_CKPT_SECTIONITERATOR_INIT,
+    MESSAGE_REQ_EVT_INIT
+};
+
+struct req_lib_response_init {
+	struct req_lib_resdis_init resdis_header;
+};
+
+struct req_lib_dispatch_init {
+	struct req_lib_resdis_init resdis_header;
+	unsigned long conn_info;
+};
+
+	
 struct req_lib_init {
-	struct req_header header;
+	struct res_header header;
 };
 
 struct res_lib_init {
 	struct res_header header;
 };
 
+struct res_lib_response_init {
+	struct res_header header;
+	unsigned long conn_info;
+};
+
+struct res_lib_dispatch_init {
+	struct res_header header;
+};
+
 struct req_lib_amf_componentregister {
 	struct req_header header;
 	SaNameT compName;
@@ -370,7 +406,7 @@
 };
 
 struct res_lib_amf_stoppingcomplete {
-	struct req_header header;
+	struct res_header header;
 };
 
 struct req_amf_componentcapabilitymodelget {
diff -uNr d188.fixed.orig/include/ais_types.h d188.fixed/include/ais_types.h
--- d188.fixed.orig/include/ais_types.h	2005-02-18 12:23:11.000000000 -0700
+++ d188.fixed/include/ais_types.h	2005-02-16 17:58:09.000000000 -0700
@@ -106,8 +106,7 @@
 	SA_ERR_QUEUE_FULL = 25,
 	SA_ERR_QUEUE_NOT_AVAILABLE = 26,
 	SA_ERR_BAD_CHECKPOINT = 27,
-	SA_ERR_BAD_FLAGS = 28,
-	SA_ERR_SECURITY = 29
+	SA_ERR_BAD_FLAGS = 28
 } SaErrorT;
 
 typedef enum {
diff -uNr d188.fixed.orig/include/ipc_ckpt.h d188.fixed/include/ipc_ckpt.h
--- d188.fixed.orig/include/ipc_ckpt.h	2005-02-18 12:23:11.000000000 -0700
+++ d188.fixed/include/ipc_ckpt.h	2005-02-16 18:41:05.000000000 -0700
@@ -39,43 +39,43 @@
 #include "../include/saCkpt.h"
 
 enum req_lib_ckpt_checkpoint_types {
-	MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTOPEN = 1,
-	MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTOPENASYNC,
-	MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTCLOSE,
-	MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTUNLINK,
-	MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTRETENTIONDURATIONSET,
-	MESSAGE_REQ_CKPT_CHECKPOINT_ACTIVEREPLICASET,
-	MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTSTATUSGET,
-	MESSAGE_REQ_CKPT_CHECKPOINT_SECTIONCREATE,
-	MESSAGE_REQ_CKPT_CHECKPOINT_SECTIONDELETE,
-	MESSAGE_REQ_CKPT_CHECKPOINT_SECTIONEXPIRATIONTIMESET,
-	MESSAGE_REQ_CKPT_CHECKPOINT_SECTIONWRITE,
-	MESSAGE_REQ_CKPT_CHECKPOINT_SECTIONOVERWRITE,
-	MESSAGE_REQ_CKPT_CHECKPOINT_SECTIONREAD,
-	MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTSYNCHRONIZE,
-	MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTSYNCHRONIZEASYNC,
-	MESSAGE_REQ_CKPT_SECTIONITERATOR_SECTIONITERATORINITIALIZE,
-	MESSAGE_REQ_CKPT_SECTIONITERATOR_SECTIONITERATORNEXT
+	MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTOPEN = 0,
+	MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTOPENASYNC = 1,
+	MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTCLOSE = 2,
+	MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTUNLINK = 3,
+	MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTRETENTIONDURATIONSET = 4,
+	MESSAGE_REQ_CKPT_CHECKPOINT_ACTIVEREPLICASET = 5,
+	MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTSTATUSGET = 6,
+	MESSAGE_REQ_CKPT_CHECKPOINT_SECTIONCREATE = 7,
+	MESSAGE_REQ_CKPT_CHECKPOINT_SECTIONDELETE = 8,
+	MESSAGE_REQ_CKPT_CHECKPOINT_SECTIONEXPIRATIONTIMESET = 9,
+	MESSAGE_REQ_CKPT_CHECKPOINT_SECTIONWRITE = 10,
+	MESSAGE_REQ_CKPT_CHECKPOINT_SECTIONOVERWRITE = 11,
+	MESSAGE_REQ_CKPT_CHECKPOINT_SECTIONREAD = 12,
+	MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTSYNCHRONIZE = 13,
+	MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTSYNCHRONIZEASYNC = 14,
+	MESSAGE_REQ_CKPT_SECTIONITERATOR_SECTIONITERATORINITIALIZE = 15,
+	MESSAGE_REQ_CKPT_SECTIONITERATOR_SECTIONITERATORNEXT = 16
 };
 
 enum res_lib_ckpt_checkpoint_types {
-	MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTOPEN,
-	MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTOPENASYNC,
-	MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTCLOSE,
-	MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTUNLINK,
-	MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTRETENTIONDURATIONSET,
-	MESSAGE_RES_CKPT_CHECKPOINT_ACTIVEREPLICASET,
-	MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTSTATUSGET,
-	MESSAGE_RES_CKPT_CHECKPOINT_SECTIONCREATE,
-	MESSAGE_RES_CKPT_CHECKPOINT_SECTIONDELETE,
-	MESSAGE_RES_CKPT_CHECKPOINT_SECTIONEXPIRATIONTIMESET,
-	MESSAGE_RES_CKPT_CHECKPOINT_SECTIONWRITE,
-	MESSAGE_RES_CKPT_CHECKPOINT_SECTIONOVERWRITE,
-	MESSAGE_RES_CKPT_CHECKPOINT_SECTIONREAD,
-	MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTSYNCHRONIZE,
-	MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTSYNCHRONIZEASYNC,
-	MESSAGE_RES_CKPT_SECTIONITERATOR_SECTIONITERATORINITIALIZE,
-	MESSAGE_RES_CKPT_SECTIONITERATOR_SECTIONITERATORNEXT
+	MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTOPEN = 0,
+	MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTOPENASYNC = 1,
+	MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTCLOSE = 2,
+	MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTUNLINK = 3,
+	MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTRETENTIONDURATIONSET = 4,
+	MESSAGE_RES_CKPT_CHECKPOINT_ACTIVEREPLICASET = 5,
+	MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTSTATUSGET = 6,
+	MESSAGE_RES_CKPT_CHECKPOINT_SECTIONCREATE = 7,
+	MESSAGE_RES_CKPT_CHECKPOINT_SECTIONDELETE = 8,
+	MESSAGE_RES_CKPT_CHECKPOINT_SECTIONEXPIRATIONTIMESET = 9,
+	MESSAGE_RES_CKPT_CHECKPOINT_SECTIONWRITE = 10,
+	MESSAGE_RES_CKPT_CHECKPOINT_SECTIONOVERWRITE = 11,
+	MESSAGE_RES_CKPT_CHECKPOINT_SECTIONREAD = 12,
+	MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTSYNCHRONIZE = 13,
+	MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTSYNCHRONIZEASYNC = 14,
+	MESSAGE_RES_CKPT_SECTIONITERATOR_SECTIONITERATORINITIALIZE = 15,
+	MESSAGE_RES_CKPT_SECTIONITERATOR_SECTIONITERATORNEXT = 16
 };
 
 struct req_exec_ckpt_checkpointclose {
diff -uNr d188.fixed.orig/include/ipc_clm.h d188.fixed/include/ipc_clm.h
--- d188.fixed.orig/include/ipc_clm.h	2005-02-18 12:23:11.000000000 -0700
+++ d188.fixed/include/ipc_clm.h	2005-02-16 17:58:09.000000000 -0700
@@ -40,19 +40,19 @@
 #include "ipc_gen.h"
 
 enum req_clm_types {
-	MESSAGE_REQ_CLM_TRACKSTART = 1,
-	MESSAGE_REQ_CLM_TRACKSTOP,
-	MESSAGE_REQ_CLM_NODEGET,
-	MESSAGE_REQ_CLM_NODEGETASYNC
+	MESSAGE_REQ_CLM_TRACKSTART = 0,
+	MESSAGE_REQ_CLM_TRACKSTOP = 1,
+	MESSAGE_REQ_CLM_NODEGET = 2,
+	MESSAGE_REQ_CLM_NODEGETASYNC = 3
 };
 
 enum res_clm_types {
-	MESSAGE_RES_CLM_TRACKCALLBACK = 1,
-	MESSAGE_RES_CLM_TRACKSTART,
-	MESSAGE_RES_CLM_TRACKSTOP,
-	MESSAGE_RES_CLM_NODEGET,
-	MESSAGE_RES_CLM_NODEGETASYNC,
-	MESSAGE_RES_CLM_NODEGETCALLBACK
+	MESSAGE_RES_CLM_TRACKCALLBACK = 0,
+	MESSAGE_RES_CLM_TRACKSTART = 1,
+	MESSAGE_RES_CLM_TRACKSTOP = 2,
+	MESSAGE_RES_CLM_NODEGET = 3,
+	MESSAGE_RES_CLM_NODEGETASYNC = 4,
+	MESSAGE_RES_CLM_NODEGETCALLBACK = 5
 };
 
 struct req_clm_clustertrack {
diff -uNr d188.fixed.orig/include/ipc_evt.h d188.fixed/include/ipc_evt.h
--- d188.fixed.orig/include/ipc_evt.h	2005-02-18 12:23:11.000000000 -0700
+++ d188.fixed/include/ipc_evt.h	2005-02-16 18:02:50.000000000 -0700
@@ -41,28 +41,28 @@
 #include "ipc_gen.h"
 
 enum req_evt_types {
-	MESSAGE_REQ_EVT_OPEN_CHANNEL = 1,
-	MESSAGE_REQ_EVT_OPEN_CHANNEL_ASYNC,
-	MESSAGE_REQ_EVT_CLOSE_CHANNEL,
-	MESSAGE_REQ_EVT_UNLINK_CHANNEL,
-	MESSAGE_REQ_EVT_SUBSCRIBE,
-	MESSAGE_REQ_EVT_UNSUBSCRIBE,
-	MESSAGE_REQ_EVT_PUBLISH,
-	MESSAGE_REQ_EVT_CLEAR_RETENTIONTIME,
-	MESSAGE_REQ_EVT_EVENT_DATA
+	MESSAGE_REQ_EVT_OPEN_CHANNEL = 0,
+	MESSAGE_REQ_EVT_OPEN_CHANNEL_ASYNC = 1,
+	MESSAGE_REQ_EVT_CLOSE_CHANNEL = 2,
+	MESSAGE_REQ_EVT_UNLINK_CHANNEL = 3,
+	MESSAGE_REQ_EVT_SUBSCRIBE = 4,
+	MESSAGE_REQ_EVT_UNSUBSCRIBE = 5,
+	MESSAGE_REQ_EVT_PUBLISH = 6,
+	MESSAGE_REQ_EVT_CLEAR_RETENTIONTIME = 7,
+	MESSAGE_REQ_EVT_EVENT_DATA = 8
 };
 
 enum res_evt_types {
-	MESSAGE_RES_EVT_OPEN_CHANNEL = 1,
-	MESSAGE_RES_EVT_CLOSE_CHANNEL,
-	MESSAGE_RES_EVT_UNLINK_CHANNEL,
-	MESSAGE_RES_EVT_SUBSCRIBE,
-	MESSAGE_RES_EVT_UNSUBSCRIBE,
-	MESSAGE_RES_EVT_PUBLISH,
-	MESSAGE_RES_EVT_CLEAR_RETENTIONTIME,
-	MESSAGE_RES_EVT_CHAN_OPEN_CALLBACK,
-	MESSAGE_RES_EVT_EVENT_DATA,
-	MESSAGE_RES_EVT_AVAILABLE
+	MESSAGE_RES_EVT_OPEN_CHANNEL = 0,
+	MESSAGE_RES_EVT_CLOSE_CHANNEL = 1,
+	MESSAGE_RES_EVT_UNLINK_CHANNEL = 2,
+	MESSAGE_RES_EVT_SUBSCRIBE = 3,
+	MESSAGE_RES_EVT_UNSUBSCRIBE = 4,
+	MESSAGE_RES_EVT_PUBLISH = 5,
+	MESSAGE_RES_EVT_CLEAR_RETENTIONTIME = 6,
+	MESSAGE_RES_EVT_CHAN_OPEN_CALLBACK = 7,
+	MESSAGE_RES_EVT_EVENT_DATA = 8,
+	MESSAGE_RES_EVT_AVAILABLE = 9
 };
 
 /* 
diff -uNr d188.fixed.orig/include/ipc_gen.h d188.fixed/include/ipc_gen.h
--- d188.fixed.orig/include/ipc_gen.h	2005-02-18 12:23:11.000000000 -0700
+++ d188.fixed/include/ipc_gen.h	2005-02-16 17:58:09.000000000 -0700
@@ -34,21 +34,23 @@
 #ifndef IPC_GEN_H_DEFINED
 #define IPC_GEN_H_DEFINED
 
+enum service_types {
+	EVS_SERVICE = 0,
+	CLM_SERVICE = 1,
+	AMF_SERVICE = 2,
+	CKPT_SERVICE = 3,
+	EVT_SERVICE = 4
+};
+
 enum req_init_types {
-	MESSAGE_REQ_EVS_INIT,
-	MESSAGE_REQ_CLM_INIT,
-	MESSAGE_REQ_AMF_INIT,
-	MESSAGE_REQ_CKPT_INIT,
-	MESSAGE_REQ_EVT_INIT
+	MESSAGE_REQ_RESPONSE_INIT = 0,
+	MESSAGE_REQ_DISPATCH_INIT = 1
 };
 
 enum res_init_types {
 	MESSAGE_RES_INIT
 };
 
-#define	MESSAGE_REQ_LIB_ACTIVATEPOLL 0
-#define	MESSAGE_RES_LIB_ACTIVATEPOLL 50
-
 enum nodeexec_message_types {
 	MESSAGE_REQ_EXEC_EVS_MCAST,
 	MESSAGE_REQ_EXEC_CLM_NODEJOIN,
diff -uNr d188.fixed.orig/include/queue.h d188.fixed/include/queue.h
--- d188.fixed.orig/include/queue.h	2005-02-18 12:23:11.000000000 -0700
+++ d188.fixed/include/queue.h	2005-02-16 17:58:09.000000000 -0700
@@ -123,6 +123,7 @@
 	assert (queue->tail != queue->head);
 
 	queue->used--;
+	assert (queue->used >= 0);
 }
 
 static inline void queue_items_remove (struct queue *queue, int rel_count)
diff -uNr d188.fixed.orig/lib/amf.c d188.fixed/lib/amf.c
--- d188.fixed.orig/lib/amf.c	2005-02-18 12:23:11.000000000 -0700
+++ d188.fixed/lib/amf.c	2005-02-16 17:58:09.000000000 -0700
@@ -59,13 +59,14 @@
  * Data structure for instance data
  */
 struct amfInstance {
-	int fd;
+	int response_fd;
+	int dispatch_fd;
 	SaAmfCallbacksT callbacks;
-	struct queue inq;
 	SaNameT compName;
 	int compRegistered;
 	int finalize;
-	pthread_mutex_t mutex;
+	pthread_mutex_t response_mutex;
+	pthread_mutex_t dispatch_mutex;
 };
 
 static void amfHandleInstanceDestructor (void *);
@@ -101,13 +102,13 @@
 {
 	struct amfInstance *amfInstance = (struct amfInstance *)instance;
 
-	if (amfInstance->fd != -1) {
-		shutdown (amfInstance->fd, 0);
-		close (amfInstance->fd);
-	}
-
-	if (amfInstance->inq.items) {
-		free (amfInstance->inq.items);
+	if (amfInstance->response_fd != -1) {
+		shutdown (amfInstance->response_fd, 0);
+		close (amfInstance->response_fd);
+	}
+	if (amfInstance->dispatch_fd != -1) {
+		shutdown (amfInstance->dispatch_fd, 0);
+		close (amfInstance->dispatch_fd);
 	}
 }
 
@@ -135,26 +136,21 @@
 		goto error_destroy;
 	}
 
-	amfInstance->fd = -1;
-	
-	/*
-	 * An inq is needed to store async messages while waiting for a 
-	 * sync response
-	 */
-	error = saQueueInit (&amfInstance->inq, 512, sizeof (void *));
-	if (error != SA_OK) {
-		goto error_put_destroy;
-	}
+	amfInstance->response_fd = -1;
 
-	error = saServiceConnect (&amfInstance->fd, MESSAGE_REQ_AMF_INIT);
+	amfInstance->dispatch_fd = -1;
+	
+	error = saServiceConnectTwo (&amfInstance->response_fd,
+		&amfInstance->dispatch_fd, AMF_SERVICE);
 	if (error != SA_OK) {
 		goto error_put_destroy;
-// this is wrong
 	}
 
 	memcpy (&amfInstance->callbacks, amfCallbacks, sizeof (SaAmfCallbacksT));
 
-	pthread_mutex_init (&amfInstance->mutex, NULL);
+	pthread_mutex_init (&amfInstance->response_mutex, NULL);
+
+	pthread_mutex_init (&amfInstance->dispatch_mutex, NULL);
 
 	saHandleInstancePut (&amfHandleDatabase, *amfHandle);
 
@@ -181,7 +177,7 @@
 		return (error);
 	}
 
-	*selectionObject = amfInstance->fd;
+	*selectionObject = amfInstance->dispatch_fd;
 
 	saHandleInstancePut (&amfHandleDatabase, *amfHandle);
 	return (SA_OK);
@@ -195,20 +191,15 @@
 	struct pollfd ufds;
 	int timeout = -1;
 	SaErrorT error;
+	int cont = 1; /* always continue do loop except when set to 0 */
 	int dispatch_avail;
 	struct amfInstance *amfInstance;
-	SaAmfCallbacksT callbacks;
 	struct res_lib_amf_healthcheckcallback *res_lib_amf_healthcheckcallback;
 	struct res_lib_amf_readinessstatesetcallback *res_lib_amf_readinessstatesetcallback;
 	struct res_lib_amf_csisetcallback *res_lib_amf_csisetcallback;
 	struct res_lib_amf_csiremovecallback *res_lib_amf_csiremovecallback;
 	struct res_lib_amf_protectiongrouptrackcallback *res_lib_amf_protectiongrouptrackcallback;
-	struct req_header **queue_msg;
-	struct req_header *msg;
-	int empty;
-	int ignore_dispatch = 0;
-	int cont = 1; /* always continue do loop except when set to 0 */
-	int poll_fd;
+	SaAmfCallbacksT callbacks;
 	struct res_overlay dispatch_data;
 
 	error = saHandleInstanceGet (&amfHandleDatabase, *amfHandle,
@@ -225,12 +216,10 @@
 	}
 
 	do {
-		poll_fd = amfInstance->fd;
-
 		/*
 		 * Read data directly from socket
 		 */
-		ufds.fd = poll_fd;
+		ufds.fd = amfInstance->dispatch_fd;
 		ufds.events = POLLIN;
 		ufds.revents = 0;
 
@@ -239,79 +228,66 @@
 			goto error_nounlock;
 		}
 
-		pthread_mutex_lock (&amfInstance->mutex);
+		pthread_mutex_lock (&amfInstance->dispatch_mutex);
+
+		error = saPollRetry (&ufds, 1, 0);
+		if (error != SA_OK) {
+			goto error_nounlock;
+		}
 
 		/*
 		 * Handle has been finalized in another thread
 		 */
 		if (amfInstance->finalize == 1) {
 			error = SA_OK;
-			pthread_mutex_unlock (&amfInstance->mutex);
+			pthread_mutex_unlock (&amfInstance->dispatch_mutex);
 			goto error_unlock;
 		}
 
 		dispatch_avail = ufds.revents & POLLIN;
 		if (dispatch_avail == 0 && dispatchFlags == SA_DISPATCH_ALL) {
-			pthread_mutex_unlock (&amfInstance->mutex);
+			pthread_mutex_unlock (&amfInstance->dispatch_mutex);
 			break; /* exit do while cont is 1 loop */
 		} else
 		if (dispatch_avail == 0) {
-			pthread_mutex_unlock (&amfInstance->mutex);
+			pthread_mutex_unlock (&amfInstance->dispatch_mutex);
 			continue; /* next poll */
 		}
-
-		saQueueIsEmpty(&amfInstance->inq, &empty);
-		if (empty == 0) {
-			/*
-			 * Queue is not empty, read data from queue
-			 */
-			saQueueItemGet (&amfInstance->inq, (void *)&queue_msg);
-			msg = *queue_msg;
-			memcpy (&dispatch_data, msg, msg->size);
-			saQueueItemRemove (&amfInstance->inq);
-			free (msg);
-		} else {
+	if (ufds.revents & POLLIN) {
 			/*
 			 * Queue empty, read response from socket
 			 */
-			error = saRecvRetry (amfInstance->fd, &dispatch_data.header,
+			error = saRecvRetry (amfInstance->dispatch_fd, &dispatch_data.header,
 				sizeof (struct res_header), MSG_WAITALL | MSG_NOSIGNAL);
 			if (error != SA_OK) {
 				goto error_unlock;
 			}
 			if (dispatch_data.header.size > sizeof (struct res_header)) {
-				error = saRecvRetry (amfInstance->fd, &dispatch_data.data,
+				error = saRecvRetry (amfInstance->dispatch_fd, &dispatch_data.data,
 					dispatch_data.header.size - sizeof (struct res_header),
 					MSG_WAITALL | MSG_NOSIGNAL);
 				if (error != SA_OK) {
 					goto error_unlock;
 				}
 			}
+		} else {
+			pthread_mutex_unlock (&amfInstance->dispatch_mutex);
+			continue;
 		}
+
 		/*
 		 * Make copy of callbacks, message data, unlock instance, and call callback
 		 * A risk of this dispatch method is that the callback routines may
 		 * operate at the same time that amfFinalize has been called in another thread.
 		 */
 		memcpy (&callbacks, &amfInstance->callbacks, sizeof (SaAmfCallbacksT));
-		pthread_mutex_unlock (&amfInstance->mutex);
+		pthread_mutex_unlock (&amfInstance->dispatch_mutex);
 
 
 		/*
 		 * Dispatch incoming response
 		 */
 		switch (dispatch_data.header.id) {
-		case MESSAGE_RES_LIB_ACTIVATEPOLL:
-			/*
-			 * This is a do nothing message which the node executive sends
-			 * to activate the file amfHandle in poll when the library has
-			 * queued a message into amfHandle->inq
-			 * The dispatch is ignored for the following two cases:
-			 * 1) setting of timeout to zero for the DISPATCH_ALL case
-			 * 2) expiration of the do loop for the DISPATCH_ONE case
-			 */
-			ignore_dispatch = 1;
-			break;
 
 		case MESSAGE_RES_AMF_HEALTHCHECKCALLBACK:
 			res_lib_amf_healthcheckcallback = (struct res_lib_amf_healthcheckcallback *)&dispatch_data;
@@ -375,16 +351,9 @@
 		 */
 		switch (dispatchFlags) {
 		case SA_DISPATCH_ONE:
-			if (ignore_dispatch) {
-				ignore_dispatch = 0;
-			} else {
-				cont = 0;
-			}
+			cont = 0;
 			break;
 		case SA_DISPATCH_ALL:
-			if (ignore_dispatch) {
-				ignore_dispatch = 0;
-			}
 			break;
 		case SA_DISPATCH_BLOCKING:
 			break;
@@ -409,22 +378,25 @@
 		return (error);
 	}
 
-	pthread_mutex_lock (&amfInstance->mutex);
+	pthread_mutex_lock (&amfInstance->dispatch_mutex);
+
+	pthread_mutex_lock (&amfInstance->response_mutex);
 
 	/*
 	 * Another thread has already started finalizing
 	 */
 	if (amfInstance->finalize) {
-		pthread_mutex_unlock (&amfInstance->mutex);
+		pthread_mutex_unlock (&amfInstance->response_mutex);
+		pthread_mutex_unlock (&amfInstance->dispatch_mutex);
 		saHandleInstancePut (&amfHandleDatabase, *amfHandle);
 		return (SA_ERR_BAD_HANDLE);
 	}
 
 	amfInstance->finalize = 1;
 
-	saActivatePoll (amfInstance->fd);
+	pthread_mutex_unlock (&amfInstance->response_mutex);
 
-	pthread_mutex_unlock (&amfInstance->mutex);
+	pthread_mutex_unlock (&amfInstance->dispatch_mutex);
 
 	saHandleDestroy (&amfHandleDatabase, *amfHandle);
 
@@ -458,21 +430,12 @@
 		return (error);
 	}
 
-	pthread_mutex_lock (&amfInstance->mutex);
-
-	error = saSendRetry (amfInstance->fd, &req_lib_amf_componentregister, sizeof (struct req_lib_amf_componentregister), MSG_NOSIGNAL);
-	if (error != SA_OK) {
-		goto error_unlock;
-	}
+	pthread_mutex_lock (&amfInstance->response_mutex);
 
-	/*
-	 * Search for COMPONENTREGISTER responses and queue any
-	 * messages that dont match in this amfHandle's inq.
-	 * This must be done to avoid dropping async messages
-	 * during this sync message retrieval
-	 */
-	error = saRecvQueue (amfInstance->fd, &res_lib_amf_componentregister,
-		&amfInstance->inq, MESSAGE_RES_AMF_COMPONENTREGISTER);
+	error - saSendReceiveReply (amfInstance->response_fd, &req_lib_amf_componentregister,
+		sizeof (struct req_lib_amf_componentregister),
+		&res_lib_amf_componentregister,
+		sizeof (struct res_lib_amf_componentregister));
 	if (error != SA_OK) {
 		goto error_unlock;
 	}
@@ -485,7 +448,7 @@
 	error = res_lib_amf_componentregister.header.error;
 
 error_unlock:
-	pthread_mutex_unlock (&amfInstance->mutex);
+	pthread_mutex_unlock (&amfInstance->response_mutex);
 	saHandleInstancePut (&amfHandleDatabase, *amfHandle);
 	return (error);
 }
@@ -515,33 +478,24 @@
 		return (error);
 	}
 
-	pthread_mutex_lock (&amfInstance->mutex);
+	pthread_mutex_lock (&amfInstance->response_mutex);
 
-	error = saSendRetry (amfInstance->fd, &req_lib_amf_componentunregister,
-		sizeof (struct req_lib_amf_componentunregister), MSG_NOSIGNAL);
+	error - saSendReceiveReply (amfInstance->response_fd,
+		&req_lib_amf_componentunregister,
+		sizeof (struct req_lib_amf_componentunregister),
+		&res_lib_amf_componentunregister,
+		sizeof (struct res_lib_amf_componentunregister));
 	if (error != SA_OK) {
 		goto error_unlock;
 	}
 
-	/*
-	 * Search for COMPONENTUNREGISTER responses and queue any
-	 * messages that dont match in this amfHandle's inq.
-	 * This must be done to avoid dropping async messages
-	 * during this sync message retrieval
-	 */
-	error = saRecvQueue (amfInstance->fd, &res_lib_amf_componentunregister,
-		&amfInstance->inq, MESSAGE_RES_AMF_COMPONENTUNREGISTER);
-	if (error != SA_OK) {
-		goto error_unlock;
-	}
-
-	if (res_lib_amf_componentunregister.header.error == SA_OK) {
+	error = res_lib_amf_componentunregister.header.error;
+	if (error == SA_OK) {
 		amfInstance->compRegistered = 0;
 	}
-	error = res_lib_amf_componentunregister.header.error;
 
 error_unlock:
-	pthread_mutex_unlock (&amfInstance->mutex);
+	pthread_mutex_unlock (&amfInstance->response_mutex);
 	saHandleInstancePut (&amfHandleDatabase, *amfHandle);
 	return (error);
 }
@@ -559,18 +513,19 @@
 		return (error);
 	}
 
-	pthread_mutex_lock (&amfInstance->mutex);
+	pthread_mutex_lock (&amfInstance->response_mutex);
 
 	if (amfInstance->compRegistered == 0) {
-		pthread_mutex_unlock (&amfInstance->mutex);
+		pthread_mutex_unlock (&amfInstance->response_mutex);
 		return (SA_ERR_NOT_EXIST);
 	}
 
 	memcpy (compName, &amfInstance->compName, sizeof (SaNameT));
 
-	pthread_mutex_unlock (&amfInstance->mutex);
+	pthread_mutex_unlock (&amfInstance->response_mutex);
 
 	saHandleInstancePut (&amfHandleDatabase, *amfHandle);
+
 	return (SA_OK);
 }
 
@@ -592,18 +547,17 @@
 	req_amf_readinessstateget.header.size = sizeof (struct req_amf_readinessstateget);
 	memcpy (&req_amf_readinessstateget.compName, compName, sizeof (SaNameT));
 
-	error = saSendRetry (fd, &req_amf_readinessstateget,
-		sizeof (struct req_amf_readinessstateget), MSG_NOSIGNAL);
+	error - saSendReceiveReply (fd,
+		&req_amf_readinessstateget, sizeof (struct req_amf_readinessstateget),
+		&res_lib_amf_readinessstateget, sizeof (struct res_lib_amf_readinessstateget));
 	if (error != SA_OK) {
 		goto exit_close;
 	}
 
-	error = saRecvRetry (fd, &res_lib_amf_readinessstateget,
-		sizeof (struct res_lib_amf_readinessstateget), MSG_WAITALL | MSG_NOSIGNAL);
+	error = res_lib_amf_readinessstateget.header.error;
 	if (error == SA_OK) {
 		memcpy (readinessState, &res_lib_amf_readinessstateget.readinessState, 
 			sizeof (SaAmfReadinessStateT));
-		error = res_lib_amf_readinessstateget.header.error;
 	}
 		
 exit_close:
@@ -618,6 +572,7 @@
 	SaErrorT error)
 {
 	struct req_amf_stoppingcomplete req_amf_stoppingcomplete;
+	struct res_lib_amf_stoppingcomplete res_lib_amf_stoppingcomplete;
 	int fd;
 	SaErrorT errorResult;
 
@@ -629,11 +584,17 @@
 	req_amf_stoppingcomplete.header.size = sizeof (struct req_amf_stoppingcomplete);
 	req_amf_stoppingcomplete.invocation = invocation;
 	req_amf_stoppingcomplete.error = error;
-	errorResult = saSendRetry (fd, &req_amf_stoppingcomplete,
-		sizeof (struct req_amf_stoppingcomplete), MSG_NOSIGNAL);
+	error = saSendReceiveReply (fd,
+		&req_amf_stoppingcomplete, sizeof (struct req_amf_stoppingcomplete),
+		&res_lib_amf_stoppingcomplete, sizeof (struct res_lib_amf_stoppingcomplete));
+	if (error != SA_OK) {
+		goto exit_close;
+	}
+	error = res_lib_amf_stoppingcomplete.header.error;
+// TODO executive needs to send reply of stopping complete
 
+exit_close:
 	close (fd);
-
 exit_noclose:
 	return (errorResult);
 }
@@ -658,17 +619,16 @@
 	memcpy (&req_amf_hastateget.compName, compName, sizeof (SaNameT));
 	memcpy (&req_amf_hastateget.csiName, csiName, sizeof (SaNameT));
 
-	error = saSendRetry (fd, &req_amf_hastateget,
-			sizeof (struct req_amf_hastateget), MSG_NOSIGNAL);
+	error = saSendReceiveReply (fd,
+		&req_amf_hastateget, sizeof (struct req_amf_hastateget),
+		&res_lib_amf_hastateget, sizeof (struct res_lib_amf_hastateget));
 	if (error != SA_OK) {
 		goto exit_close;
 	}
 
-	error = saRecvRetry (fd, &res_lib_amf_hastateget,
-		sizeof (struct res_lib_amf_hastateget), MSG_WAITALL | MSG_NOSIGNAL);
+	error = res_lib_amf_hastateget.header.error;
 	if (error == SA_OK) {
 		memcpy (haState, &res_lib_amf_hastateget.haState, sizeof (SaAmfHAStateT));
-		error = res_lib_amf_hastateget.header.error;
 	}
 	
 exit_close:
@@ -702,21 +662,21 @@
 		return (error);
 	}
 
-	pthread_mutex_lock (&amfInstance->mutex);
+	pthread_mutex_lock (&amfInstance->response_mutex);
 
-	error = saSendRetry (amfInstance->fd, &req_amf_protectiongrouptrackstart,
-		sizeof (struct req_amf_protectiongrouptrackstart), MSG_NOSIGNAL);
+	error = saSendReceiveReply (amfInstance->response_fd,
+		&req_amf_protectiongrouptrackstart,
+		sizeof (struct req_amf_protectiongrouptrackstart),
+		&res_lib_amf_protectiongrouptrackstart,
+		sizeof (struct res_lib_amf_protectiongrouptrackstart));
 	if (error != SA_OK) {
 		goto error_unlock;
 	}
 
-	error = saRecvQueue (amfInstance->fd, &res_lib_amf_protectiongrouptrackstart,
-		&amfInstance->inq, MESSAGE_RES_AMF_PROTECTIONGROUPTRACKSTART);
-
 	error = res_lib_amf_protectiongrouptrackstart.header.error;
 
 error_unlock:
-	pthread_mutex_unlock (&amfInstance->mutex);
+	pthread_mutex_unlock (&amfInstance->response_mutex);
 	saHandleInstancePut (&amfHandleDatabase, *amfHandle);
 	return (error);
 }
@@ -740,21 +700,21 @@
 		return (error);
 	}
 
-	pthread_mutex_lock (&amfInstance->mutex);
+	pthread_mutex_lock (&amfInstance->response_mutex);
 
-	error = saSendRetry (amfInstance->fd, &req_amf_protectiongrouptrackstop,
-		sizeof (struct req_amf_protectiongrouptrackstop), MSG_NOSIGNAL);
+	error = saSendReceiveReply (amfInstance->response_fd,
+		&req_amf_protectiongrouptrackstop,
+		sizeof (struct req_amf_protectiongrouptrackstop),
+		&res_lib_amf_protectiongrouptrackstop,
+		sizeof (struct res_lib_amf_protectiongrouptrackstop));
 	if (error != SA_OK) {
 		goto error_unlock;
 	}
 
-	error = saRecvQueue (amfInstance->fd, &res_lib_amf_protectiongrouptrackstop,
-		&amfInstance->inq, MESSAGE_RES_AMF_PROTECTIONGROUPTRACKSTOP);
-
 	error = res_lib_amf_protectiongrouptrackstop.header.error;
 
 error_unlock:
-	pthread_mutex_unlock (&amfInstance->mutex);
+	pthread_mutex_unlock (&amfInstance->response_mutex);
 	saHandleInstancePut (&amfHandleDatabase, *amfHandle);
 	return (error);
 }
@@ -788,14 +748,9 @@
 		additionalData, sizeof (SaAmfAdditionalDataT));
 	*/
 
-	error = saSendRetry (fd, &req_lib_amf_errorreport,
-		sizeof (struct req_lib_amf_errorreport), MSG_NOSIGNAL);
-
-	/*
-	 * Get response from executive and respond to user application
-	 */
-	error = saRecvRetry (fd, &res_lib_amf_errorreport,
-		sizeof (struct res_lib_amf_errorreport), MSG_WAITALL | MSG_NOSIGNAL);
+	error = saSendReceiveReply (fd,
+		&req_lib_amf_errorreport, sizeof (struct req_lib_amf_errorreport),
+		&res_lib_amf_errorreport, sizeof (struct res_lib_amf_errorreport));
 	if (error != SA_OK) {
 		goto exit_close;
 	}
@@ -825,14 +780,9 @@
 	req_lib_amf_errorcancelall.header.size = sizeof (struct req_lib_amf_errorcancelall);
 	memcpy (&req_lib_amf_errorcancelall.compName, compName, sizeof (SaNameT));
 
-	error = saSendRetry (fd, &req_lib_amf_errorcancelall,
-		sizeof (struct req_lib_amf_errorcancelall), MSG_NOSIGNAL);
-
-	/*
-	 * Get response from executive and respond to user application
-	 */
-	error = saRecvRetry (fd, &res_lib_amf_errorcancelall,
-		sizeof (struct res_lib_amf_errorcancelall), MSG_WAITALL | MSG_NOSIGNAL);
+	error = saSendReceiveReply (fd,
+		&req_lib_amf_errorcancelall, sizeof (struct req_lib_amf_errorcancelall),
+		&res_lib_amf_errorcancelall, sizeof (struct res_lib_amf_errorcancelall));
 	if (error != SA_OK) {
 		goto exit_close;
 	}
@@ -864,19 +814,20 @@
 	req_amf_componentcapabilitymodelget.header.size = sizeof (struct req_amf_componentcapabilitymodelget);
 	memcpy (&req_amf_componentcapabilitymodelget.compName, compName, sizeof (SaNameT));
 
-	error = saSendRetry (fd, &req_amf_componentcapabilitymodelget,
-		sizeof (struct req_amf_componentcapabilitymodelget), MSG_NOSIGNAL);
+	error = saSendReceiveReply (fd,
+		&req_amf_componentcapabilitymodelget,
+		sizeof (struct req_amf_componentcapabilitymodelget),
+		&res_lib_amf_componentcapabilitymodelget,
+		sizeof (struct res_lib_amf_componentcapabilitymodelget));
 	if (error != SA_OK) {
 		goto exit_close;
 	}
+	error = res_lib_amf_componentcapabilitymodelget.header.error;
 
-	error = saRecvRetry (fd, &res_lib_amf_componentcapabilitymodelget,
-		sizeof (struct res_lib_amf_componentcapabilitymodelget), MSG_WAITALL | MSG_NOSIGNAL);
 	if (error == SA_OK) {
 		memcpy (componentCapabilityModel,
 			&res_lib_amf_componentcapabilitymodelget.componentCapabilityModel, 
 			sizeof (SaAmfComponentCapabilityModelT));
-		error = res_lib_amf_componentcapabilitymodelget.header.error;
 	}
 		
 exit_close:
Binary files d188.fixed.orig/lib/amf.o and d188.fixed/lib/amf.o differ
diff -uNr d188.fixed.orig/lib/ckpt.c d188.fixed/lib/ckpt.c
--- d188.fixed.orig/lib/ckpt.c	2005-02-18 12:23:11.000000000 -0700
+++ d188.fixed/lib/ckpt.c	2005-02-17 14:05:30.000000000 -0700
@@ -60,28 +60,29 @@
  * Data structure for instance data
  */
 struct ckptInstance {
-	int fd;
-	struct queue inq;
+	int response_fd;
+	int dispatch_fd;
 	SaCkptCallbacksT callbacks;
 	int finalize;
-	pthread_mutex_t mutex;
+	pthread_mutex_t response_mutex;
+	pthread_mutex_t dispatch_mutex;
 };
 
 struct ckptCheckpointInstance {
-	int fd;
+	int response_fd;
 	SaCkptHandleT ckptHandle;
 	SaCkptCheckpointOpenFlagsT checkpointOpenFlags;
 	SaNameT checkpointName;
 	SaUint32T maxSectionIdSize;
-	pthread_mutex_t mutex;
+	pthread_mutex_t response_mutex;
 };
 
 struct ckptSectionIterationInstance {
-	int fd;
+	int response_fd;
 	SaCkptCheckpointHandleT checkpointHandle;
 	struct list_head sectionIdListHead;
 	SaUint32T maxSectionIdSize;
-	pthread_mutex_t mutex;
+	pthread_mutex_t response_mutex;
 };
 
 void ckptHandleInstanceDestructor (void *instance);
@@ -139,12 +140,9 @@
 {
 struct ckptInstance *ckptInstance = (struct ckptInstance *)instance;
 
-	if (ckptInstance->fd != -1) {
-		shutdown (ckptInstance->fd, 0);
-		close (ckptInstance->fd);
-	}
-	if (ckptInstance->inq.items) {
-		free (ckptInstance->inq.items);
+	if (ckptInstance->response_fd != -1) {
+		shutdown (ckptInstance->response_fd, 0);
+		close (ckptInstance->response_fd);
 	}
 }
 
@@ -157,10 +155,10 @@
 {
 	struct ckptSectionIterationInstance *ckptSectionIterationInstance = (struct ckptSectionIterationInstance *)instance;
 
-	if (ckptSectionIterationInstance->fd != -1) {
-		shutdown (ckptSectionIterationInstance->fd, 0);
+	if (ckptSectionIterationInstance->response_fd != -1) {
+		shutdown (ckptSectionIterationInstance->response_fd, 0);
 
-		close (ckptSectionIterationInstance->fd);
+		close (ckptSectionIterationInstance->response_fd);
 	}
 }
 
@@ -190,25 +188,17 @@
 		goto error_destroy;
 	}
 
-	ckptInstance->fd = -1;
-
-	/*
-	 * An inq is needed to store async messages while waiting for a 
-	 * sync response
-	 */
-	error = saQueueInit (&ckptInstance->inq, 512, sizeof (void *));
-	if (error != SA_AIS_OK) {
-		goto error_put_destroy;
-	}
+	ckptInstance->response_fd = -1;
 
-	error = saServiceConnect (&ckptInstance->fd, MESSAGE_REQ_CKPT_INIT);
+	error = saServiceConnectTwo (&ckptInstance->response_fd,
+		&ckptInstance->dispatch_fd, CKPT_SERVICE);
 	if (error != SA_AIS_OK) {
 		goto error_put_destroy;
 	}
 
 	memcpy (&ckptInstance->callbacks, callbacks, sizeof (SaCkptCallbacksT));
 
-	pthread_mutex_init (&ckptInstance->mutex, NULL);
+	pthread_mutex_init (&ckptInstance->response_mutex, NULL);
 
 	saHandleInstancePut (&ckptHandleDatabase, *ckptHandle);
 
@@ -235,7 +225,7 @@
 		return (error);
 	}
 
-	*selectionObject = ckptInstance->fd;
+	*selectionObject = ckptInstance->response_fd;
 
 	saHandleInstancePut (&ckptHandleDatabase, ckptHandle);
 
@@ -276,14 +266,14 @@
 		 * Read data directly from socket
 		 */
 		FD_ZERO (&read_fds);
-		FD_SET (ckptInstance->fd, &read_fds);
+		FD_SET (ckptInstance->response_fd, &read_fds);
 
-		error = saSelectRetry (ckptInstance->fd + 1, &read_fds, 0, 0, timeout);
+		error = saSelectRetry (ckptInstance->response_fd + 1, &read_fds, 0, 0, timeout);
 		if (error != SA_AIS_OK) {
 			goto error_exit;
 		}
 
-		dispatch_avail = FD_ISSET (ckptInstance->fd, &read_fds);
+		dispatch_avail = FD_ISSET (ckptInstance->response_fd, &read_fds);
 		if (dispatch_avail == 0 && dispatchFlags == SA_DISPATCH_ALL) {
 			break; /* exit do while cont is 1 loop */
 		} else
@@ -305,12 +295,12 @@
 			/*
 			 * Queue empty, read response from socket
 			 */
-			error = saRecvRetry (ckptInstance->fd, &ckptInstance->message.header, sizeof (struct req_header), MSG_WAITALL | MSG_NOSIGNAL);
+			error = saRecvRetry (ckptInstance->response_fd, &ckptInstance->message.header, sizeof (struct req_header), MSG_WAITALL | MSG_NOSIGNAL);
 			if (error != SA_AIS_OK) {
 				goto error_exit;
 			}
 			if (ckptInstance->message.header.size > sizeof (struct req_header)) {
-				error = saRecvRetry (ckptInstance->fd, &ckptInstance->message.data,
+				error = saRecvRetry (ckptInstance->response_fd, &ckptInstance->message.data,
 					ckptInstance->message.header.size - sizeof (struct req_header),
 					MSG_WAITALL | MSG_NOSIGNAL);
 				if (error != SA_AIS_OK) {
@@ -430,22 +420,20 @@
 		return (error);
 	}
 
-	pthread_mutex_lock (&ckptInstance->mutex);
+	pthread_mutex_lock (&ckptInstance->response_mutex);
 
 	/*
 	 * Another thread has already started finalizing
 	 */
 	if (ckptInstance->finalize) {
-		pthread_mutex_unlock (&ckptInstance->mutex);
+		pthread_mutex_unlock (&ckptInstance->response_mutex);
 		saHandleInstancePut (&ckptHandleDatabase, ckptHandle);
 		return (SA_AIS_ERR_BAD_HANDLE);
 	}
 
 	ckptInstance->finalize = 1;
 
-	saActivatePoll (ckptInstance->fd);
-
-	pthread_mutex_unlock (&ckptInstance->mutex);
+	pthread_mutex_unlock (&ckptInstance->response_mutex);
 
 	saHandleInstancePut (&ckptHandleDatabase, ckptHandle);
 
@@ -487,7 +475,7 @@
 		goto error_put_destroy;
 	}
 
-	ckptCheckpointInstance->fd = ckptInstance->fd;
+	ckptCheckpointInstance->response_fd = ckptInstance->response_fd;
 
 	ckptCheckpointInstance->maxSectionIdSize =
 		checkpointCreationAttributes->maxSectionIdSize;
@@ -504,13 +492,13 @@
 		sizeof (SaCkptCheckpointCreationAttributesT));
 	req_lib_ckpt_checkpointopen.checkpointOpenFlags = checkpointOpenFlags;
 
-	error = saSendRetry (ckptCheckpointInstance->fd, &req_lib_ckpt_checkpointopen,
+	error = saSendRetry (ckptCheckpointInstance->response_fd, &req_lib_ckpt_checkpointopen,
 		sizeof (struct req_lib_ckpt_checkpointopen), MSG_NOSIGNAL);
 	if (error != SA_AIS_OK) {
 		goto error_put_ckpt_destroy;
 	}
 
-	error = saRecvRetry (ckptCheckpointInstance->fd, &res_lib_ckpt_checkpointopen,
+	error = saRecvRetry (ckptCheckpointInstance->response_fd, &res_lib_ckpt_checkpointopen,
 		sizeof (struct res_lib_ckpt_checkpointopen), MSG_WAITALL | MSG_NOSIGNAL);
 	if (error != SA_AIS_OK) {
 		goto error_put_ckpt_destroy;
@@ -521,7 +509,7 @@
 		goto error_put_ckpt_destroy;
 	}
 
-	pthread_mutex_init (&ckptCheckpointInstance->mutex, NULL);
+	pthread_mutex_init (&ckptCheckpointInstance->response_mutex, NULL);
 
 	saHandleInstancePut (&checkpointHandleDatabase, *checkpointHandle);
 
@@ -566,12 +554,12 @@
 	
 	req_lib_ckpt_checkpointopenasync.checkpointOpenFlags = checkpointOpenFlags;
 
-	pthread_mutex_lock (&ckptInstance->mutex);
+	pthread_mutex_lock (&ckptInstance->response_mutex);
 
-        error = saSendRetry (ckptInstance->fd, &req_lib_ckpt_checkpointopenasync,
+        error = saSendRetry (ckptInstance->response_fd, &req_lib_ckpt_checkpointopenasync,
 		sizeof (struct req_lib_ckpt_checkpointopenasync), MSG_NOSIGNAL);
 
-	pthread_mutex_unlock (&ckptInstance->mutex);
+	pthread_mutex_unlock (&ckptInstance->response_mutex);
 
 	saHandleInstancePut (&ckptHandleDatabase, ckptHandle);
 
@@ -598,13 +586,13 @@
 	memcpy (&req_lib_ckpt_checkpointclose.checkpointName,
 		&ckptCheckpointInstance->checkpointName, sizeof (SaNameT));
 
-	error = saSendRetry (ckptCheckpointInstance->fd, &req_lib_ckpt_checkpointclose,
+	error = saSendRetry (ckptCheckpointInstance->response_fd, &req_lib_ckpt_checkpointclose,
 		sizeof (struct req_lib_ckpt_checkpointclose), MSG_NOSIGNAL);
 	if (error != SA_AIS_OK) {
 		goto exit_put;
 	}
 
-	error = saRecvRetry (ckptCheckpointInstance->fd, &res_lib_ckpt_checkpointclose,
+	error = saRecvRetry (ckptCheckpointInstance->response_fd, &res_lib_ckpt_checkpointclose,
 		sizeof (struct res_lib_ckpt_checkpointclose), MSG_WAITALL | MSG_NOSIGNAL);
 
 
@@ -639,13 +627,13 @@
 	memcpy (&req_lib_ckpt_checkpointunlink.checkpointName, checkpointName, sizeof (SaNameT));
 
 
-	error = saSendRetry (ckptInstance->fd, &req_lib_ckpt_checkpointunlink,
+	error = saSendRetry (ckptInstance->response_fd, &req_lib_ckpt_checkpointunlink,
 		sizeof (struct req_lib_ckpt_checkpointunlink), MSG_NOSIGNAL);
 	if (error != SA_AIS_OK) {
 		goto exit_put;
 	}
 
-	error = saRecvRetry (ckptInstance->fd, &res_lib_ckpt_checkpointunlink,
+	error = saRecvRetry (ckptInstance->response_fd, &res_lib_ckpt_checkpointunlink,
 		sizeof (struct res_lib_ckpt_checkpointunlink), MSG_WAITALL | MSG_NOSIGNAL);
 
 exit_put:
@@ -680,19 +668,19 @@
 	memcpy (&req_lib_ckpt_checkpointretentiondurationset.checkpointName,
 		&ckptCheckpointInstance->checkpointName, sizeof (SaNameT));
 
-	pthread_mutex_lock (&ckptCheckpointInstance->mutex);
+	pthread_mutex_lock (&ckptCheckpointInstance->response_mutex);
 
-	error = saSendRetry (ckptCheckpointInstance->fd, &req_lib_ckpt_checkpointretentiondurationset, sizeof (struct req_lib_ckpt_checkpointretentiondurationset), MSG_NOSIGNAL);
+	error = saSendRetry (ckptCheckpointInstance->response_fd, &req_lib_ckpt_checkpointretentiondurationset, sizeof (struct req_lib_ckpt_checkpointretentiondurationset), MSG_NOSIGNAL);
 	if (error != SA_AIS_OK) {
 		goto error_exit;
 	}
 
-	error = saRecvRetry (ckptCheckpointInstance->fd,
+	error = saRecvRetry (ckptCheckpointInstance->response_fd,
 		&res_lib_ckpt_checkpointretentiondurationset,
 		sizeof (struct res_lib_ckpt_checkpointretentiondurationset),
 		MSG_WAITALL | MSG_NOSIGNAL);
 
-	pthread_mutex_unlock (&ckptCheckpointInstance->mutex);
+	pthread_mutex_unlock (&ckptCheckpointInstance->response_mutex);
 
 error_exit:
 	saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle);
@@ -718,20 +706,20 @@
 	req_lib_ckpt_activereplicaset.header.size = sizeof (struct req_lib_ckpt_activereplicaset);
 	req_lib_ckpt_activereplicaset.header.id = MESSAGE_REQ_CKPT_CHECKPOINT_ACTIVEREPLICASET;
 
-	pthread_mutex_lock (&ckptCheckpointInstance->mutex);
+	pthread_mutex_lock (&ckptCheckpointInstance->response_mutex);
 
-	error = saSendRetry (ckptCheckpointInstance->fd, &req_lib_ckpt_activereplicaset,
+	error = saSendRetry (ckptCheckpointInstance->response_fd, &req_lib_ckpt_activereplicaset,
 		sizeof (struct req_lib_ckpt_activereplicaset), MSG_NOSIGNAL);
 	if (error != SA_AIS_OK) {
 		goto error_exit;
 	}
 
-	error = saRecvRetry (ckptCheckpointInstance->fd,
+	error = saRecvRetry (ckptCheckpointInstance->response_fd,
 		&res_lib_ckpt_activereplicaset,
 		sizeof (struct res_lib_ckpt_activereplicaset),
 		MSG_WAITALL | MSG_NOSIGNAL);
 
-	pthread_mutex_unlock (&ckptCheckpointInstance->mutex);
+	pthread_mutex_unlock (&ckptCheckpointInstance->response_mutex);
 
 	saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle);
 
@@ -761,15 +749,15 @@
 	memcpy (&req_lib_ckpt_checkpointstatusget.checkpointName,
 		&ckptCheckpointInstance->checkpointName, sizeof (SaNameT));
 
-	pthread_mutex_lock (&ckptCheckpointInstance->mutex);
+	pthread_mutex_lock (&ckptCheckpointInstance->response_mutex);
 
-	error = saSendRetry (ckptCheckpointInstance->fd, &req_lib_ckpt_checkpointstatusget,
+	error = saSendRetry (ckptCheckpointInstance->response_fd, &req_lib_ckpt_checkpointstatusget,
 		sizeof (struct req_lib_ckpt_checkpointstatusget), MSG_NOSIGNAL);
 	if (error != SA_AIS_OK) {
 		goto error_exit;
 	}
 
-	error = saRecvRetry (ckptCheckpointInstance->fd,
+	error = saRecvRetry (ckptCheckpointInstance->response_fd,
 		&res_lib_ckpt_checkpointstatusget,
 		sizeof (struct res_lib_ckpt_checkpointstatusget),
 		MSG_WAITALL | MSG_NOSIGNAL);
@@ -777,7 +765,7 @@
 		goto error_exit;
 	}
 
-	pthread_mutex_unlock (&ckptCheckpointInstance->mutex);
+	pthread_mutex_unlock (&ckptCheckpointInstance->response_mutex);
 
 	memcpy (checkpointStatus,
 		&res_lib_ckpt_checkpointstatusget.checkpointDescriptor,
@@ -824,9 +812,9 @@
 	memcpy (&req_lib_ckpt_sectioncreate.checkpointName,
 		&ckptCheckpointInstance->checkpointName, sizeof (SaNameT));
 
-	pthread_mutex_lock (&ckptCheckpointInstance->mutex);
+	pthread_mutex_lock (&ckptCheckpointInstance->response_mutex);
 
-	error = saSendRetry (ckptCheckpointInstance->fd, &req_lib_ckpt_sectioncreate,
+	error = saSendRetry (ckptCheckpointInstance->response_fd, &req_lib_ckpt_sectioncreate,
 		sizeof (struct req_lib_ckpt_sectioncreate), MSG_NOSIGNAL);
 	if (error != SA_AIS_OK) {
 		goto error_exit;
@@ -835,24 +823,24 @@
 	/*
 	 * Write section identifier to server
 	 */
-	error = saSendRetry (ckptCheckpointInstance->fd, sectionCreationAttributes->sectionId->id,
+	error = saSendRetry (ckptCheckpointInstance->response_fd, sectionCreationAttributes->sectionId->id,
 		sectionCreationAttributes->sectionId->idLen, MSG_NOSIGNAL);
 	if (error != SA_AIS_OK) {
 		goto error_exit;
 	}
 
-	error = saSendRetry (ckptCheckpointInstance->fd, initialData,
+	error = saSendRetry (ckptCheckpointInstance->response_fd, initialData,
 		initialDataSize, MSG_NOSIGNAL);
 	if (error != SA_AIS_OK) {
 		goto error_exit;
 	}
 
-	error = saRecvRetry (ckptCheckpointInstance->fd,
+	error = saRecvRetry (ckptCheckpointInstance->response_fd,
 		&res_lib_ckpt_sectioncreate,
 		sizeof (struct res_lib_ckpt_sectioncreate),
 		MSG_WAITALL | MSG_NOSIGNAL);
 
-	pthread_mutex_unlock (&ckptCheckpointInstance->mutex);
+	pthread_mutex_unlock (&ckptCheckpointInstance->response_mutex);
 
 error_exit:
 	saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle);
@@ -877,7 +865,7 @@
 		return (error);
 	}
 
-	pthread_mutex_lock (&ckptCheckpointInstance->mutex);
+	pthread_mutex_lock (&ckptCheckpointInstance->response_mutex);
 
 	req_lib_ckpt_sectiondelete.header.size = sizeof (struct req_lib_ckpt_sectiondelete) + sectionId->idLen; 
 	req_lib_ckpt_sectiondelete.header.id = MESSAGE_REQ_CKPT_CHECKPOINT_SECTIONDELETE;
@@ -886,7 +874,7 @@
 	memcpy (&req_lib_ckpt_sectiondelete.checkpointName,
 		&ckptCheckpointInstance->checkpointName, sizeof (SaNameT));
 
-	error = saSendRetry (ckptCheckpointInstance->fd, &req_lib_ckpt_sectiondelete,
+	error = saSendRetry (ckptCheckpointInstance->response_fd, &req_lib_ckpt_sectiondelete,
 		sizeof (struct req_lib_ckpt_sectiondelete), MSG_NOSIGNAL);
 	if (error != SA_AIS_OK) {
 		goto error_exit;
@@ -895,17 +883,17 @@
 	/*
 	 * Write section identifier to server
 	 */
-	error = saSendRetry (ckptCheckpointInstance->fd, sectionId->id,
+	error = saSendRetry (ckptCheckpointInstance->response_fd, sectionId->id,
 		sectionId->idLen, MSG_NOSIGNAL);
 	if (error != SA_AIS_OK) {
 		goto error_exit;
 	}
-	error = saRecvRetry (ckptCheckpointInstance->fd,
+	error = saRecvRetry (ckptCheckpointInstance->response_fd,
 		&res_lib_ckpt_sectiondelete,
 		sizeof (struct res_lib_ckpt_sectiondelete),
 		MSG_WAITALL | MSG_NOSIGNAL);
 
-	pthread_mutex_unlock (&ckptCheckpointInstance->mutex);
+	pthread_mutex_unlock (&ckptCheckpointInstance->response_mutex);
 
 error_exit:
 	saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle);
@@ -937,9 +925,9 @@
 	memcpy (&req_lib_ckpt_sectionexpirationtimeset.checkpointName,
 		&ckptCheckpointInstance->checkpointName, sizeof (SaNameT));
 
-	pthread_mutex_lock (&ckptCheckpointInstance->mutex);
+	pthread_mutex_lock (&ckptCheckpointInstance->response_mutex);
 
-	error = saSendRetry (ckptCheckpointInstance->fd, &req_lib_ckpt_sectionexpirationtimeset,
+	error = saSendRetry (ckptCheckpointInstance->response_fd, &req_lib_ckpt_sectionexpirationtimeset,
 		sizeof (struct req_lib_ckpt_sectionexpirationtimeset), MSG_NOSIGNAL);
 	if (error != SA_AIS_OK) {
 		goto error_exit;
@@ -949,19 +937,19 @@
 	 * Write section identifier to server
 	 */
 	if (sectionId->idLen) {
-		error = saSendRetry (ckptCheckpointInstance->fd, sectionId->id,
+		error = saSendRetry (ckptCheckpointInstance->response_fd, sectionId->id,
 			sectionId->idLen, MSG_NOSIGNAL);
 		if (error != SA_AIS_OK) {
 			goto error_exit;
 		}
 	}
 
-	error = saRecvRetry (ckptCheckpointInstance->fd,
+	error = saRecvRetry (ckptCheckpointInstance->response_fd,
 		&res_lib_ckpt_sectionexpirationtimeset,
 		sizeof (struct res_lib_ckpt_sectionexpirationtimeset),
 		MSG_WAITALL | MSG_NOSIGNAL);
 
-	pthread_mutex_unlock (&ckptCheckpointInstance->mutex);
+	pthread_mutex_unlock (&ckptCheckpointInstance->response_mutex);
 
 error_exit:
 	saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle);
@@ -1000,11 +988,11 @@
 		goto error_destroy;
 	}
 
-	ckptSectionIterationInstance->fd = ckptCheckpointInstance->fd;
+	ckptSectionIterationInstance->response_fd = ckptCheckpointInstance->response_fd;
 
 	ckptSectionIterationInstance->checkpointHandle = checkpointHandle;
 
-	pthread_mutex_init (&ckptSectionIterationInstance->mutex, NULL);
+	pthread_mutex_init (&ckptSectionIterationInstance->response_mutex, NULL);
 
 	/*
 	 * Setup section id list for iterator next
@@ -1014,12 +1002,6 @@
 	ckptSectionIterationInstance->maxSectionIdSize =
 		ckptCheckpointInstance->maxSectionIdSize;
 
-	error = saServiceConnect (&ckptSectionIterationInstance->fd,	
-		MESSAGE_REQ_CKPT_INIT);
-	if (error != SA_AIS_OK) {
-		goto error_put_destroy;
-	}
-
 	req_lib_ckpt_sectioniteratorinitialize.header.size = sizeof (struct req_lib_ckpt_sectioniteratorinitialize); 
 	req_lib_ckpt_sectioniteratorinitialize.header.id = MESSAGE_REQ_CKPT_SECTIONITERATOR_SECTIONITERATORINITIALIZE;
 	req_lib_ckpt_sectioniteratorinitialize.sectionsChosen = sectionsChosen;
@@ -1027,9 +1009,9 @@
 	memcpy (&req_lib_ckpt_sectioniteratorinitialize.checkpointName,
 		&ckptCheckpointInstance->checkpointName, sizeof (SaNameT));
 
-	pthread_mutex_lock (&ckptSectionIterationInstance->mutex);
+	pthread_mutex_lock (&ckptSectionIterationInstance->response_mutex);
 
-	error = saSendRetry (ckptSectionIterationInstance->fd,
+	error = saSendRetry (ckptSectionIterationInstance->response_fd,
 		&req_lib_ckpt_sectioniteratorinitialize,
 		sizeof (struct req_lib_ckpt_sectioniteratorinitialize),
 		MSG_NOSIGNAL);
@@ -1038,12 +1020,12 @@
 		goto error_put_destroy;
 	}
 
-	error = saRecvRetry (ckptSectionIterationInstance->fd,
+	error = saRecvRetry (ckptSectionIterationInstance->response_fd,
 		&res_lib_ckpt_sectioniteratorinitialize,
 		sizeof (struct res_lib_ckpt_sectioniteratorinitialize),
 		MSG_WAITALL | MSG_NOSIGNAL);
 
-	pthread_mutex_unlock (&ckptSectionIterationInstance->mutex);
+	pthread_mutex_unlock (&ckptSectionIterationInstance->response_mutex);
 
 	saHandleInstancePut (&ckptSectionIterationHandleDatabase, *sectionIterationHandle);
 
@@ -1093,9 +1075,9 @@
 	req_lib_ckpt_sectioniteratornext.header.size = sizeof (struct req_lib_ckpt_sectioniteratornext); 
 	req_lib_ckpt_sectioniteratornext.header.id = MESSAGE_REQ_CKPT_SECTIONITERATOR_SECTIONITERATORNEXT;
 
-	pthread_mutex_lock (&ckptSectionIterationInstance->mutex);
+	pthread_mutex_lock (&ckptSectionIterationInstance->response_mutex);
 
-	error = saSendRetry (ckptSectionIterationInstance->fd,
+	error = saSendRetry (ckptSectionIterationInstance->response_fd,
 		&req_lib_ckpt_sectioniteratornext,
 		sizeof (struct req_lib_ckpt_sectioniteratornext), MSG_NOSIGNAL);
 
@@ -1103,7 +1085,7 @@
 		goto error_put;
 	}
 
-	error = saRecvRetry (ckptSectionIterationInstance->fd, &res_lib_ckpt_sectioniteratornext,
+	error = saRecvRetry (ckptSectionIterationInstance->response_fd, &res_lib_ckpt_sectioniteratornext,
 		sizeof (struct res_lib_ckpt_sectioniteratornext), MSG_WAITALL | MSG_NOSIGNAL);
 	if (error != SA_AIS_OK) {
 		goto error_put;
@@ -1116,7 +1098,7 @@
 	sectionDescriptor->sectionId.id = &iteratorSectionIdListEntry->data[0];
 	
 	if ((res_lib_ckpt_sectioniteratornext.header.size - sizeof (struct res_lib_ckpt_sectioniteratornext)) > 0) {
-		error = saRecvRetry (ckptSectionIterationInstance->fd,
+		error = saRecvRetry (ckptSectionIterationInstance->response_fd,
 			sectionDescriptor->sectionId.id,
 			res_lib_ckpt_sectioniteratornext.header.size -
 				sizeof (struct res_lib_ckpt_sectioniteratornext),
@@ -1132,7 +1114,7 @@
 	}
 
 error_put:
-	pthread_mutex_unlock (&ckptSectionIterationInstance->mutex);
+	pthread_mutex_unlock (&ckptSectionIterationInstance->response_mutex);
 error_put_nounlock:
 	saHandleInstancePut (&ckptSectionIterationHandleDatabase, sectionIterationHandle);
 error_exit:
@@ -1209,7 +1191,7 @@
 	}
 	req_lib_ckpt_sectionwrite.header.id = MESSAGE_REQ_CKPT_CHECKPOINT_SECTIONWRITE;
 
-	pthread_mutex_lock (&ckptCheckpointInstance->mutex);
+	pthread_mutex_lock (&ckptCheckpointInstance->response_mutex);
 
 	for (i = 0; i < numberOfElements; i++) {
 
@@ -1231,7 +1213,7 @@
 		iov[2].iov_base = ioVector[i].dataBuffer;
 		iov[2].iov_len = ioVector[i].dataSize;
 
-		error = saSendMsgRetry (ckptCheckpointInstance->fd,
+		error = saSendMsgRetry (ckptCheckpointInstance->response_fd,
 			iov,
 			3);
 		if (error != SA_AIS_OK) {
@@ -1241,7 +1223,7 @@
 		/*
 		 * Receive response
 		 */
-		error = saRecvRetry (ckptCheckpointInstance->fd, &res_lib_ckpt_sectionwrite,
+		error = saRecvRetry (ckptCheckpointInstance->response_fd, &res_lib_ckpt_sectionwrite,
 			sizeof (struct res_lib_ckpt_sectionwrite), MSG_WAITALL | MSG_NOSIGNAL);
 		if (error != SA_AIS_OK) {
 			goto error_exit;
@@ -1263,7 +1245,7 @@
 	}
 
 error_exit:
-	pthread_mutex_unlock (&ckptCheckpointInstance->mutex);
+	pthread_mutex_unlock (&ckptCheckpointInstance->response_mutex);
 
 error_put:
 	saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle);
@@ -1300,33 +1282,33 @@
 	memcpy (&req_lib_ckpt_sectionoverwrite.checkpointName,
 		&ckptCheckpointInstance->checkpointName, sizeof (SaNameT));
 	
-	pthread_mutex_lock (&ckptCheckpointInstance->mutex);
+	pthread_mutex_lock (&ckptCheckpointInstance->response_mutex);
 
-	error = saSendRetry (ckptCheckpointInstance->fd, &req_lib_ckpt_sectionoverwrite,
+	error = saSendRetry (ckptCheckpointInstance->response_fd, &req_lib_ckpt_sectionoverwrite,
 		sizeof (struct req_lib_ckpt_sectionoverwrite), MSG_NOSIGNAL);
 	if (error != SA_AIS_OK) {
 		goto error_exit;
 	}
 
 	if (sectionId->idLen) {
-		error = saSendRetry (ckptCheckpointInstance->fd, sectionId->id,
+		error = saSendRetry (ckptCheckpointInstance->response_fd, sectionId->id,
 			sectionId->idLen, MSG_NOSIGNAL);
 		if (error != SA_AIS_OK) {
 			goto error_exit;
 		}
 	}
-	error = saSendRetry (ckptCheckpointInstance->fd, dataBuffer, dataSize, MSG_NOSIGNAL);
+	error = saSendRetry (ckptCheckpointInstance->response_fd, dataBuffer, dataSize, MSG_NOSIGNAL);
 	if (error != SA_AIS_OK) {
 		goto error_exit;
 	}
 
-	error = saRecvRetry (ckptCheckpointInstance->fd,
+	error = saRecvRetry (ckptCheckpointInstance->response_fd,
 		&res_lib_ckpt_sectionoverwrite,
 		sizeof (struct res_lib_ckpt_sectionoverwrite),
 		MSG_WAITALL | MSG_NOSIGNAL);
 
 error_exit:
-	pthread_mutex_unlock (&ckptCheckpointInstance->mutex);
+	pthread_mutex_unlock (&ckptCheckpointInstance->response_mutex);
 
 	saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle);
 
@@ -1360,7 +1342,7 @@
 
 	req_lib_ckpt_sectionread.header.id = MESSAGE_REQ_CKPT_CHECKPOINT_SECTIONREAD;
 
-	pthread_mutex_lock (&ckptCheckpointInstance->mutex);
+	pthread_mutex_lock (&ckptCheckpointInstance->response_mutex);
 
 	for (i = 0; i < numberOfElements; i++) {
 		req_lib_ckpt_sectionread.header.size = sizeof (struct req_lib_ckpt_sectionread) +
@@ -1378,14 +1360,14 @@
 		iov[1].iov_base = ioVector[i].sectionId.id;
 		iov[1].iov_len = ioVector[i].sectionId.idLen;
 
-		error = saSendMsgRetry (ckptCheckpointInstance->fd,
+		error = saSendMsgRetry (ckptCheckpointInstance->response_fd,
 			iov,
 			2);
 
 		/*
 		 * Receive response header
 		 */
-		error = saRecvRetry (ckptCheckpointInstance->fd, &res_lib_ckpt_sectionread,
+		error = saRecvRetry (ckptCheckpointInstance->response_fd, &res_lib_ckpt_sectionread,
 			sizeof (struct res_lib_ckpt_sectionread), MSG_WAITALL | MSG_NOSIGNAL);
 		if (error != SA_AIS_OK) {
 				goto error_exit;
@@ -1397,7 +1379,7 @@
 		 * Receive checkpoint section data
 		 */
 		if (dataLength > 0) {
-			error = saRecvRetry (ckptCheckpointInstance->fd, ioVector[i].dataBuffer,
+			error = saRecvRetry (ckptCheckpointInstance->response_fd, ioVector[i].dataBuffer,
 				dataLength, MSG_WAITALL | MSG_NOSIGNAL);
 			if (error != SA_AIS_OK) {
 					goto error_exit;
@@ -1417,7 +1399,7 @@
 	}
 
 error_exit:
-	pthread_mutex_unlock (&ckptCheckpointInstance->mutex);
+	pthread_mutex_unlock (&ckptCheckpointInstance->response_mutex);
 
 	saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle);
 
@@ -1443,22 +1425,22 @@
 	req_lib_ckpt_checkpointsynchronize.header.size = sizeof (struct req_lib_ckpt_checkpointsynchronize); 
 	req_lib_ckpt_checkpointsynchronize.header.id = MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTSYNCHRONIZE;
 
-	pthread_mutex_lock (&ckptCheckpointInstance->mutex);
+	pthread_mutex_lock (&ckptCheckpointInstance->response_mutex);
 
-	error = saSendRetry (ckptCheckpointInstance->fd, &req_lib_ckpt_checkpointsynchronize,
+	error = saSendRetry (ckptCheckpointInstance->response_fd, &req_lib_ckpt_checkpointsynchronize,
 		sizeof (struct req_lib_ckpt_checkpointsynchronize), MSG_NOSIGNAL);
 
 	if (error != SA_AIS_OK) {
 		goto error_exit;
 	}
 
-	error = saRecvRetry (ckptCheckpointInstance->fd,
+	error = saRecvRetry (ckptCheckpointInstance->response_fd,
 		&res_lib_ckpt_checkpointsynchronize,
 		sizeof (struct res_lib_ckpt_checkpointsynchronize),
 		MSG_WAITALL | MSG_NOSIGNAL);
 
 error_exit:
-	pthread_mutex_unlock (&ckptCheckpointInstance->mutex);
+	pthread_mutex_unlock (&ckptCheckpointInstance->response_mutex);
 
 	saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle);
 
@@ -1492,16 +1474,16 @@
 	req_lib_ckpt_checkpointsynchronizeasync.header.id = MESSAGE_REQ_CKPT_CHECKPOINT_CHECKPOINTSYNCHRONIZEASYNC;
 	req_lib_ckpt_checkpointsynchronizeasync.invocation = invocation;
 
-	pthread_mutex_lock (&ckptCheckpointInstance->mutex);
+	pthread_mutex_lock (&ckptCheckpointInstance->response_mutex);
 
-	pthread_mutex_lock (&ckptInstance->mutex);
+	pthread_mutex_lock (&ckptInstance->response_mutex);
 
-	error = saSendRetry (ckptInstance->fd, &req_lib_ckpt_checkpointsynchronizeasync,
+	error = saSendRetry (ckptInstance->response_fd, &req_lib_ckpt_checkpointsynchronizeasync,
 		sizeof (struct req_lib_ckpt_checkpointsynchronizeasync), MSG_NOSIGNAL);
 
-	pthread_mutex_unlock (&ckptInstance->mutex);
+	pthread_mutex_unlock (&ckptInstance->response_mutex);
 
-	pthread_mutex_unlock (&ckptCheckpointInstance->mutex);
+	pthread_mutex_unlock (&ckptCheckpointInstance->response_mutex);
 
 	saHandleInstancePut (&checkpointHandleDatabase, *checkpointHandle);
 
Binary files d188.fixed.orig/lib/ckpt.o and d188.fixed/lib/ckpt.o differ
diff -uNr d188.fixed.orig/lib/clm.c d188.fixed/lib/clm.c
--- d188.fixed.orig/lib/clm.c	2005-02-18 12:23:11.000000000 -0700
+++ d188.fixed/lib/clm.c	2005-02-16 18:04:03.000000000 -0700
@@ -53,16 +53,17 @@
 
 struct res_overlay {
 	struct res_header header;
-	char data[128000];
+	char data[512000];
 };
 
 struct clmInstance {
-	int fd;
-	struct queue inq;
+	int response_fd;
+	int dispatch_fd;
 	SaClmCallbacksT callbacks;
 	int finalize;
 	SaClmClusterNotificationBufferT notificationBuffer;
-	pthread_mutex_t mutex;
+	pthread_mutex_t response_mutex;
+	pthread_mutex_t dispatch_mutex;
 };
 
 static void clmHandleInstanceDestructor (void *);
@@ -91,9 +92,13 @@
 {
 	struct clmInstance *clmInstance = (struct clmInstance *)instance;
 
-	if (clmInstance->fd != -1) {
-		shutdown (clmInstance->fd, 0);
-		close (clmInstance->fd);
+	if (clmInstance->response_fd != -1) {
+		shutdown (clmInstance->response_fd, 0);
+		close (clmInstance->response_fd);
+	}
+	if (clmInstance->dispatch_fd != -1) {
+		shutdown (clmInstance->dispatch_fd, 0);
+		close (clmInstance->dispatch_fd);
 	}
 }
 
@@ -124,25 +129,21 @@
 		goto error_destroy;
 	}
 
-	clmInstance->fd = -1;
+	clmInstance->response_fd = -1;
 
-	/*
-	 * An inq is needed to store async messages while waiting for a
-	 * sync response
-	 */
-	error = saQueueInit (&clmInstance->inq, 512, sizeof (void *));
-	if (error != SA_OK) {
-		goto error_put_destroy;
-	}
+	clmInstance->dispatch_fd = -1;
 
-	error = saServiceConnect (&clmInstance->fd, MESSAGE_REQ_CLM_INIT);
+	error = saServiceConnectTwo (&clmInstance->response_fd,
+		&clmInstance->dispatch_fd, CLM_SERVICE);
 	if (error != SA_OK) {
 		goto error_put_destroy;
 	}
 
 	memcpy (&clmInstance->callbacks, clmCallbacks, sizeof (SaClmCallbacksT));
 
-	pthread_mutex_init (&clmInstance->mutex, NULL);
+	pthread_mutex_init (&clmInstance->response_mutex, NULL);
+
+	pthread_mutex_init (&clmInstance->dispatch_mutex, NULL);
 
 	clmInstance->notificationBuffer.notification = 0;
 
@@ -172,7 +173,7 @@
 		return (error);
 	}
 
-	*selectionObject = clmInstance->fd;
+	*selectionObject = clmInstance->dispatch_fd;
 
 	saHandleInstancePut (&clmHandleDatabase, clmHandle);
 	return (SA_OK);
@@ -188,15 +189,11 @@
 	SaAisErrorT error;
 	int cont = 1; /* always continue do loop except when set to 0 */
 	int dispatch_avail;
-	int poll_fd;
 	struct clmInstance *clmInstance;
 	struct res_clm_trackcallback *res_clm_trackcallback;
 	struct res_clm_nodegetcallback *res_clm_nodegetcallback;
 	SaClmCallbacksT callbacks;
 	struct res_overlay dispatch_data;
-	int empty;
-	struct res_header **queue_msg;
-	struct res_header *msg;
 	SaClmClusterNotificationBufferT notificationBuffer;
 	int copy_items;
 
@@ -215,19 +212,17 @@
 	}
 
 	do {
-		poll_fd = clmInstance->fd;
-
-		ufds.fd = poll_fd;
+		ufds.fd = clmInstance->dispatch_fd;
 		ufds.events = POLLIN;
 		ufds.revents = 0;
 
+		pthread_mutex_lock (&clmInstance->dispatch_mutex);
+
 		error = saPollRetry (&ufds, 1, timeout);
 		if (error != SA_OK) {
-			goto error_put;
+			goto error_unlock;
 		}
 
-		pthread_mutex_lock (&clmInstance->mutex);
-
 		/*
 		 * Handle has been finalized in another thread
 		 */
@@ -238,42 +233,33 @@
 
 		dispatch_avail = ufds.revents & POLLIN;
 		if (dispatch_avail == 0 && dispatchFlags == SA_DISPATCH_ALL) {
-			pthread_mutex_unlock (&clmInstance->mutex);
+			pthread_mutex_unlock (&clmInstance->dispatch_mutex);
 			break; /* exit do while cont is 1 loop */
 		} else
 		if (dispatch_avail == 0) {
-			pthread_mutex_unlock (&clmInstance->mutex);
+			pthread_mutex_unlock (&clmInstance->dispatch_mutex);
 			continue; /* next poll */
 		}
 
-		saQueueIsEmpty(&clmInstance->inq, &empty);
-		if (empty == 0) {
-			/*
-			 * Queue is not empty, read data from queue
-			 */
-			saQueueItemGet (&clmInstance->inq, (void *)&queue_msg);
-			msg = *queue_msg;
-			memcpy (&dispatch_data, msg, msg->size);
-			saQueueItemRemove (&clmInstance->inq);
-			free (msg);
-		} else {
-			/*
-			 * Queue empty, read response from socket
-			 */
-			error = saRecvRetry (clmInstance->fd, &dispatch_data.header,
+		if (ufds.revents & POLLIN) {
+			error = saRecvRetry (clmInstance->dispatch_fd, &dispatch_data.header,
 				sizeof (struct res_header), MSG_WAITALL | MSG_NOSIGNAL);
 			if (error != SA_OK) {
 				goto error_unlock;
 			}
 			if (dispatch_data.header.size > sizeof (struct res_header)) {
-				error = saRecvRetry (clmInstance->fd, &dispatch_data.data,
+				error = saRecvRetry (clmInstance->dispatch_fd, &dispatch_data.data,
 					dispatch_data.header.size - sizeof (struct res_header),
 					MSG_WAITALL | MSG_NOSIGNAL);
 				if (error != SA_OK) {
 					goto error_unlock;
 				}
 			}
+		} else {
+			pthread_mutex_unlock (&clmInstance->dispatch_mutex);
+			continue;
 		}
+			
 		/*
 		 * Make copy of callbacks, message data, unlock instance, and call callback
 		 * A risk of this dispatch method is that the callback routines may
@@ -283,7 +269,7 @@
 		memcpy (&notificationBuffer, &clmInstance->notificationBuffer,
 			sizeof (SaClmClusterNotificationBufferT));
 
-		pthread_mutex_unlock (&clmInstance->mutex);
+		pthread_mutex_unlock (&clmInstance->dispatch_mutex);
 
 		/*
 		 * Dispatch incoming message
@@ -354,11 +340,11 @@
 		}
 	} while (cont);
 
+	goto error_put;
 error_unlock:
-	pthread_mutex_unlock (&clmInstance->mutex);
+	pthread_mutex_unlock (&clmInstance->dispatch_mutex);
 error_put:
 	saHandleInstancePut (&clmHandleDatabase, clmHandle);
-error_nounlock:
 	return (error);
 }
 
@@ -375,22 +361,23 @@
 		return (error);
 	}
 
-       pthread_mutex_lock (&clmInstance->mutex);
+       pthread_mutex_lock (&clmInstance->dispatch_mutex);
+       pthread_mutex_lock (&clmInstance->response_mutex);
 
 	/*
 	 * Another thread has already started finalizing
 	 */
 	if (clmInstance->finalize) {
-		pthread_mutex_unlock (&clmInstance->mutex);
+		pthread_mutex_unlock (&clmInstance->dispatch_mutex);
+		pthread_mutex_unlock (&clmInstance->response_mutex);
 		saHandleInstancePut (&clmHandleDatabase, clmHandle);
 		return (SA_ERR_BAD_HANDLE);
 	}
 
 	clmInstance->finalize = 1;
 
-	saActivatePoll (clmInstance->fd);
-
-	pthread_mutex_unlock (&clmInstance->mutex);
+	pthread_mutex_unlock (&clmInstance->dispatch_mutex);
+	pthread_mutex_unlock (&clmInstance->response_mutex);
 
 	saHandleDestroy (&clmHandleDatabase, clmHandle);
 
@@ -438,21 +425,23 @@
 		return (error);
 	}
 
-	pthread_mutex_lock (&clmInstance->mutex);
+	pthread_mutex_lock (&clmInstance->response_mutex);
 
 	if (clmInstance->callbacks.saClmClusterTrackCallback == 0) {
 		error = SA_AIS_ERR_INIT;
 		goto error_exit;
 	}
 
-	error = saSendRetry (clmInstance->fd, &req_clustertrack,
+	error = saSendRetry (clmInstance->response_fd, &req_clustertrack,
 		sizeof (struct req_clm_clustertrack), MSG_NOSIGNAL);
 
 	memcpy (&clmInstance->notificationBuffer, notificationBuffer,
 		sizeof (SaClmClusterNotificationBufferT));
 
+// TODO get response packet with saRecvRetry, but need to implement that 
+// in executive service
 error_exit:
-	pthread_mutex_unlock (&clmInstance->mutex);
+	pthread_mutex_unlock (&clmInstance->response_mutex);
 
 	saHandleInstancePut (&clmHandleDatabase, clmHandle);
 
@@ -476,14 +465,16 @@
 		return (error);
 	}
 
-	pthread_mutex_lock (&clmInstance->mutex);
+	pthread_mutex_lock (&clmInstance->response_mutex);
 
-	error = saSendRetry (clmInstance->fd, &req_trackstop,
+	error = saSendRetry (clmInstance->response_fd, &req_trackstop,
 		sizeof (struct req_clm_trackstop), MSG_NOSIGNAL);
 
 	clmInstance->notificationBuffer.notification = 0;
 
-	pthread_mutex_unlock (&clmInstance->mutex);
+	pthread_mutex_unlock (&clmInstance->response_mutex);
+	// TODO what about getting response from executive?  The
+	// executive should send a response
 
 	saHandleInstancePut (&clmHandleDatabase, clmHandle);
 
@@ -508,7 +499,7 @@
 		return (error);
 	}
 
-	pthread_mutex_lock (&clmInstance->mutex);
+	pthread_mutex_lock (&clmInstance->response_mutex);
 
 	/*
 	 * Send request message
@@ -516,15 +507,9 @@
 	req_clm_nodeget.header.size = sizeof (struct req_clm_nodeget);
 	req_clm_nodeget.header.id = MESSAGE_REQ_CLM_NODEGET;
 	req_clm_nodeget.nodeId = nodeId;
-	error = saSendRetry (clmInstance->fd, &req_clm_nodeget,
-		sizeof (struct req_clm_nodeget), MSG_NOSIGNAL);
-	if (error != SA_OK) {
-		goto error_exit;
-	}
 
-	error = saRecvRetry (clmInstance->fd, &res_clm_nodeget,
-		sizeof (struct res_clm_nodeget),
-		MSG_WAITALL | MSG_NOSIGNAL);
+	error = saSendReceiveReply (clmInstance->response_fd, &req_clm_nodeget,
+		sizeof (struct req_clm_nodeget), &res_clm_nodeget, sizeof (res_clm_nodeget));
 	if (error != SA_OK) {
 		goto error_exit;
 	}
@@ -535,7 +520,7 @@
 		sizeof (SaClmClusterNodeT));
 
 error_exit:
-	pthread_mutex_unlock (&clmInstance->mutex);
+	pthread_mutex_unlock (&clmInstance->response_mutex);
 
 	saHandleInstancePut (&clmHandleDatabase, clmHandle);
 
@@ -565,15 +550,11 @@
 		return (error);
 	}
 
-	pthread_mutex_lock (&clmInstance->mutex);
-
-	error = saSendRetry (clmInstance->fd, &req_clm_nodegetasync,
-		sizeof (struct req_clm_nodegetasync), MSG_NOSIGNAL);
-
-	pthread_mutex_unlock (&clmInstance->mutex);
+	pthread_mutex_lock (&clmInstance->response_mutex);
 
-	error = saRecvQueue (clmInstance->fd, &res_clm_nodegetasync,
-		&clmInstance->inq, MESSAGE_RES_CLM_NODEGETASYNC);
+	error = saSendReceiveReply (clmInstance->response_fd, &req_clm_nodegetasync,
+		sizeof (struct req_clm_nodegetasync),
+		&res_clm_nodegetasync, sizeof (struct res_clm_nodegetasync));
 	if (error != SA_OK) {
 		goto error_exit;
 	}
Binary files d188.fixed.orig/lib/clm.o and d188.fixed/lib/clm.o differ
diff -uNr d188.fixed.orig/lib/evs.c d188.fixed/lib/evs.c
--- d188.fixed.orig/lib/evs.c	2005-02-18 12:23:11.000000000 -0700
+++ d188.fixed/lib/evs.c	2005-02-16 17:58:09.000000000 -0700
@@ -1,4 +1,6 @@
 /*
+ * vi: set autoindent tabstop=4 shiftwidth=4 :
+
  * Copyright (c) 2004 MontaVista Software, Inc.
  *
  * All rights reserved.
@@ -41,6 +43,7 @@
 #include <pthread.h>
 #include <sys/types.h>
 #include <sys/socket.h>
+#include <errno.h>
 #include "util.h"
 
 #include "../include/ais_msg.h"
@@ -48,12 +51,12 @@
 #include "../include/evs.h"
 
 struct evs_inst {
-	int fd;
+	int response_fd;
+	int dispatch_fd;
 	int finalize;
 	evs_callbacks_t callbacks;
-	struct queue inq;
-	char dispatch_buffer[512000];
-	pthread_mutex_t mutex;
+	pthread_mutex_t response_mutex;
+	pthread_mutex_t dispatch_mutex;
 };
 
 static void evs_instance_destructor (void *instance);
@@ -71,31 +74,17 @@
 static void evs_instance_destructor (void *instance)
 {
     struct evs_inst *evs_inst = instance;
-    void **msg;
-    int empty;
-
-    /*
-     * Empty out the queue if there are any pending messages
-     */
-    while ((saQueueIsEmpty(&evs_inst->inq, &empty) == SA_OK) && !empty) {
-        saQueueItemGet(&evs_inst->inq, (void *)&msg);
-        saQueueItemRemove(&evs_inst->inq);
-        free(*msg);
-    }
-
-    /*
-     * clean up the queue itself
-     */
-    if (evs_inst->inq.items) {
-            free(evs_inst->inq.items);
-    }
 
     /*
      * Disconnect from the server
      */
-    if (evs_inst->fd != -1) {
-        shutdown(evs_inst->fd, 0);
-        close(evs_inst->fd);
+    if (evs_inst->response_fd != -1) {
+        shutdown(evs_inst->response_fd, 0);
+        close(evs_inst->response_fd);
+    }
+    if (evs_inst->dispatch_fd != -1) {
+        shutdown(evs_inst->dispatch_fd, 0);
+        close(evs_inst->dispatch_fd);
     }
 }
 
@@ -117,23 +106,18 @@
 		goto error_destroy;
 	}
 
-	/*
-	 * An inq is needed to store async messages while waiting for a
-	 * sync response
-	 */
-	error = saQueueInit (&evs_inst->inq, 128, sizeof (void *));
+	error = saServiceConnectTwo (&evs_inst->response_fd,
+		&evs_inst->dispatch_fd,
+		EVS_SERVICE);
 	if (error != SA_OK) {
 		goto error_put_destroy;
 	}
 
-	error = saServiceConnect (&evs_inst->fd, MESSAGE_REQ_EVS_INIT);
-	if (error != SA_OK) {
-		goto error_put_destroy;
-	}
-	
 	memcpy (&evs_inst->callbacks, callbacks, sizeof (evs_callbacks_t));
 
-	pthread_mutex_init (&evs_inst->mutex, NULL);
+	pthread_mutex_init (&evs_inst->response_mutex, NULL);
+
+	pthread_mutex_init (&evs_inst->dispatch_mutex, NULL);
 
 	saHandleInstancePut (&evs_handle_t_db, *handle);
 
@@ -157,20 +141,22 @@
 	if (error != SA_OK) {
 		return (error);
 	}
+
+// TODO is the locking right here
+	pthread_mutex_lock (&evs_inst->response_mutex);
+
 	/*
 	 * Another thread has already started finalizing
 	 */
 	if (evs_inst->finalize) {
-		pthread_mutex_unlock (&evs_inst->mutex);
+		pthread_mutex_unlock (&evs_inst->response_mutex);
 		saHandleInstancePut (&evs_handle_t_db, *handle);
 		return (EVS_ERR_BAD_HANDLE);
 	}
 
 	evs_inst->finalize = 1;
 
-	saActivatePoll (evs_inst->fd);
-
-	pthread_mutex_unlock (&evs_inst->mutex);
+	pthread_mutex_unlock (&evs_inst->response_mutex);
 
 	saHandleInstancePut (&evs_handle_t_db, *handle);
 
@@ -191,16 +177,16 @@
 		return (error);
 	}
 
-	*fd = evs_inst->fd; 
+	*fd = evs_inst->dispatch_fd; 
 
 	saHandleInstancePut (&evs_handle_t_db, *handle);
 
 	return (SA_OK);
 }
 
-struct message_overlay {
+struct res_overlay {
 	struct res_header header;
-	char data[4096];
+	char data[512000];
 };
 
 evs_error_t evs_dispatch (
@@ -212,15 +198,11 @@
 	SaErrorT error;
 	int cont = 1; /* always continue do loop except when set to 0 */
 	int dispatch_avail;
-	int poll_fd;
 	struct evs_inst *evs_inst;
 	struct res_evs_confchg_callback *res_evs_confchg_callback;
 	struct res_evs_deliver_callback *res_evs_deliver_callback;
 	evs_callbacks_t callbacks;
-	struct message_overlay *dispatch_data;
-	int empty;
-	struct res_header **queue_msg;
-	struct res_header *msg = NULL;
+	struct res_overlay dispatch_data;
 	int ignore_dispatch = 0;
 
 	error = saHandleInstanceGet (&evs_handle_t_db, *handle, (void *)&evs_inst);
@@ -237,76 +219,65 @@
 	}
 
 	do {
-		poll_fd = evs_inst->fd;
-
-		ufds.fd = poll_fd;
+		ufds.fd = evs_inst->dispatch_fd;
 		ufds.events = POLLIN;
 		ufds.revents = 0;
 
-		pthread_mutex_lock (&evs_inst->mutex);
-		saQueueIsEmpty (&evs_inst->inq, &empty);
-		if (empty == 1) {
-			pthread_mutex_unlock (&evs_inst->mutex);
+		error = saPollRetry (&ufds, 1, timeout);
+		if (error != SA_OK) {
+			goto error_nounlock;
+		}
 
-			error = saPollRetry (&ufds, 1, timeout);
-			if (error != SA_OK) {
-				goto error_nounlock;
-			}
+		pthread_mutex_lock (&evs_inst->dispatch_mutex);
 
-			pthread_mutex_lock (&evs_inst->mutex);
+		/*
+		 * Regather poll data in case ufds has changed since taking lock
+		 */
+		error = saPollRetry (&ufds, 1, 0);
+		if (error != SA_OK) {
+			goto error_nounlock;
 		}
 
 		/*
 		 * Handle has been finalized in another thread
 		 */
 		if (evs_inst->finalize == 1) {
-			error = SA_OK;
-			pthread_mutex_unlock (&evs_inst->mutex);
+			error = EVS_OK;
+			pthread_mutex_unlock (&evs_inst->dispatch_mutex);
 			goto error_unlock;
 		}
 
-		dispatch_avail = (ufds.revents & POLLIN) | (empty == 0);
+		dispatch_avail = ufds.revents & POLLIN;
 		if (dispatch_avail == 0 && dispatch_types == EVS_DISPATCH_ALL) {
-			pthread_mutex_unlock (&evs_inst->mutex);
+			pthread_mutex_unlock (&evs_inst->dispatch_mutex);
 			break; /* exit do while cont is 1 loop */
-		} else
+		} else 
 		if (dispatch_avail == 0) {
-			pthread_mutex_unlock (&evs_inst->mutex);
+			pthread_mutex_unlock (&evs_inst->dispatch_mutex);
 			continue; /* next poll */
 		}
 
-		saQueueIsEmpty (&evs_inst->inq, &empty);
-		if (empty == 0) {
+		if (ufds.revents & POLLIN) {
 			/*
-			 * Queue is not empty, read data from queue
+			 * Queue empty, read response from socket
 			 */
-			saQueueItemGet (&evs_inst->inq, (void *)&queue_msg);
-			msg = *queue_msg;
-			dispatch_data = (struct message_overlay *)msg;
-			res_evs_deliver_callback = (struct res_evs_deliver_callback *)msg;
-			res_evs_confchg_callback = (struct res_evs_confchg_callback *)msg;
-
-			saQueueItemRemove (&evs_inst->inq);
-		} else {
-			dispatch_data = (struct message_overlay *)evs_inst->dispatch_buffer;
-			res_evs_deliver_callback = (struct res_evs_deliver_callback *)dispatch_data;
-			res_evs_confchg_callback = (struct res_evs_confchg_callback *)dispatch_data;
-			/*
-			* Queue empty, read response from socket
-			*/
-			error = saRecvRetry (evs_inst->fd, &dispatch_data->header,
+			error = saRecvRetry (evs_inst->dispatch_fd, &dispatch_data.header,
 				sizeof (struct res_header), MSG_WAITALL | MSG_NOSIGNAL);
 			if (error != SA_OK) {
 				goto error_unlock;
 			}
-			if (dispatch_data->header.size > sizeof (struct res_header)) {
-				error = saRecvRetry (evs_inst->fd, &dispatch_data->data,
-					dispatch_data->header.size - sizeof (struct res_header),
+			if (dispatch_data.header.size > sizeof (struct res_header)) {
+				error = saRecvRetry (evs_inst->dispatch_fd, &dispatch_data.data,
+					dispatch_data.header.size - sizeof (struct res_header),
 					MSG_WAITALL | MSG_NOSIGNAL);
+
 				if (error != SA_OK) {
 					goto error_unlock;
 				}
 			}
+		} else {
+			pthread_mutex_unlock (&evs_inst->dispatch_mutex);
+			continue;
 		}
 
 		/*
@@ -316,16 +287,13 @@
 		*/
 		memcpy (&callbacks, &evs_inst->callbacks, sizeof (evs_callbacks_t));
 
-		pthread_mutex_unlock (&evs_inst->mutex);
+		pthread_mutex_unlock (&evs_inst->dispatch_mutex);
 		/*
 		 * Dispatch incoming message
 		 */
-		switch (dispatch_data->header.id) {
-		case MESSAGE_RES_LIB_ACTIVATEPOLL:
-			ignore_dispatch = 1;
-			break;
-
+		switch (dispatch_data.header.id) {
 		case MESSAGE_RES_EVS_DELIVER_CALLBACK:
+			res_evs_deliver_callback = (struct res_evs_deliver_callback *)&dispatch_data;
 			callbacks.evs_deliver_fn (
 				res_evs_deliver_callback->source_addr,
 				&res_evs_deliver_callback->msg,
@@ -333,6 +301,7 @@
 			break;
 
 		case MESSAGE_RES_EVS_CONFCHG_CALLBACK:
+			res_evs_confchg_callback = (struct res_evs_confchg_callback *)&dispatch_data;
 			callbacks.evs_confchg_fn (
 				res_evs_confchg_callback->member_list,
 				res_evs_confchg_callback->member_list_entries,
@@ -347,9 +316,6 @@
 			goto error_nounlock;
 			break;
 		}
-		if (empty == 0) {
-			free (msg);
-		}
 
 		/*
 		 * Determine if more messages should be processed
@@ -393,6 +359,7 @@
 	if (error != SA_OK) {
 		return (error);
 	}
+
 	req_lib_evs_join.header.size = sizeof (struct req_lib_evs_join) + 
 		(group_entries * sizeof (struct evs_group));
 	req_lib_evs_join.header.id = MESSAGE_REQ_EVS_JOIN;
@@ -403,13 +370,10 @@
 	iov[1].iov_base = groups;
 	iov[1].iov_len = (group_entries * sizeof (struct evs_group));
 	
-	error = saSendMsgRetry (evs_inst->fd, iov, 2);
-	if (error != SA_OK) {
-		goto error_exit;
-	}
+	pthread_mutex_lock (&evs_inst->response_mutex);
 
-	error = saRecvRetry (evs_inst->fd, &res_lib_evs_join,
-		sizeof (struct res_lib_evs_join), MSG_WAITALL | MSG_NOSIGNAL);
+	error = saSendMsgReceiveReply (evs_inst->response_fd, iov, 2,
+		&res_lib_evs_join, sizeof (struct res_lib_evs_join));
 	if (error != SA_OK) {
 		goto error_exit;
 	}
@@ -417,6 +381,7 @@
 	error = res_lib_evs_join.header.error;
 
 error_exit:
+	pthread_mutex_unlock (&evs_inst->response_mutex);
 	saHandleInstancePut (&evs_handle_t_db, *handle);
 
 	return (error);
@@ -437,6 +402,7 @@
 	if (error != SA_OK) {
 		return (error);
 	}
+
 	req_lib_evs_leave.header.size = sizeof (struct req_lib_evs_leave) + 
 		(group_entries * sizeof (struct evs_group));
 	req_lib_evs_leave.header.id = MESSAGE_REQ_EVS_LEAVE;
@@ -447,13 +413,10 @@
 	iov[1].iov_base = groups;
 	iov[1].iov_len = (group_entries * sizeof (struct evs_group));
 	
-	error = saSendMsgRetry (evs_inst->fd, iov, 2);
-	if (error != SA_OK) {
-		goto error_exit;
-	}
+	pthread_mutex_lock (&evs_inst->response_mutex);
 
-	error = saRecvRetry (evs_inst->fd, &res_lib_evs_leave,
-		sizeof (struct res_lib_evs_leave), MSG_WAITALL | MSG_NOSIGNAL);
+	error = saSendMsgReceiveReply (evs_inst->response_fd, iov, 2,
+		&res_lib_evs_leave, sizeof (struct res_lib_evs_leave));
 	if (error != SA_OK) {
 		goto error_exit;
 	}
@@ -461,6 +424,7 @@
 	error = res_lib_evs_leave.header.error;
 
 error_exit:
+	pthread_mutex_unlock (&evs_inst->response_mutex);
 	saHandleInstancePut (&evs_handle_t_db, *handle);
 
 	return (error);
@@ -500,13 +464,10 @@
 	iov[0].iov_len = sizeof (struct req_lib_evs_mcast_joined);
 	memcpy (&iov[1], iovec, iov_len * sizeof (struct iovec));
 	
-	error = saSendMsgRetry (evs_inst->fd, iov, 1 + iov_len);
-	if (error != SA_OK) {
-		goto error_exit;
-	}
+	pthread_mutex_lock (&evs_inst->response_mutex);
 
-	error = saRecvQueue (evs_inst->fd, &res_lib_evs_mcast_joined, &evs_inst->inq,
-		MESSAGE_RES_EVS_MCAST_JOINED);
+	error = saSendMsgReceiveReply (evs_inst->response_fd, iov, iov_len + 1,
+		&res_lib_evs_mcast_joined, sizeof (struct res_lib_evs_mcast_joined));
 	if (error != SA_OK) {
 		goto error_exit;
 	}
@@ -514,6 +475,7 @@
 	error = res_lib_evs_mcast_joined.header.error;
 
 error_exit:
+	pthread_mutex_unlock (&evs_inst->response_mutex);
 	saHandleInstancePut (&evs_handle_t_db, *handle);
 
 	return (error);
@@ -555,13 +517,10 @@
 	iov[1].iov_len = (group_entries * sizeof (struct evs_group));
 	memcpy (&iov[2], iovec, iov_len * sizeof (struct iovec));
 	
-	error = saSendMsgRetry (evs_inst->fd, iov, 2 + iov_len);
-	if (error != SA_OK) {
-		goto error_exit;
-	}
+	pthread_mutex_lock (&evs_inst->response_mutex);
 
-	error = saRecvQueue (evs_inst->fd, &res_lib_evs_mcast_groups, &evs_inst->inq,
-		MESSAGE_RES_EVS_MCAST_GROUPS);
+	error = saSendMsgReceiveReply (evs_inst->response_fd, iov, iov_len + 2,
+		&res_lib_evs_mcast_groups, sizeof (struct res_lib_evs_mcast_groups));
 	if (error != SA_OK) {
 		goto error_exit;
 	}
@@ -569,6 +528,7 @@
 	error = res_lib_evs_mcast_groups.header.error;
 
 error_exit:
+	pthread_mutex_unlock (&evs_inst->response_mutex);
 	saHandleInstancePut (&evs_handle_t_db, *handle);
 
 	return (error);
Binary files d188.fixed.orig/lib/evs.o and d188.fixed/lib/evs.o differ
diff -uNr d188.fixed.orig/lib/evt.c d188.fixed/lib/evt.c
--- d188.fixed.orig/lib/evt.c	2005-02-18 12:23:11.000000000 -0700
+++ d188.fixed/lib/evt.c	2005-02-16 18:02:50.000000000 -0700
@@ -90,34 +90,35 @@
 	.handleInstanceDestructor	= eventHandleInstanceDestructor
 };
 
-struct message_overlay {
+struct res_overlay {
 	struct res_header header;
-	char data[0];
+	char data[MESSAGE_SIZE_MAX];
 };
 
 /*
  * data required to support events for a given initialization
  *
- * ei_fd:			fd received from the evtInitialize call.
+ * ei_dispatch_fd:	fd used for getting callback data e.g. async event data
+ * ei_response_fd:	fd used for everything else (i.e. evt sync api commands).
  * ei_callback:		callback function.
  * ei_version:		version sent to the evtInitialize call.
  * ei_node_id:		our node id.
  * ei_node_name:	our node name.
  * ei_finalize:		instance in finalize flag
- * ei_queue:		queue for async messages while doing sync commands
- * ei_mutex:		instance mutex
+ * ei_dispatch_mutex:	mutex for dispatch fd
+ * ei_response_mutex:	mutex for response fd
  *
  */
 struct event_instance {
-	int 					ei_fd;
+	int 					ei_dispatch_fd;
+	int 					ei_response_fd;
 	SaEvtCallbacksT			ei_callback;
 	SaVersionT				ei_version;
 	SaClmNodeIdT			ei_node_id;
 	SaNameT					ei_node_name;
 	int						ei_finalize;
-	struct queue			ei_inq;
-	char 					ei_message[MESSAGE_SIZE_MAX];
-	pthread_mutex_t			ei_mutex;
+	pthread_mutex_t			ei_dispatch_mutex;
+	pthread_mutex_t			ei_response_mutex;
 };
 
 
@@ -190,31 +191,18 @@
 static void evtHandleInstanceDestructor(void *instance)
 {
 	struct event_instance *evti = instance;
-	void **msg;
-	int empty;
 
 	/*
-	 * Empty out the queue if there are any pending messages
+	 * Disconnect from the server
 	 */
-	while ((saQueueIsEmpty(&evti->ei_inq, &empty) == SA_AIS_OK) && !empty) {
-		saQueueItemGet(&evti->ei_inq, (void *)&msg);
-		saQueueItemRemove(&evti->ei_inq);
-		free(*msg);
+    if (evti->ei_response_fd != -1) {
+		shutdown(evti->ei_response_fd, 0);
+		close(evti->ei_response_fd);
 	}
 
-	/*
-	 * clean up the queue itself
-	 */
-	if (evti->ei_inq.items) {
-			free(evti->ei_inq.items);
-	}
-
-	/*
-	 * Disconnect from the server
-	 */
-	if (evti->ei_fd != -1) {
-		shutdown(evti->ei_fd, 0);
-		close(evti->ei_fd);
+	if (evti->ei_dispatch_fd != -1) {
+		shutdown(evti->ei_dispatch_fd, 0);
+		close(evti->ei_dispatch_fd);
 	}
 }
 
@@ -243,6 +231,34 @@
 	}
 }
 
+static SaErrorT evt_recv_event(int fd, struct lib_event_data **msg)
+{
+	SaErrorT error;
+	struct res_header hdr;
+	void *data;
+
+	error = saRecvRetry(fd, &hdr, sizeof(hdr), MSG_WAITALL | MSG_NOSIGNAL);
+	if (error != SA_AIS_OK) {
+		goto msg_out;
+	}
+	*msg = malloc(hdr.size);
+	if (!*msg) {
+		error = SA_AIS_ERR_LIBRARY;
+		goto msg_out;
+	}
+	data = (void *)((unsigned long)*msg) + sizeof(hdr);
+	memcpy(*msg, &hdr, sizeof(hdr));
+	if (hdr.size > sizeof(hdr)) {
+		error = saRecvRetry(fd, data, hdr.size - sizeof(hdr),
+				MSG_WAITALL | MSG_NOSIGNAL);
+		if (error != SA_AIS_OK) {
+			goto msg_out;
+		}
+	}
+msg_out:
+	return error;
+}
+
 /* 
  * The saEvtInitialize() function initializes the Event Service for the 
  * invoking process. A user of the Event Service must invoke this function 
@@ -291,18 +307,10 @@
 	evti->ei_version = *version;
 
 	/*
-	 * An inq is needed to store async messages while waiting for a 
-	 * sync response
-	 */
-	error = saQueueInit(&evti->ei_inq, 1024, sizeof(void *));
-	if (error != SA_AIS_OK) {
-		goto error_handle_put;
-	}
-
-	/*
 	 * Set up communication with the event server
 	 */
-	error = saServiceConnect(&evti->ei_fd, MESSAGE_REQ_EVT_INIT);
+	error = saServiceConnectTwo(&evti->ei_response_fd,
+		&evti->ei_dispatch_fd, EVT_SERVICE);
 	if (error != SA_AIS_OK) {
 		goto error_handle_put;
 	}
@@ -316,7 +324,8 @@
 				sizeof(evti->ei_callback));
 	}
 
-	pthread_mutex_init(&evti->ei_mutex, NULL);
+ 	pthread_mutex_init(&evti->ei_dispatch_mutex, NULL);
+ 	pthread_mutex_init(&evti->ei_response_mutex, NULL);
 	saHandleInstancePut(&evt_instance_handle_db, *evtHandle);
 
 	return SA_AIS_OK;
@@ -353,7 +362,7 @@
 		return error;
 	}
 
-	*selectionObject = evti->ei_fd;
+	*selectionObject = evti->ei_dispatch_fd;
 
 	saHandleInstancePut(&evt_instance_handle_db, evtHandle);
 
@@ -449,14 +458,11 @@
 	struct event_instance *evti;
 	SaEvtEventHandleT event_handle;
 	SaEvtCallbacksT callbacks;
-	struct res_header **queue_msg;
-	struct res_header *msg = 0;
-	int empty;
 	int ignore_dispatch = 0;
 	int cont = 1; /* always continue do loop except when set to 0 */
 	int poll_fd;
-	struct message_overlay *dispatch_data;
-	struct lib_event_data *evt;
+	struct res_overlay dispatch_data;
+	struct lib_event_data *evt = 0;
 	struct res_evt_event_data res;
 
 	error = saHandleInstanceGet(&evt_instance_handle_db, evtHandle,
@@ -473,25 +479,26 @@
 	}
 
 	do {
-		poll_fd = evti->ei_fd;
+		poll_fd = evti->ei_dispatch_fd;
 
 		ufds.fd = poll_fd;
 		ufds.events = POLLIN;
 		ufds.revents = 0;
 
-		pthread_mutex_lock(&evti->ei_mutex);
-		saQueueIsEmpty(&evti->ei_inq, &empty);
+		error = saPollRetry(&ufds, 1, timeout);
+		if (error != SA_AIS_OK) {
+			goto error_unlock;
+		}
+
+		pthread_mutex_lock(&evti->ei_dispatch_mutex);
+
 		/*
-		 * Read from the socket if there is nothing in
-		 * our queue.
+		 * Check the poll data in case the fd status has changed
+		 * since taking the lock
 		 */
-		if (empty == 1) {
-			pthread_mutex_unlock(&evti->ei_mutex);
-			error = saPollRetry(&ufds, 1, timeout);
-			if (error != SA_AIS_OK) {
-				goto error_nounlock;
-			}
-			pthread_mutex_lock(&evti->ei_mutex);
+		error = saPollRetry(&ufds, 1, 0);
+		if (error != SA_AIS_OK) {
+			goto error_unlock;
 		}
 
 		/*
@@ -499,49 +506,37 @@
 		 */
 		if (evti->ei_finalize == 1) {
 			error = SA_AIS_OK;
-			pthread_mutex_unlock(&evti->ei_mutex);
+ 			pthread_mutex_unlock(&evti->ei_dispatch_mutex);
 			goto error_unlock;
 		}
 
-		dispatch_avail = (ufds.revents & POLLIN) | (empty == 0);
+ 		dispatch_avail = ufds.revents & POLLIN;
 		if (dispatch_avail == 0 && dispatchFlags == SA_DISPATCH_ALL) {
-			pthread_mutex_unlock(&evti->ei_mutex);
+			pthread_mutex_unlock(&evti->ei_dispatch_mutex);
 			break; /* exit do while cont is 1 loop */
-		} else
-		if (dispatch_avail == 0) {
-			pthread_mutex_unlock(&evti->ei_mutex);
+		} else if (dispatch_avail == 0) {
+			pthread_mutex_unlock(&evti->ei_dispatch_mutex);
 			continue; /* next poll */
 		}
 
-		saQueueIsEmpty(&evti->ei_inq, &empty);
-		if (empty == 0) {
-			/*
-			 * Queue is not empty, read data from queue
-			 */
-			saQueueItemGet(&evti->ei_inq, (void *)&queue_msg);
-			msg = *queue_msg;
-			dispatch_data = (struct message_overlay *)msg;
-			saQueueItemRemove(&evti->ei_inq);
-		} else {
-			/*
-			 * Queue empty, read response from socket
-			 */
-			dispatch_data = (struct message_overlay *)&evti->ei_message;
-			error = saRecvRetry(evti->ei_fd, &dispatch_data->header,
-				sizeof(struct res_header), MSG_WAITALL | MSG_NOSIGNAL);
+ 		if (ufds.revents & POLLIN) {
+ 			error = saRecvRetry (evti->ei_dispatch_fd, &dispatch_data.header,
+ 				sizeof (struct res_header), MSG_WAITALL | MSG_NOSIGNAL);
+
 			if (error != SA_AIS_OK) {
-				pthread_mutex_unlock(&evti->ei_mutex);
 				goto error_unlock;
 			}
-			if (dispatch_data->header.size > sizeof(struct res_header)) {
-				error = saRecvRetry(evti->ei_fd, dispatch_data->data,
-					dispatch_data->header.size - sizeof(struct res_header),
-					MSG_WAITALL | MSG_NOSIGNAL);
+ 			if (dispatch_data.header.size > sizeof (struct res_header)) {
+ 				error = saRecvRetry (evti->ei_dispatch_fd, &dispatch_data.data,
+ 					dispatch_data.header.size - sizeof (struct res_header),
+  					MSG_WAITALL | MSG_NOSIGNAL);
 				if (error != SA_AIS_OK) {
-					pthread_mutex_unlock(&evti->ei_mutex);
 					goto error_unlock;
 				}
-			}
+			} 
+		} else {
+ 			pthread_mutex_unlock(&evti->ei_dispatch_mutex);
+ 			continue;
 		}
 		/*
 		 * Make copy of callbacks, message data, unlock instance, 
@@ -550,50 +545,41 @@
 		 * EvtFinalize has been called in another thread.
 		 */
 		memcpy(&callbacks, &evti->ei_callback, sizeof(evti->ei_callback));
-		pthread_mutex_unlock(&evti->ei_mutex);
+		pthread_mutex_unlock(&evti->ei_dispatch_mutex);
 
 
 		/*
 		 * Dispatch incoming response
 		 */
-		switch (dispatch_data->header.id) {
-		case MESSAGE_RES_LIB_ACTIVATEPOLL:
-			/*
-			 * This is a do nothing message which the node 
-			 * executive sends to activate the file evtHandle 
-			 * in poll when the library has queued a message into 
-			 * evti->ei_inq. The dispatch is ignored for the 
-			 * following two cases:
-			 * 1) setting of timeout to zero for the 
-			 *    DISPATCH_ALL case
-			 * 2) expiration of the do loop for the 
-			 *    DISPATCH_ONE case
-			 */
-			ignore_dispatch = 1;
-			break;
+		switch (dispatch_data.header.id) {
 
 		case MESSAGE_RES_EVT_AVAILABLE:
 			/*
 			 * There are events available.  Send a request for one and then
 			 * dispatch it.
 			 */
-			evt = (struct lib_event_data *)&evti->ei_message;
 			res.evd_head.id = MESSAGE_REQ_EVT_EVENT_DATA;
 			res.evd_head.size = sizeof(res);
-			error = saSendRetry(evti->ei_fd, &res, sizeof(res), MSG_NOSIGNAL);
+ 
+ 			pthread_mutex_lock(&evti->ei_response_mutex);
+ 			error = saSendRetry(evti->ei_response_fd, &res, sizeof(res),
+ 				MSG_NOSIGNAL);
+ 
 			if (error != SA_AIS_OK) {
 				printf("MESSAGE_RES_EVT_AVAILABLE: send failed: %d\n", error);
 					break;
 			}
-			error = saRecvQueue(evti->ei_fd, evt, &evti->ei_inq, 
-											MESSAGE_RES_EVT_EVENT_DATA);
+ 			error = evt_recv_event(evti->ei_response_fd, &evt);
+ 			pthread_mutex_unlock(&evti->ei_response_mutex);
+
 			if (error != SA_AIS_OK) {
 				printf("MESSAGE_RES_EVT_AVAILABLE: receive failed: %d\n", 
 						error);
 				break;
 			}
 			/*
-			 * No data available.  This is OK.
+ 			 * No data available.  This is OK, another thread may have
+ 			 * grabbed it.
 			 */
 			if (evt->led_head.error == SA_AIS_ERR_NOT_EXIST) {
 				// printf("MESSAGE_RES_EVT_AVAILABLE: No event data\n");
@@ -619,7 +605,7 @@
 		case MESSAGE_RES_EVT_CHAN_OPEN_CALLBACK:
 		{
 			struct res_evt_open_chan_async *resa = 
-				(struct res_evt_open_chan_async *)dispatch_data;
+				(struct res_evt_open_chan_async *)&dispatch_data;
 			struct event_channel_instance *eci;
 
 			/*
@@ -647,7 +633,7 @@
 
 		default:
 			printf("Dispatch: Bad message type 0x%x\n",
-					dispatch_data->header.id);
+					dispatch_data.header.id);
 			error = SA_AIS_ERR_LIBRARY;	
 			goto error_nounlock;
 			break;
@@ -658,8 +644,9 @@
 		 * message from the queue and we are responsible
 		 * for freeing it.
 		 */
-		if (empty == 0) {
-			free(msg);
+		if (evt) {
+			free(evt);
+			evt = 0;
 		}
 
 		/*
@@ -711,22 +698,20 @@
 		return error;
 	}
 
-       pthread_mutex_lock(&evti->ei_mutex);
+       pthread_mutex_lock(&evti->ei_response_mutex);
 
 	/*
 	 * Another thread has already started finalizing
 	 */
 	if (evti->ei_finalize) {
-		pthread_mutex_unlock(&evti->ei_mutex);
+		pthread_mutex_unlock(&evti->ei_response_mutex);
 		saHandleInstancePut(&evt_instance_handle_db, evtHandle);
 		return SA_AIS_ERR_BAD_HANDLE;
 	}
 
 	evti->ei_finalize = 1;
 
-	saActivatePoll(evti->ei_fd);
-
-	pthread_mutex_unlock(&evti->ei_mutex);
+	pthread_mutex_unlock(&evti->ei_response_mutex);
 
 	saHandleDestroy(&evt_instance_handle_db, evtHandle);
 	saHandleInstancePut(&evt_instance_handle_db, evtHandle);
@@ -759,6 +744,7 @@
 	struct res_evt_channel_open res;
 	struct event_channel_instance *eci;
 	SaAisErrorT error;
+	struct iovec iov;
 
 	error = saHandleInstanceGet(&evt_instance_handle_db, evtHandle,
 			(void*)&evti);
@@ -783,7 +769,6 @@
 		goto chan_open_put;
 	}
 
-
 	/*
 	 * Send the request to the server and wait for a response
 	 */
@@ -795,19 +780,22 @@
 	req.ico_channel_name = *channelName;
 
 
-	pthread_mutex_lock(&evti->ei_mutex);
+	iov.iov_base = &req;
+	iov.iov_len = sizeof(req);
+
+	pthread_mutex_lock(&evti->ei_response_mutex);
+
+	error = saSendMsgReceiveReply(evti->ei_response_fd, &iov, 1,
+		&res, sizeof(res));
+
+	pthread_mutex_unlock (&evti->ei_response_mutex);
 
-	error = saSendRetry(evti->ei_fd, &req, sizeof(req), MSG_NOSIGNAL);
 	if (error != SA_AIS_OK) {
-		pthread_mutex_unlock (&evti->ei_mutex);
 		goto chan_open_free;
 	}
-	error = saRecvQueue(evti->ei_fd, &res, &evti->ei_inq, 
-					MESSAGE_RES_EVT_OPEN_CHANNEL);
 
-	pthread_mutex_unlock (&evti->ei_mutex);
-
-	if (error != SA_AIS_OK) {
+	if (res.ico_head.id != MESSAGE_RES_EVT_OPEN_CHANNEL) {
+		error = SA_AIS_ERR_LIBRARY;
 		goto chan_open_free;
 	}
 
@@ -849,6 +837,7 @@
 	struct event_channel_instance *eci;
 	struct req_evt_channel_close req;
 	struct res_evt_channel_close res;
+	struct iovec iov;
 
 	error = saHandleInstanceGet(&channel_handle_db, channelHandle,
 			(void*)&eci);
@@ -875,9 +864,6 @@
 		return SA_AIS_ERR_BAD_HANDLE;
 	}
 	eci->eci_closing = 1;
-
-	saActivatePoll(evti->ei_fd);
-
 	pthread_mutex_unlock(&eci->eci_mutex);
 	
 
@@ -888,18 +874,22 @@
 	req.icc_head.id = MESSAGE_REQ_EVT_CLOSE_CHANNEL;
 	req.icc_channel_handle = eci->eci_svr_channel_handle;
 
-	pthread_mutex_lock(&evti->ei_mutex);
+	iov.iov_base = &req;
+	iov.iov_len = sizeof (req);
+
+	pthread_mutex_lock(&evti->ei_response_mutex);
+
+	error = saSendMsgReceiveReply (evti->ei_response_fd, &iov, 1,
+		&res, sizeof (res));
+
+	pthread_mutex_unlock(&evti->ei_response_mutex);
 
-	error = saSendRetry(evti->ei_fd, &req, sizeof(req), MSG_NOSIGNAL);
 	if (error != SA_AIS_OK) {
-		pthread_mutex_unlock(&evti->ei_mutex);
 		eci->eci_closing = 0;
 		goto chan_close_put2;
 	}
-	error = saRecvQueue(evti->ei_fd, &res, &evti->ei_inq, 
-					MESSAGE_RES_EVT_CLOSE_CHANNEL);
-	pthread_mutex_unlock(&evti->ei_mutex);
-	if (error != SA_AIS_OK) {
+	if (res.icc_head.id != MESSAGE_RES_EVT_CLOSE_CHANNEL) {
+		error = SA_AIS_ERR_LIBRARY;
 		eci->eci_closing = 0;
 		goto chan_close_put2;
 	}
@@ -940,6 +930,7 @@
 	struct event_channel_instance *eci;
 	SaEvtChannelHandleT channel_handle;
 	SaAisErrorT error;
+	struct iovec iov;
 
 	error = saHandleInstanceGet(&evt_instance_handle_db, evtHandle,
 			(void*)&evti);
@@ -977,21 +968,23 @@
 	req.ico_invocation = invocation;
 	req.ico_open_flag = channelOpenFlags;
 	req.ico_channel_name = *channelName;
+	iov.iov_base = &req;
+	iov.iov_len = sizeof(req);
+
+
+	pthread_mutex_lock(&evti->ei_response_mutex);
 
+	error = saSendMsgReceiveReply (evti->ei_response_fd, &iov, 1,
+		&res, sizeof (res));
 
-	pthread_mutex_lock(&evti->ei_mutex);
+	pthread_mutex_unlock(&evti->ei_response_mutex);
 
-	error = saSendRetry(evti->ei_fd, &req, sizeof(req), MSG_NOSIGNAL);
 	if (error != SA_AIS_OK) {
-		pthread_mutex_unlock (&evti->ei_mutex);
 		goto chan_open_free;
 	}
-	error = saRecvQueue(evti->ei_fd, &res, &evti->ei_inq, 
-					MESSAGE_RES_EVT_OPEN_CHANNEL);
 
-	pthread_mutex_unlock (&evti->ei_mutex);
-
-	if (error != SA_AIS_OK) {
+	if (res.ico_head.id != MESSAGE_RES_EVT_OPEN_CHANNEL) {
+		error = SA_AIS_ERR_LIBRARY;
 		goto chan_open_free;
 	}
 
@@ -1045,6 +1038,7 @@
 	struct event_instance *evti;
 	struct req_evt_channel_unlink req;
 	struct res_evt_channel_unlink res;
+	struct iovec iov;
 	SaAisErrorT error;
 
 	error = saHandleInstanceGet(&evt_instance_handle_db, evtHandle,
@@ -1060,21 +1054,23 @@
 	req.iuc_head.size = sizeof(req);
 	req.iuc_head.id = MESSAGE_REQ_EVT_UNLINK_CHANNEL;
 	req.iuc_channel_name = *channelName;
+	iov.iov_base = &req;
+	iov.iov_len = sizeof(req);
+
 
+	pthread_mutex_lock(&evti->ei_response_mutex);
 
-	pthread_mutex_lock(&evti->ei_mutex);
+	error = saSendMsgReceiveReply (evti->ei_response_fd, &iov, 1,
+		&res, sizeof (res));
+
+	pthread_mutex_unlock(&evti->ei_response_mutex);
 
-	error = saSendRetry(evti->ei_fd, &req, sizeof(req), MSG_NOSIGNAL);
 	if (error != SA_AIS_OK) {
-		pthread_mutex_unlock (&evti->ei_mutex);
 		goto chan_unlink_put;
 	}
-	error = saRecvQueue(evti->ei_fd, &res, &evti->ei_inq, 
-					MESSAGE_RES_EVT_UNLINK_CHANNEL);
-
-	pthread_mutex_unlock (&evti->ei_mutex);
 
-	if (error != SA_AIS_OK) {
+	if (res.iuc_head.id != MESSAGE_RES_EVT_UNLINK_CHANNEL) {
+		error = SA_AIS_ERR_LIBRARY;
 		goto chan_unlink_put;
 	}
 
@@ -1548,6 +1544,7 @@
 	struct event_pattern *patterns;
 	void   *data_start;
 	int pub_sleep_trys = PUB_SLEEP_TRYS;
+	struct iovec iov;
 
 	if (eventDataSize > SA_EVT_DATA_MAX_LEN) {
 		error = SA_AIS_ERR_INVALID_PARAM;
@@ -1627,20 +1624,22 @@
 	req->led_publish_time = clustTimeNow();
 	req->led_priority = edi->edi_priority;
 	req->led_publisher_name = edi->edi_pub_name;
+	iov.iov_base = req;
+	iov.iov_len = req->led_head.size;
 
 	while (--pub_sleep_trys) {
-		pthread_mutex_lock(&evti->ei_mutex);
-		error = saSendRetry(evti->ei_fd, req, req->led_head.size, MSG_NOSIGNAL);
+		pthread_mutex_lock(&evti->ei_response_mutex);
+
+		error = saSendMsgReceiveReply(evti->ei_response_fd, &iov, 1,
+			&res, sizeof(res));
+
+		pthread_mutex_unlock (&evti->ei_response_mutex);
+
 		if (error != SA_AIS_OK) {
-			pthread_mutex_unlock (&evti->ei_mutex);
 			goto pub_put3_free;
 		}
-		error = saRecvQueue(evti->ei_fd, &res, &evti->ei_inq, 
-					MESSAGE_RES_EVT_PUBLISH);
-	
-		pthread_mutex_unlock (&evti->ei_mutex);
-
-		if (error != SA_AIS_OK) {
+		if (res.iep_head.id != MESSAGE_RES_EVT_PUBLISH) {
+			error = SA_AIS_ERR_LIBRARY;
 			goto pub_put3_free;
 		}
 
@@ -1711,6 +1710,7 @@
 	struct req_evt_event_subscribe *req;
 	struct res_evt_event_subscribe res;
 	int	sz;
+	struct iovec iov;
 
 	error = saHandleInstanceGet(&channel_handle_db, channelHandle,
 			(void*)&eci);
@@ -1757,20 +1757,16 @@
 	req->ics_channel_handle = eci->eci_svr_channel_handle;
 	req->ics_sub_id = subscriptionId;
 	req->ics_filter_size = sz;
+	iov.iov_base = req;
+	iov.iov_len = req->ics_head.size;
 
-	pthread_mutex_lock(&evti->ei_mutex);
-	error = saSendRetry(evti->ei_fd, req, req->ics_head.size, MSG_NOSIGNAL);
+	pthread_mutex_lock(&evti->ei_response_mutex);
+	error = saSendMsgReceiveReply(evti->ei_response_fd, &iov, 1,
+		&res, sizeof(res));
+	pthread_mutex_unlock (&evti->ei_response_mutex);
 	free(req);
-	if (error != SA_AIS_OK) {
-		pthread_mutex_unlock (&evti->ei_mutex);
-		goto subscribe_put2;
-	}
-	error = saRecvQueue(evti->ei_fd, &res, &evti->ei_inq, 
-					MESSAGE_RES_EVT_SUBSCRIBE);
 
-	pthread_mutex_unlock (&evti->ei_mutex);
-
-	if (error != SA_AIS_OK) {
+	if (res.ics_head.id != MESSAGE_RES_EVT_SUBSCRIBE) {
 		goto subscribe_put2;
 	}
 
@@ -1805,6 +1801,7 @@
 	struct event_channel_instance *eci;
 	struct req_evt_event_unsubscribe req;
 	struct res_evt_event_unsubscribe res;
+	struct iovec iov;
 
 	error = saHandleInstanceGet(&channel_handle_db, channelHandle,
 			(void*)&eci);
@@ -1823,19 +1820,20 @@
 
 	req.icu_channel_handle = eci->eci_svr_channel_handle;
 	req.icu_sub_id = subscriptionId;
+	iov.iov_base = &req;
+	iov.iov_len = sizeof(req);
+
+	pthread_mutex_lock(&evti->ei_response_mutex);
+ 	error = saSendMsgReceiveReply(evti->ei_response_fd, &iov, 1,
+ 		&res, sizeof(res));
+ 	pthread_mutex_unlock (&evti->ei_response_mutex);
 
-	pthread_mutex_lock(&evti->ei_mutex);
-	error = saSendRetry(evti->ei_fd, &req, sizeof(req), MSG_NOSIGNAL);
 	if (error != SA_AIS_OK) {
-		pthread_mutex_unlock (&evti->ei_mutex);
 		goto unsubscribe_put2;
 	}
-	error = saRecvQueue(evti->ei_fd, &res, &evti->ei_inq, 
-					MESSAGE_RES_EVT_UNSUBSCRIBE);
 
-	pthread_mutex_unlock (&evti->ei_mutex);
-
-	if (error != SA_AIS_OK) {
+	if (res.icu_head.id != MESSAGE_RES_EVT_UNSUBSCRIBE) {
+		error = SA_AIS_ERR_LIBRARY;
 		goto unsubscribe_put2;
 	}
 
@@ -1869,6 +1867,7 @@
 	struct event_channel_instance *eci;
 	struct req_evt_event_clear_retentiontime req;
 	struct res_evt_event_clear_retentiontime res;
+	struct iovec iov;
 
 	error = saHandleInstanceGet(&channel_handle_db, channelHandle,
 			(void*)&eci);
@@ -1888,20 +1887,21 @@
 	req.iec_channel_handle = eci->eci_svr_channel_handle;
 	req.iec_event_id = eventId;
 
-	pthread_mutex_lock(&evti->ei_mutex);
-	error = saSendRetry(evti->ei_fd, &req, sizeof(req), MSG_NOSIGNAL);
-	if (error != SA_AIS_OK) {
-		pthread_mutex_unlock (&evti->ei_mutex);
-		goto ret_time_put2;
-	}
-	error = saRecvQueue(evti->ei_fd, &res, &evti->ei_inq, 
-					MESSAGE_RES_EVT_CLEAR_RETENTIONTIME);
+	iov.iov_base = &req;
+	iov.iov_len = sizeof(req);
 
-	pthread_mutex_unlock (&evti->ei_mutex);
+	pthread_mutex_lock(&evti->ei_response_mutex);
+	error = saSendMsgReceiveReply(evti->ei_response_fd, &iov, 1,
+		&res, sizeof(res));
+	pthread_mutex_unlock (&evti->ei_response_mutex);
 
 	if (error != SA_AIS_OK) {
 		goto ret_time_put2;
 	}
+	if (res.iec_head.id != MESSAGE_RES_EVT_CLEAR_RETENTIONTIME) {
+		error = SA_AIS_ERR_LIBRARY;
+		goto ret_time_put2;
+	}
 
 	error = res.iec_head.error;
 
Binary files d188.fixed.orig/lib/evt.o and d188.fixed/lib/evt.o differ
Binary files d188.fixed.orig/lib/libais.a and d188.fixed/lib/libais.a differ
Binary files d188.fixed.orig/lib/libais.so and d188.fixed/lib/libais.so differ
Binary files d188.fixed.orig/lib/libais.so.1 and d188.fixed/lib/libais.so.1 differ
Binary files d188.fixed.orig/lib/libais.so.1.0 and d188.fixed/lib/libais.so.1.0 differ
Binary files d188.fixed.orig/lib/libevs.a and d188.fixed/lib/libevs.a differ
Binary files d188.fixed.orig/lib/libevs.so and d188.fixed/lib/libevs.so differ
Binary files d188.fixed.orig/lib/libevs.so.1 and d188.fixed/lib/libevs.so.1 differ
Binary files d188.fixed.orig/lib/libevs.so.1.0 and d188.fixed/lib/libevs.so.1.0 differ
diff -uNr d188.fixed.orig/lib/Makefile d188.fixed/lib/Makefile
--- d188.fixed.orig/lib/Makefile	2005-02-18 12:23:11.000000000 -0700
+++ d188.fixed/lib/Makefile	2005-02-17 14:06:34.000000000 -0700
@@ -28,12 +28,12 @@
 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 # THE POSSIBILITY OF SUCH DAMAGE.
 # Production mode flags
-#CFLAGS = -O3 -Wall
-#LDFLAGS = 
+CFLAGS = -O3 -Wall
+LDFLAGS = 
 
 # Debug mode flags
-CFLAGS = -g -DDEBUG -Wall
-LDFLAGS = -g
+#CFLAGS = -g -DDEBUG -Wall
+#LDFLAGS = -g
 
 # Profile mode flags
 #CFLAGS = -O3 -pg -DDEBUG
diff -uNr d188.fixed.orig/lib/util.c d188.fixed/lib/util.c
--- d188.fixed.orig/lib/util.c	2005-02-18 12:23:11.000000000 -0700
+++ d188.fixed/lib/util.c	2005-02-16 17:58:09.000000000 -0700
@@ -1,4 +1,6 @@
 /*
+ * vi: set autoindent tabstop=4 shiftwidth=4 :
+ *
  * Copyright (c) 2002-2004 MontaVista Software, Inc.
  *
  * All rights reserved.
@@ -67,13 +69,13 @@
 SaErrorT
 saServiceConnect (
 	int *fdOut,
-	enum req_init_types initType)
+	enum service_types service)
 {
 	int fd;
 	int result;
 	struct sockaddr_un address;
-	struct req_lib_init req_lib_init;
-	struct res_lib_init res_lib_init;
+	struct req_lib_response_init req_lib_response_init;
+	struct res_lib_response_init res_lib_response_init;
 	SaErrorT error;
 	gid_t egid;
 
@@ -95,16 +97,17 @@
 		return (SA_ERR_TRY_AGAIN);
 	}
 
-	req_lib_init.header.size = sizeof (req_lib_init);
-	req_lib_init.header.id = initType;
+	req_lib_response_init.resdis_header.size = sizeof (req_lib_response_init);
+	req_lib_response_init.resdis_header.id = MESSAGE_REQ_RESPONSE_INIT;
+	req_lib_response_init.resdis_header.service = service;
 
-	error = saSendRetry (fd, &req_lib_init, sizeof (struct req_lib_init),
-		MSG_NOSIGNAL);
+	error = saSendRetry (fd, &req_lib_response_init,
+		sizeof (struct req_lib_response_init), MSG_NOSIGNAL);
 	if (error != SA_OK) {
 		goto error_exit;
 	}
-	error = saRecvRetry (fd, &res_lib_init,
-		sizeof (struct res_lib_init), MSG_WAITALL | MSG_NOSIGNAL);
+	error = saRecvRetry (fd, &res_lib_response_init,
+		sizeof (struct res_lib_response_init), MSG_WAITALL | MSG_NOSIGNAL);
 	if (error != SA_OK) {
 		goto error_exit;
 	}
@@ -112,8 +115,8 @@
 	/*
 	 * Check for security errors
 	 */
-	if (res_lib_init.header.error != SA_OK) {
-		error = res_lib_init.header.error;
+	if (res_lib_response_init.header.error != SA_OK) {
+		error = res_lib_response_init.header.error;
 		goto error_exit;
 	}
 
@@ -125,6 +128,115 @@
 }
 
 SaErrorT
+saServiceConnectTwo (
+	int *responseOut,
+	int *callbackOut,
+	enum service_types service)
+{
+	int responseFD;
+	int callbackFD;
+	int result;
+	struct sockaddr_un address;
+	struct req_lib_response_init req_lib_response_init;
+	struct res_lib_response_init res_lib_response_init;
+	struct req_lib_dispatch_init req_lib_dispatch_init;
+	struct res_lib_dispatch_init res_lib_dispatch_init;
+	SaErrorT error;
+	gid_t egid;
+
+	/*
+	 * Allow set group id binaries to be authenticated
+	 */
+	egid = getegid();
+	setregid (egid, -1);
+
+	memset (&address, 0, sizeof (struct sockaddr_un));
+	address.sun_family = PF_UNIX;
+	strcpy (address.sun_path + 1, "libais.socket");
+	responseFD = socket (PF_UNIX, SOCK_STREAM, 0);
+	if (responseFD == -1) {
+		return (SA_ERR_SYSTEM);
+	}
+	result = connect (responseFD, (struct sockaddr *)&address, sizeof (address));
+	if (result == -1) {
+		return (SA_ERR_TRY_AGAIN);
+	}
+
+	req_lib_response_init.resdis_header.size = sizeof (req_lib_response_init);
+	req_lib_response_init.resdis_header.id = MESSAGE_REQ_RESPONSE_INIT;
+	req_lib_response_init.resdis_header.service = service;
+
+	error = saSendRetry (responseFD, &req_lib_response_init,
+		sizeof (struct req_lib_response_init),
+		MSG_NOSIGNAL);
+	if (error != SA_OK) {
+		goto error_exit;
+	}
+	error = saRecvRetry (responseFD, &res_lib_response_init,
+		sizeof (struct res_lib_response_init),
+		MSG_WAITALL | MSG_NOSIGNAL);
+	if (error != SA_OK) {
+		goto error_exit;
+	}
+
+	/*
+	 * Check for security errors
+	 */
+	if (res_lib_response_init.header.error != SA_OK) {
+		error = res_lib_response_init.header.error;
+		goto error_exit;
+	}
+
+	*responseOut = responseFD;
+
+/* if I comment out the 4 lines below the executive crashes */
+	callbackFD = socket (PF_UNIX, SOCK_STREAM, 0);
+	if (callbackFD == -1) {
+		return (SA_ERR_SYSTEM);
+	}
+	result = connect (callbackFD, (struct sockaddr *)&address, sizeof (address));
+	if (result == -1) {
+		return (SA_ERR_TRY_AGAIN);
+	}
+
+	req_lib_dispatch_init.resdis_header.size = sizeof (req_lib_dispatch_init);
+	req_lib_dispatch_init.resdis_header.id = MESSAGE_REQ_DISPATCH_INIT;
+	req_lib_dispatch_init.resdis_header.service = service;
+
+	req_lib_dispatch_init.conn_info = res_lib_response_init.conn_info;
+
+	error = saSendRetry (callbackFD, &req_lib_dispatch_init,
+		sizeof (struct req_lib_dispatch_init),
+		MSG_NOSIGNAL);
+	if (error != SA_OK) {
+		goto error_exit_two;
+	}
+	error = saRecvRetry (callbackFD, &res_lib_dispatch_init,
+		sizeof (struct res_lib_dispatch_init),
+		MSG_WAITALL | MSG_NOSIGNAL);
+	if (error != SA_OK) {
+		goto error_exit_two;
+	}
+
+	/*
+	 * Check for security errors
+	 */
+	if (res_lib_dispatch_init.header.error != SA_OK) {
+		error = res_lib_dispatch_init.header.error;
+		goto error_exit;
+	}
+
+	*callbackOut = callbackFD;
+	return (SA_OK);
+
+error_exit_two:
+	close (callbackFD);
+error_exit:
+	close (responseFD);
+	return (error);
+}
+
+SaErrorT
 saRecvRetry (
 	int s,
 	void *msg,
@@ -135,9 +247,8 @@
 	int result;
 	struct msghdr msg_recv;
 	struct iovec iov_recv;
-
-	iov_recv.iov_base = (void *)msg;
-	iov_recv.iov_len = len;
+	char *rbuf = (char *)msg;
+	int processed = 0;
 
 	msg_recv.msg_iov = &iov_recv;
 	msg_recv.msg_iovlen = 1;
@@ -148,14 +259,23 @@
 	msg_recv.msg_flags = 0;
 
 retry_recv:
+	iov_recv.iov_base = (void *)&rbuf[processed];
+	iov_recv.iov_len = len - processed;
+
 	result = recvmsg (s, &msg_recv, flags);
 	if (result == -1 && errno == EINTR) {
 		goto retry_recv;
 	}
-	if (result == -1 || result != len) {
-		error = SA_ERR_SYSTEM;
+	if (result == -1 || result == 0) {
+		error = SA_ERR_MESSAGE_ERROR;
+		goto error_exit;
 	}
-	assert (result == len);
+	processed += result;
+	if (processed != len) {
+		goto retry_recv;
+	}
+	assert (processed == len);
+error_exit:
 	return (error);
 }
 
@@ -165,99 +285,6 @@
 };
 
 SaErrorT
-saRecvQueue (
-	int s,
-	void *msg,
-	struct queue *queue,
-	int findMessageId)
-{
-	struct res_overlay *overlay;
-	void *inq_msg;
-	int match;
-	SaErrorT error;
-
-	do {
-		overlay = (struct res_overlay *)msg;
-		error = saRecvRetry (s, overlay, sizeof (struct res_header),
-			MSG_WAITALL | MSG_NOSIGNAL);
-		if (error != SA_OK) {
-			goto error_exit;
-		}
-		assert (overlay->header.size != 0);
-
-		match = (overlay->header.id == findMessageId);
-
-		/*
-		 * Item doesn't match, queue it
-		 */
-		if (match == 0 && queue) {
-			inq_msg = (void *)malloc (overlay->header.size);
-			if (inq_msg == 0) {
-				error = SA_ERR_NO_MEMORY;
-				goto error_exit;
-			}
-			memcpy (inq_msg, overlay, sizeof (struct res_header));
-			overlay = (struct res_overlay *)inq_msg;
-			if (overlay->header.size > sizeof (struct res_header)) {
-				error = saRecvRetry (s, &overlay->payload,
-					overlay->header.size - sizeof (struct res_header),
-					MSG_WAITALL | MSG_NOSIGNAL);
-				if (error != SA_OK) {
-					goto error_exit;
-				}
-			}
-
-			if (overlay->header.id != MESSAGE_RES_LIB_ACTIVATEPOLL) {
-				error = saQueueItemAdd (queue, &inq_msg);
-				if (error != SA_OK) {
-					free (inq_msg);
-					goto error_exit;
-				}
-
-				error = saActivatePoll (s);
-				if (error != SA_OK) {
-					goto error_exit;
-				}
-			}
-		} else {
-		/*
-		 *  its a match, so deliver it
-		 */
-			overlay = (struct res_overlay *)msg;
-			if (overlay->header.size > sizeof (struct res_header)) {
-				error = saRecvRetry (s, &overlay->payload,
-					overlay->header.size - sizeof (struct res_header),
-					MSG_WAITALL | MSG_NOSIGNAL);
-				if (error != SA_OK) {
-					goto error_exit;
-				}
-			}
-			break;
-		}
-	} while (match == 0);
-
-error_exit:
-	return (error);
-}
-
-SaErrorT
-saActivatePoll (int s) {
-	struct req_lib_activatepoll req_lib_activatepoll;
-	SaErrorT error;
-
-	/*
-	 * Send activate poll to tell nodeexec to activate poll
-	 * on this file descriptor
-	 */
-	req_lib_activatepoll.header.size = sizeof (req_lib_activatepoll);
-	req_lib_activatepoll.header.id = MESSAGE_REQ_LIB_ACTIVATEPOLL;
-
-	error = saSendRetry (s, &req_lib_activatepoll,
-		sizeof (struct req_lib_activatepoll), MSG_NOSIGNAL);
-	return (error);
-}
-
-SaErrorT
 saSendRetry (
 	int s,
 	const void *msg,
@@ -321,6 +348,55 @@
 	return (error);
 }
 
+SaErrorT saSendMsgReceiveReply (
+        int s,
+        struct iovec *iov,
+        int iov_len,
+        void *responseMessage,
+        int responseLen)
+{
+	SaErrorT error = SA_OK;
+
+	error = saSendMsgRetry (s, iov, iov_len);
+	if (error != SA_OK) {
+		goto error_exit;
+	}
+	
+	error = saRecvRetry (s, responseMessage, responseLen,
+		MSG_WAITALL | MSG_NOSIGNAL);
+	if (error != SA_OK) {
+		goto error_exit;
+	}
+
+error_exit:
+	return (error);
+}
+
+SaErrorT saSendReceiveReply (
+        int s,
+        void *requestMessage,
+        int requestLen,
+        void *responseMessage,
+        int responseLen)
+{
+	SaErrorT error = SA_OK;
+
+	error = saSendRetry (s, requestMessage, requestLen,
+		MSG_NOSIGNAL);
+	if (error != SA_OK) {
+		goto error_exit;
+	}
+	
+	error = saRecvRetry (s, responseMessage, responseLen,
+		MSG_WAITALL | MSG_NOSIGNAL);
+	if (error != SA_OK) {
+		goto error_exit;
+	}
+
+error_exit:
+	return (error);
+}
+
 SaErrorT
 saSelectRetry (
 	int s,
@@ -560,6 +636,7 @@
 	queueItem += queuePosition * queue->bytesPerItem;
 	memcpy (queueItem, item, queue->bytesPerItem);
 
+	assert (queue->tail != queue->head);
 	if (queue->tail == queue->head) {
 		return (SA_ERR_LIBRARY);
 	}
diff -uNr d188.fixed.orig/lib/util.h d188.fixed/lib/util.h
--- d188.fixed.orig/lib/util.h	2005-02-18 12:23:11.000000000 -0700
+++ d188.fixed/lib/util.h	2005-02-16 17:58:09.000000000 -0700
@@ -66,7 +66,13 @@
 SaErrorT
 saServiceConnect (
 	int *fdOut,
-	enum req_init_types init_type);
+	enum service_types service);
+
+SaErrorT
+saServiceConnectTwo (
+        int *responseOut,
+        int *callbackOut,
+        enum service_types service);
 
 SaErrorT
 saRecvRetry (
@@ -83,9 +89,6 @@
 	int findMessageId);
 
 SaErrorT
-saActivatePoll (int s);
-
-SaErrorT
 saSendRetry (
 	int s,
 	const void *msg,
@@ -97,6 +100,20 @@
 	struct iovec *iov,
 	int iov_len);
 
+SaErrorT saSendMsgReceiveReply (
+	int s,
+	struct iovec *iov,
+	int iov_len,
+	void *responseMessage,
+	int responseLen);
+
+SaErrorT saSendReceiveReply (
+	int s,
+	void *requestMessage,
+	int requestLen,
+	void *responseMessage,
+	int responseLen);
+
 SaErrorT
 saSelectRetry (
 	int s,
Binary files d188.fixed.orig/lib/util.o and d188.fixed/lib/util.o differ
Binary files d188.fixed.orig/test/ckptbench and d188.fixed/test/ckptbench differ
Binary files d188.fixed.orig/test/ckptbench.o and d188.fixed/test/ckptbench.o differ
Binary files d188.fixed.orig/test/ckptbenchth and d188.fixed/test/ckptbenchth differ
Binary files d188.fixed.orig/test/ckptbenchth.o and d188.fixed/test/ckptbenchth.o differ
Binary files d188.fixed.orig/test/ckptstress and d188.fixed/test/ckptstress differ
Binary files d188.fixed.orig/test/ckptstress.o and d188.fixed/test/ckptstress.o differ
Binary files d188.fixed.orig/test/evsbench and d188.fixed/test/evsbench differ
Binary files d188.fixed.orig/test/evsbench.o and d188.fixed/test/evsbench.o differ
Binary files d188.fixed.orig/test/evtbench and d188.fixed/test/evtbench differ
Binary files d188.fixed.orig/test/evtbench.o and d188.fixed/test/evtbench.o differ
diff -uNr d188.fixed.orig/test/Makefile d188.fixed/test/Makefile
--- d188.fixed.orig/test/Makefile	2005-02-18 12:23:11.000000000 -0700
+++ d188.fixed/test/Makefile	2005-02-16 17:58:09.000000000 -0700
@@ -53,12 +53,13 @@
 		testamf4.c testamf5.c testamf6.c testamfth.c  \
 		testckpt.c ckptstress.c testparse.c ckptbench.c  \
 		ckptbenchth.c testevt.c testevs.c evsbench.c \
-		subscription.c publish.c evtbench.c \
+		testevsth.c subscription.c publish.c evtbench.c \
 		sa_error.c
 
 all: testclm testamf testamf1 testamf2 testamf3 testamf4 testamf5 \
 	testamf6 testamfth testckpt ckptstress testparse ckptbench \
-	ckptbenchth testevt testevs evsbench subscription publish evtbench
+	ckptbenchth testevt testevs testevsth evsbench subscription \
+	publish evtbench
 
 testparse: testparse.o $(LIBRARIES)
 	$(CC) $(LDFLAGS) -o testparse testparse.o ../exec/parse.o ../exec/print.o ../exec/mempool.o ../exec/util.o
@@ -96,6 +97,9 @@
 testevs: testevs.o $(LIBS)
 	$(CC) $(LDFLAGS) -o testevs testevs.o $(LIBS)
 
+testevsth: testevsth.o $(LIBS)
+	$(CC) $(LDFLAGS) -o testevsth testevsth.o $(LIBS)
+
 evsbench: evsbench.o $(LIBS)
 	$(CC) $(LDFLAGS) -o evsbench evsbench.o $(LIBS)
 
@@ -129,7 +133,7 @@
 clean:
 	rm -f *.o testclm testamf testamf1 testamf2 testamf3 testamf4 \
 	testamf5 testamf6 testamfth testckpt ckptstress testparse testtimer \
-	ckptbench ckptbenchth testevt testevs \
+	ckptbench ckptbenchth testevt testevs testevsth \
 	evsbench subscription publish evtbench
 %.o: %.c
 	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
@@ -158,6 +162,7 @@
 ckptbenchth.o: ../include/ais_types.h ../include/saCkpt.h
 testevt.o: ../include/ais_types.h ../include/saEvt.h
 testevs.o: ../include/evs.h
+testevsth.o: ../include/evs.h
 evsbench.o: ../include/ais_types.h ../include/evs.h
 subscription.o: ../include/ais_types.h ../include/saEvt.h
 publish.o: ../include/ais_types.h ../include/saEvt.h
Binary files d188.fixed.orig/test/publish and d188.fixed/test/publish differ
Binary files d188.fixed.orig/test/publish.o and d188.fixed/test/publish.o differ
Binary files d188.fixed.orig/test/sa_error.o and d188.fixed/test/sa_error.o differ
Binary files d188.fixed.orig/test/subscription and d188.fixed/test/subscription differ
Binary files d188.fixed.orig/test/subscription.o and d188.fixed/test/subscription.o differ
Binary files d188.fixed.orig/test/testamf and d188.fixed/test/testamf differ
Binary files d188.fixed.orig/test/testamf1 and d188.fixed/test/testamf1 differ
Binary files d188.fixed.orig/test/testamf1.o and d188.fixed/test/testamf1.o differ
Binary files d188.fixed.orig/test/testamf2 and d188.fixed/test/testamf2 differ
Binary files d188.fixed.orig/test/testamf2.o and d188.fixed/test/testamf2.o differ
Binary files d188.fixed.orig/test/testamf3 and d188.fixed/test/testamf3 differ
Binary files d188.fixed.orig/test/testamf3.o and d188.fixed/test/testamf3.o differ
Binary files d188.fixed.orig/test/testamf4 and d188.fixed/test/testamf4 differ
Binary files d188.fixed.orig/test/testamf4.o and d188.fixed/test/testamf4.o differ
Binary files d188.fixed.orig/test/testamf5 and d188.fixed/test/testamf5 differ
Binary files d188.fixed.orig/test/testamf5.o and d188.fixed/test/testamf5.o differ
Binary files d188.fixed.orig/test/testamf6 and d188.fixed/test/testamf6 differ
Binary files d188.fixed.orig/test/testamf6.o and d188.fixed/test/testamf6.o differ
Binary files d188.fixed.orig/test/testamf.o and d188.fixed/test/testamf.o differ
Binary files d188.fixed.orig/test/testamfth and d188.fixed/test/testamfth differ
diff -uNr d188.fixed.orig/test/testamfth.c d188.fixed/test/testamfth.c
--- d188.fixed.orig/test/testamfth.c	2005-02-18 12:23:11.000000000 -0700
+++ d188.fixed/test/testamfth.c	2005-02-16 17:58:09.000000000 -0700
@@ -244,6 +244,7 @@
 	int result;
 	SaNameT compName;
 	pthread_t dispatch_thread;
+	pthread_attr_t dispatch_thread_attribute;
 
 	result = saAmfInitialize (&handle, &amfCallbacks, &version);
 	if (result != SA_OK) {
@@ -256,6 +257,9 @@
 	result = saAmfComponentRegister (&handle, &compName, NULL);
 	printf ("register result is %d (should be 1)\n", result);
 
+	pthread_attr_init (&dispatch_thread_attribute);
+	pthread_attr_setschedpolicy (&dispatch_thread_attribute, SCHED_FIFO);
+	pthread_attr_setschedparam (&dispatch_thread_attribute, 99);
 	pthread_create (&dispatch_thread, NULL, th_dispatch, &handle);
 
 	sleep (5);
Binary files d188.fixed.orig/test/testamfth.o and d188.fixed/test/testamfth.o differ
Binary files d188.fixed.orig/test/testckpt and d188.fixed/test/testckpt differ
Binary files d188.fixed.orig/test/testckpt.o and d188.fixed/test/testckpt.o differ
Binary files d188.fixed.orig/test/testclm and d188.fixed/test/testclm differ
Binary files d188.fixed.orig/test/testclm.o and d188.fixed/test/testclm.o differ
Binary files d188.fixed.orig/test/testevs and d188.fixed/test/testevs differ
Binary files d188.fixed.orig/test/testevs.o and d188.fixed/test/testevs.o differ
Binary files d188.fixed.orig/test/testevsth and d188.fixed/test/testevsth differ
diff -uNr d188.fixed.orig/test/testevsth.c d188.fixed/test/testevsth.c
--- d188.fixed.orig/test/testevsth.c	1969-12-31 17:00:00.000000000 -0700
+++ d188.fixed/test/testevsth.c	2005-02-16 18:24:18.000000000 -0700
@@ -0,0 +1,183 @@
+/*
+ * Copyright (c) 2004 MontaVista Software, Inc.
+ *
+ * All rights reserved.
+ *
+ * Author: Steven Dake (sdake at mvista.com)
+ *
+ * This software licensed under BSD license, the text of which follows:
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ *   this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * - Neither the name of the MontaVista Software, Inc. nor the names of its
+ *   contributors may be used to endorse or promote products derived from this
+ *   software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <errno.h>
+#include <pthread.h>
+#include "../include/evs.h"
+
+char *delivery_string;
+
+#define CALLBACKS 200000
+int callback_count = 0;
+void evs_deliver_fn (struct in_addr source_addr, void *msg, int msg_len)
+{
+#ifdef PRINT_OUTPUT
+	char *buf;
+	buf += 100000;
+	printf ("Delivery callback\n");
+	printf ("callback %d '%s' msg '%s'\n", callback_count, delivery_string, buf);
+#endif
+	callback_count += 1;
+	if (callback_count % 50 == 0) {
+		printf ("Callback %d\n", callback_count);
+	}
+}
+
+void evs_confchg_fn (
+	struct in_addr *member_list, int member_list_entries,
+	struct in_addr *left_list, int left_list_entries,
+	struct in_addr *joined_list, int joined_list_entries)
+{
+	int i;
+
+	printf ("CONFIGURATION CHANGE\n");
+	printf ("--------------------\n");
+	printf ("New configuration\n");
+	for (i = 0; i < member_list_entries; i++) {
+		printf ("%s\n", inet_ntoa (member_list[i]));
+	}
+	printf ("Members Left:\n");
+	for (i = 0; i < left_list_entries; i++) {
+		printf ("%s\n", inet_ntoa (left_list[i]));
+	}
+	printf ("Members Joined:\n");
+	for (i = 0; i < joined_list_entries; i++) {
+		printf ("%s\n", inet_ntoa (joined_list[i]));
+	}
+}
+
+evs_callbacks_t callbacks = {
+	evs_deliver_fn,
+	evs_confchg_fn
+};
+
+struct evs_group groups[3] = {
+	{ "key1" },
+	{ "key2" },
+	{ "key3" }
+};
+
+char buffer[1000];
+struct iovec iov = {
+	.iov_base = buffer,
+	.iov_len = sizeof (buffer)
+};
+
+void *th_dispatch (void *arg)
+{
+	evs_error_t result;
+	evs_handle_t *handle = (evs_handle_t *)arg;
+
+	printf ("THREAD DISPATCH starting.\n");
+	result = evs_dispatch (handle, EVS_DISPATCH_BLOCKING);
+	printf ("THREAD DISPATCH return result is %d\n", result);
+	return (0);
+}
+
+static struct sched_param sched_param = {
+    sched_priority: 99
+};
+
+int main (void)
+{
+	evs_handle_t handle;
+	evs_error_t result;
+	int i = 0;
+	pthread_t dispatch_thread;
+	pthread_attr_t dispatch_thread_attribute;
+
+	result = evs_initialize (&handle, &callbacks);
+	if (result != EVS_OK) {
+		printf ("Couldn't initialize EVS service %d\n", result);
+		exit (0);
+	}
+
+        pthread_attr_init (&dispatch_thread_attribute);
+        pthread_attr_setschedpolicy (&dispatch_thread_attribute, SCHED_FIFO);
+        pthread_attr_setschedparam (&dispatch_thread_attribute, &sched_param);
+
+        pthread_create (&dispatch_thread, NULL, th_dispatch, &handle);
+
+	printf ("Init result %d\n", result);
+	result = evs_join (&handle, groups, 3);
+	printf ("Join result %d\n", result);
+	result = evs_leave (&handle, &groups[0], 1);
+	printf ("Leave result %d\n", result);
+	delivery_string = "evs_mcast_joined";
+
+	/*
+	 * Demonstrate evs_mcast_joined
+	 */
+	for (i = 0; i < CALLBACKS/2; i++) {
+		sprintf (buffer, "evs_mcast_joined: This is message %d", i);
+try_again_one:
+		result = evs_mcast_joined (&handle, EVS_TYPE_AGREED, &iov, 1);
+		if (result == EVS_ERR_TRY_AGAIN) {
+			goto try_again_one;
+		} else
+		if (result != EVS_OK) {
+			printf ("Got error result, exiting %d\n", result);
+			exit (1);
+		}
+	}
+
+	/*
+	 * Demonstrate evs_mcast_joined
+	 */
+	delivery_string = "evs_mcast_groups";
+	for (i = 0; i < CALLBACKS/2; i++) {
+		sprintf (buffer, "evs_mcast_groups: This is message %d", i);
+try_again_two:
+		result = evs_mcast_groups (&handle, EVS_TYPE_AGREED,
+			 &groups[1], 1, &iov, 1);
+		if (result == EVS_ERR_TRY_AGAIN) {
+			goto try_again_two;
+		}
+	}
+
+	/*
+	 * Wait until all callbacks have been executed by dispatch thread
+	 */
+	for (;;) {
+		if (callback_count == CALLBACKS) {
+		printf ("Test completed successfully\n");
+			exit (0);
+		}
+	}
+	return (0);
+}
Binary files d188.fixed.orig/test/testevsth.o and d188.fixed/test/testevsth.o differ
Binary files d188.fixed.orig/test/testevt and d188.fixed/test/testevt differ
Binary files d188.fixed.orig/test/testevt.o and d188.fixed/test/testevt.o differ
Binary files d188.fixed.orig/test/testparse and d188.fixed/test/testparse differ
Binary files d188.fixed.orig/test/testparse.o and d188.fixed/test/testparse.o differ


More information about the Openais mailing list