* Europagate, 1995
*
* $Log: eti.c,v $
- * Revision 1.8 1995/04/20 15:12:24 adam
+ * Revision 1.11 1995/05/01 16:26:56 adam
+ * More work on resource monitor.
+ *
+ * Revision 1.10 1995/05/01 12:43:29 adam
+ * First work on resource monitor program.
+ *
+ * Revision 1.9 1995/04/21 16:37:43 adam
+ * Parent (eti) creates BOTH FIFOs. dtbsun is more happy now.
+ *
+ * Revision 1.8 1995/04/20 15:12:24 adam
* Minor hacks really.
*
* Revision 1.7 1995/04/19 16:01:57 adam
#include <setjmp.h>
#include <signal.h>
+#include <sys/file.h>
+#include <sys/stat.h>
+
#include <gw-log.h>
#include <gw-db.h>
#include <gip.h>
return 1;
}
+#if !USE_MONITOR
static void start_kernel (int argc, char **argv, int id)
{
pid_t pid;
exit (1);
}
}
+#endif
-static void deliver (struct str_queue *sq, GIP gip)
+static void deliver (struct str_queue *sq, GIP gip, const char *msg)
{
int index = 0;
- char *msg;
- gip_wline (gip, "mail\n");
+ gip_wline (gip, msg);
while ((msg = str_queue_get (sq, index++)))
gip_wline (gip, msg);
gip_wline (gip, "\001");
char from_str[LINE_MAX+1];
char subject_str[LINE_MAX+1];
char line_str[LINE_MAX+1];
+ char msg[20];
GW_DB user_db;
GIP gip;
void *user_info;
gw_log (GW_LOG_FATAL, module, "gw_db_lookup fail");
exit (1);
}
+#if USE_MONITOR
+ sprintf (fifo_server_name, "fifo.s");
+ sprintf (fifo_client_name, "fifo.c");
+#else
sprintf (fifo_server_name, "fifo.s.%d", id);
sprintf (fifo_client_name, "fifo.c.%d", id);
+#endif
gip = gipc_initialize (fifo_client_name);
r = gipc_open (gip, fifo_server_name, 0);
else if (pass == 2)
{
+#if USE_MONITOR
+ gw_log (GW_LOG_FATAL, module, "Cannot contact monitor");
+ exit (1);
+#else
+#if 0
gipc_close (gip);
gipc_destroy (gip);
unlink (fifo_server_name);
unlink (fifo_client_name);
gip = gipc_initialize (fifo_client_name);
+#endif
+
+ mknod (fifo_server_name, S_IFIFO|0666, 0);
start_kernel (argc, argv, id);
r = gipc_open (gip, fifo_server_name, 1);
}
{
gw_log (GW_LOG_FATAL, module, "Cannot start kernel");
exit (1);
+#endif
}
if (r < 0)
if (r == -2)
}
/* deliver message ... */
gw_log (GW_LOG_DEBUG, module, "Delivering mail");
- deliver (queue, gip);
+#if USE_MONITOR
+ sprintf (msg, "eti %d\n", id);
+#else
+ strcpy (msg, "mail\n");
+#endif
+ deliver (queue, gip, msg);
gw_log (GW_LOG_DEBUG, module, "Closing");
gipc_close (gip);
gipc_destroy (gip);