Index: trunk/Ohana/src/opihi/pcontrol/HostOps.c
===================================================================
--- trunk/Ohana/src/opihi/pcontrol/HostOps.c	(revision 3189)
+++ trunk/Ohana/src/opihi/pcontrol/HostOps.c	(revision 3203)
@@ -1,11 +1,18 @@
 # include "pcontrol.h"
 
-Queue *HostPool_Idle;
-Queue *HostPool_Busy;
-Queue *HostPool_Down;
-Queue *HostPool_Off;
+Stack *HostPool_Idle;
+Stack *HostPool_Busy;
+Stack *HostPool_Down;
+Stack *HostPool_Off;
 
-Queue *GetHostQueue (int QueueID) {
-  switch (QueueID) {
+void InitHostStacks () {
+  HostPool_Idle = InitStack ();
+  HostPool_Busy = InitStack ();
+  HostPool_Down = InitStack ();
+  HostPool_Off = InitStack ();
+}
+
+Stack *GetHostStack (int StackID) {
+  switch (StackID) {
     case PCONTROL_HOST_IDLE:
       return (HostPool_Idle);
@@ -17,5 +24,5 @@
       return (HostPool_Off);
     default:
-      fprintf (stderr, "error: unknown host queue\n");
+      fprintf (stderr, "error: unknown host stack\n");
       return (NULL);
   }
@@ -23,38 +30,40 @@
 }
 
-int PutHost (Host *host, int QueueID, int where) {
+int PutHost (Host *host, int StackID, int where) {
 
   int status;
-  Queue *queue;
+  Stack *stack;
 
-  queue = GetHostQueue (QueueID);
-  if (queue == NULL) return (FALSE);
+  stack = GetHostStack (StackID);
+  if (stack == NULL) return (FALSE);
 
-  host[0].status = QueueID;
-  status = PutObject (queue, where, host);
+  host[0].stack = StackID;
+  status = PutStack (stack, where, host);
   return (status);
 }
   
-Host *GetHost (int QueueID, int where) {
+Host *GetHost (int StackID, int where) {
 
   Host *host;
-  Queue *queue;
+  Stack *stack;
 
-  queue = GetHostQueue (QueueID);
-  if (queue == NULL) return (NULL);
+  stack = GetHostStack (StackID);
+  if (stack == NULL) return (NULL);
 
-  host = GetObject (queue, where);
+  host = GetStack (stack, where);
   return (host);
 }
 
-int FindHost (IDtype HostID, int QueueID) {
+int FindHost (IDtype HostID, int StackID) {
 
-  Queue *queue;
+  int i;
+  Host *host;
+  Stack *stack;
 
-  queue = GetHostQueue (QueueID);
-  if (queue == NULL) return (-2);
+  stack = GetHostStack (StackID);
+  if (stack == NULL) return (-2);
 
-  for (i = 0; i < queue[0].Nobject; i++) {
-    host = (Host *) queue[0].object;
+  for (i = 0; i < stack[0].Nobject; i++) {
+    host = (Host *) stack[0].object;
     if (host[0].HostID == HostID) {
       return (i);
@@ -64,14 +73,16 @@
 }
 
-int FindNamedHost (char *name, int QueueID) {
+int FindNamedHost (char *name, int StackID) {
 
-  Queue *queue;
+  int i;
+  Host *host;
+  Stack *stack;
 
-  queue = GetHostQueue (QueueID);
-  if (queue == NULL) return (-2);
+  stack = GetHostStack (StackID);
+  if (stack == NULL) return (-2);
 
-  for (i = 0; i < queue[0].Nobject; i++) {
-    host = (Host *) queue[0].object;
-    if (!strcasecmp (host[0].hostname, host)) {
+  for (i = 0; i < stack[0].Nobject; i++) {
+    host = (Host *) stack[0].object;
+    if (!strcasecmp (host[0].hostname, name)) {
       return (i);
     }
@@ -80,5 +91,5 @@
 }
 
-AddHost (char *hostname) {
+void AddHost (char *hostname) {
 
   Host *host;
@@ -94,8 +105,17 @@
   host[0].markoff  = FALSE;
   host[0].job      = NULL;
-  DownHost (host);
+  PutHost (host, PCONTROL_HOST_DOWN, STACK_BOTTOM);
 }
 
-DelHost (Host *host) {
+void DownHost (Host *host) {
+
+  CLOSE (host[0].stdin);
+  CLOSE (host[0].stdout);
+  CLOSE (host[0].stderr);
+  host[0].job = NULL;
+  PutHost (host, PCONTROL_HOST_DOWN, STACK_BOTTOM);
+}
+
+void DelHost (Host *host) {
   FREE (host[0].hostname);
   FREE (host[0].job);
@@ -103,10 +123,2 @@
 }
 
-MarkOffHost (Host *host) {
-  if (host[0].status != PCONTROL_HOST_BUSY) {
-    return (FALSE);
-  }
-  host[0].markoff  = TRUE;
-  PutObject (HostPool_Busy, host);  /**** where are we removing hosts? **/
-}
-
